Friday, April 20, 2012

Contrast Enhancement

Contrast enhancement is a useful tool so I thought I'd do a simple illustration of the procedure involved. Below is a Mathcad function, contrast(img,lbnd,ubnd), that I wrote for this purpose. One just needs to specify which image to enhance and give the upper and lower bounds of the pixel values. The function then stretches these bounds to fit within the 0 - 255 range of values allowed for an image.
In this example the green portion of an image of the Sun was selected for enhancement. An image histogram can be used to select the upper and lower bounds. In the histogram below the right peak was produced by pixels from the Sun's disk and the left from the surrounding area so it is easy to select the bounding values.
The function then generated the contrast enhanced image and an image reduced in size was used to check the results for the selected bounds.

No comments: