Results 1 to 3 of 3

Thread: Image scaling deformation correction

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2001
    Posts
    46

    Question Image scaling deformation correction

    You know, if you scale an image to a bigger size (e.g. with StrechBlt), it deforms. Because StrechBlt scales the image point by point (or pixel by pixel), so the every point of image starts to seem as awarable square, thus the image deforms.
    But, if you have transformed an image by scaling in Adobe Photoshop, you know it corrects these deformations (as much as it can) like redrawing the image in the new size. The result is much better than StrechBlt`s.
    My question is how can we do this in a VB project, I think an algorithm is required.
    If you have an idea for how to do this, would you please share.
    Thanks in advance.

  2. #2
    Lively Member Flustor's Avatar
    Join Date
    Sep 2001
    Location
    A small hole in Birmingham
    Posts
    76

    Thumbs up

    I had exactly this problem in my final year project at University, object recognition stuff. If you run a smoothing algorithm after the scale it looks a bit better.

    My idea of smoothing was to work along the picture pixel by pixel from top left to bottom right.
    By moving around the current pixel I'd look at the ajoining pixels (the pixel directly above, above right, right...) and take an average of their colour and apply that to the current pixel.

    Hope this helps

    Flustor
    My Spidey senses are tingling!

  3. #3
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Smoothing ACK!

    It'll make it look blurry and all after the smooth, and what happens when they resize it just a couple of pixels ouch! No quality.

    So you do an algorithm called linear filtering (I believe) to do the work for you. It can be found in the Graphics Programming for Visual Basic 2nd edition, or maybe somewhere on the web. If you want to do this in real-time you must use DirectX or ASM code routines. DirectX is usually the way to go. If it doesnt matter about speed go for the pointer method suggested at lucky's vb gaming site in the tutorials section.

    The address is http://rookscape.com/vbgaming/

    As always, happy coding!
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width