Use the funmap and levelmap functions to map a function of intensity, or a vector of new intensity levels, onto an existing image. Function and level maps specify a uniform transformation on intensity levels in an image or image transform. Like equalization, you can also use these functions to optimize the display of an image.
This function applies the defined function to each element of the matrix.
1. Construct a test matrix:
2. Define a function.
3. Call funmap to apply function f on every element of matrix M.
The same result can be achieved by using the vectorize operator:
4. Read in a sample image.
5. Define a new function.
6. Call funmap to apply function f to the image R. Use the Re function to make sure all the values returned are real.
7. Display the original and transformed images.
(arcs.bmp)
(arcs_fm.bmp)
8. Try other definitions of function f and view the different transformations.
(arcs_fm2.bmp)
(arcs_fm3.bmp)
(arcs_fm4.bmp)
levelmap
The levelmap function replaces the intensities in an image with the intensity levels given by vector vec. For example, the 100th element in vec gives the new level for pixels with intensity 100.
0 < the entries of M < (vec - 1)
1. To compensate an image with a squared intensity scale, create the following vector.
2. Define a level map that maps the image display irregularities to their correct values.
Recall that
The level map is
3. Apply levelmap to the sample image and view the effect.