<< Chapter < Page Chapter >> Page >
H o u t ( y ) H i n ( x ) | f ' ( x ) | x = f - 1 ( y ) .

Since x and y need to be integers in [link] , the evaluation of x = f - 1 ( y ) needs to be rounded to the nearest integer.

The pixel transformation shown in [link] is not a one-to-one function. However, [link] still may be used to give insight into the effect of the transformation. Since theregions [ 0 , T 1 ] and [ T 2 , 255 ] map to the single points 0 and 255, we might expect "spikes" at the points 0 and 255 in theoutput histogram. The region [ 1 , 254 ] of the output histogram will be directly related to the input histogram through [link] .

First, notice from x = f - 1 ( y ) that the region [ 1 , 254 ] of the output is being mapped from the region [ T 1 , T 2 ] of the input. Then notice that f ' ( x ) will be a constant scaling factor throughout the entire region of interest. Therefore, the output histogram shouldapproximately be a stretched and rescaled version of the input histogram, with possible spikes at the endpoints.

Write a Matlab function that will perform the pixel transformation shown in [link] . It should have the syntax

output = pointTrans(input, T1, T2) .

Hints

  • Determine an equation for the graph in [link] , and use this in your function. Notice you have three input regionsto consider. You may want to create a separate function to apply this equation.
  • If your function performs the transformation one pixel at a time, be sure to allocate the space for the output image at the beginningto speed things up.

Download the image file narrow.tif and read it into Matlab.Display the image, and compute its histogram. The reason the image appears "washed out" is that it has a narrow histogram.Print out this picture and its histogram.

Now use your pointTrans function to spread out the histogram using T 1 = 70 and T 2 = 180 . Display the new image and its histogram. (You can open another figure window using the figure command.) Do you notice a difference in the "quality" of the picture?

Inlab report

  1. Hand in your code for pointTrans .
  2. Hand in the original image and its histogram.
  3. Hand in the transformed image and its histogram.
  4. What qualitative effect did the transformation have on the original image? Do you observe any negative effects of the transformation?
  5. Compare the histograms of the original and transformed images. Why are there zeros in the output histogram?

Gamma correction

Download the file dark.tif for the following section.

The light intensity generated by a physical device is usually a nonlinear function of the original signal. For example, a pixel that hasa gray level of 200 will not be twice as bright as a pixel with a level of 100. Almost all computer monitors havea power law response to their applied voltage. For a typical cathode ray tube (CRT),the brightness of the illuminated phosphors is approximately equal to the applied voltage raised to a power of 2.5.The numerical value of this exponent is known as the gamma ( γ ) of the CRT. Therefore the power law is expressed as

I = V γ

where I is the pixel intensity and V is the voltage applied to the device.

If we relate [link] to the pixel values for an 8-bit image, we get the following relationship,

y = 255 x 255 γ

where x is the original pixel value, and y is the pixel intensity as it appears on the display.This relationship is illustrated in [link] .

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Purdue digital signal processing labs (ece 438). OpenStax CNX. Sep 14, 2009 Download for free at http://cnx.org/content/col10593/1.4
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Purdue digital signal processing labs (ece 438)' conversation and receive update notifications?

Ask