|
|
Notes 0003Human Visual SystemHumans vision is generally very limited. We can only generally see wavelenghts of about 380nm to about 750nm (nanometers, 10-9 meters). The wavelengths for red, green, and blue colors are around 570-645nm, 526-535nm, and 444-445nm respectively. The eyes tend to see the `center' of that spectrum well (ie: the green color), but not the ends. This can be exploited by image compression and image filtering schemes (discussed later). When the eye sees things, it gets a residual image, that `refreshes' around ~10-70Hz, depending on the color. This limited sensitivity to change is primarily responsible for the fact that we see video and not flashing frames. (What that also means is that you can create a game that runs at 15fps and it may still appear to run `smooth'). Anyway, more on the human visual system & signals/waves, etc., later on in the course. ImagesImages are just a 2D array of pixel values. Some images (graphics) use indexed color. That just means that the actual color is stored in a table someplace. That table is known as the pallet. Usually, in situations where there are 256 colors total, the indexed images are used (BMP, GIF). In situations where there are many more colors, the actual color values are stored. Often, the colors are stored in RGB format, where there are 8bit Red, 8bit Green, and 8bit Blue---making the total 24bit color. In some cases (presentation) there is an additional 8bit Alpha component, which indicates how translucent the color is; that would be 32bit color. Some graphics formats divide the color spectrum unevenly. It turns out that the human eye is not as sensitive to the color blue & red than it is to the color green. So often graphics formats (like JPEG & DVDs) primarily store the `green' colors, and then low resolutions of the red and blue images. HistogramOne of the most basic operations on images is calculating the Histogram, also sometimes known as Probability Mass Function. What this is is just a count of how many times each color appears, and normalized into a rage of 0 to 1. So if the image has 256 colors, the output would be 256 numbers 0 to 1, indicating how many times each color appears (sometimes it is not really necessary to normalize them into a range 0 to 1). A closely related operation is the Cumulative Mass Function, which is just the cumulative view of the histogram, where all the histogram values approach and eventually add up to 1. Histograms have many applications. They're very often used for scene detection in video: the histogram of each frame of the video won't usually differ much from the previous frame---unless there was a scene change. Point ProcessingAny technique that changes the value of a pixel using the value of the pixel itself AND the location falls under the general heading of ``Point Processing''. Point Processing technique that doesn't use the LOCATION of the pixel falls under the name: ``Homogeneous Point Processing'' It is important to note that `Point Processing' is independent of neighboring pixels. Applications?NegationYou've probably seen `negation' filter in image processing programs (or even in digital cameras). This operations makes bright pixels dark, and dark pixels bright. All it is is simply (assuming 8bit per color): newcolor = 255 - oldcolor You do that for the red-green-blue channels, and the image will be `negated'. Brighten/DarkenYou can also use Point Processing to brighten or darken an image. The idea is simply to increment the color values a bit (sort of). To do this effectively, you better use a power function: newcolor = 255 * (oldcolor/255)pow If the `pow' is less than 1, then the image is brightened, otherwise it gets darker. Try it with values 0.9 and 1.1. The catch however is that the image looses contrast as you brighten it (you won't notice the effect, but after a few brightenings it will be obvious). An interesting thing that happens with these darken/brighten operations is that the image histogram just moves a bit, but doesn't really change form. Brightness/ContrastYou can use a linear transform to alter brightness/contrast of an image. The general equation is: newcolor = contrast * oldcolor + brightness Usually this is necessary when scaling histograms. For example, lets say the screen can display a range of colors from 0 to 255, but our image only ranges from 20 minimum to 120 maximum color values. We can scale this range to fit the screen range. ie: The gist is to calculate the ideal contrast and brightness values. contrast = (range of values screen can display) / (range of values in our image). For our example above: contrast = (255 - 0) / (120-20) The brightness is a bit trickier. It's: brightness = ((display min)*(image max) - (display max)*(image min))/(range of values in our image). For our above example: brightness = 255*20/(120-20) If you apply this function to every pixel, and then recompute the histogram, it will seem like the histogram is stretched to fill the available spectrum.
|