Re: Image scaling (sign taken from a Pc Pen)

From: Mike D Sutton (EDais_at_mvps.org)
Date: 12/20/04


Date: Mon, 20 Dec 2004 23:55:15 -0000


> Mike. Since the example works pretty fun, is there any place where I should
> look so I can understand some of the things it does? I.E. what is minlevel,
> maxlevel, Level*** and so on. Is there any web site that explain why does
> this operations are done this way... because I supposed that everything has
> to have a logic. Maybe itīs complicated but it still is logic, isnīt it.
>
> Iīm asking this, because I want to learn and if the opportunity is given,
> enhace this code. If donīt understand deeply what it does, Iīm not going to
> be able to improve it.

I'm still writing the page that describes it all *g*
There's precious little information on graphics programming on VB which I'm trying to rectify through the EDais site, however it all
takes time of which I unfortunately don't have a great deal to spare!
If there's something specific you want more information on then please feel free to ask and we'll do our best to explain. As far as
the levels stuff goes then think of it as magnifying a subset of the data for an image, very useful for defining images with a low
contrast. MinLevel defines the low point and MaxLevel defines the high point of the range and any values in-between are scaled to
the full range of the channel (0-255) Any values that fall outside this range are clipped to the nearest extent (using the
Min()/Max() functions) so as to not overflow since each pixel is represented as a byte with a 0-255 range.
Since this is a 1:1 mapping (i.e. putting the same value in twice as input will return the same value both times) then we can short
circuit the process by calculating all the possible results once and storing them in a LookUp Table or LUT for short - This means
than the main image processing loop need only query the lookup table for the corresponding range adjusted value rather than having
to work it out for each pixel which generally gives a huge performance increase, especially as the complexity of the operation in
the method to produce the LUT is increased.
If you want to do more research then the levels adjustment is an image manipulation technique (often referred to as a filter), and
the API calls used to get/set the data are DIB related, should give you some keywords to hit Goole with :)
Hope this helps,

    Mike

 - Microsoft Visual Basic MVP -
E-Mail: EDais@mvps.org
WWW: http://EDais.mvps.org/


Quantcast