Image Processing Basics: Muhammad Jakaria Rahimi
Image Processing Basics: Muhammad Jakaria Rahimi
3/6/2015 1
Lecture Outline
• Image pixel coordinate.
• Image types and their conversion.
• Matlab functions for Image conversion.
• Image Histogram and Equalization.
• Level Adjustment.
3/6/2015 2
Image Pixel Coordinate
3/6/2015 3
Types of image: supported by MATLAB
• 8-bit gray scale image
3/6/2015 4
Indexed color image
3/6/2015 5
Intensity and Binary image
3/6/2015 6
Image conversion
3/6/2015
7
Matlab functions for Image conversion
• imread = read image data file with the specified format
• X = 8-bit grayscale image, 8-bit indexed image, or 24-bit RGB color image
• map = color map table for the indexed image (256 entries)
• imshow(X, map) = 8-bit image display.
• imshow(X) = 24-bit RGB color image display if image X is in a 24-bit RGB
• color format; grayscale image display if image X is in an 8-bit grayscale
format
• ind2gray = 8-bit indexed color image to 8-bit grayscale image conversion
• ind2rgb = 8-bit indexed color image to 24-bit RGB color image conversion
• rgb2ind = 24-bit RGB color image to 8-bit indexed color image conversion
• rgb2gray = 24-bit RGB color image to 8-bit grayscale image conversion
• im2double = 8-bit image to intensity image conversion
• mat2gray = image data to intensity image conversion
• im2uint8 = intensity image to 8-bit grayscale image conversion
3/6/2015 9
Solved example
3/6/2015 10
Example of Equalization
3/6/2015 11
Before After
3/6/2015 12
Color Image Equalization-I
3/6/2015 13
Color Image Equalization-II
3/6/2015 14
Indexed color Image Equalization
• Step 1. The RGB color map is converted to the YIQ color map. Note that
there are only 256 color table entries. Since the image contains the index
values, which point to locations on the color table containing RGB
components, it is natural to convert the RGB color table to the YIQ color
table.
• Step 2. The grayscale image is generated using the Y channel value, so that
grayscale equalization can be performed.
• Step 3. Grayscale equalization is executed.
• Step 4. The equalized 256 Y values are divided by their corresponding old Y
values to obtain the relative luminance scale factors.
• Step 5. Finally, the R, G, and B values are each scaled in the old RGB color
table with the corresponding relative luminance scale factor and are
normalized as new RGB channels in the color table in the correct range.
Then the new RGB color map is the output. (Multiply and Adjust)
3/6/2015 15
Indexed color Equalization
3/6/2015 16
Matlab function for equalization
• histeq=grayscale histogram equalization, or 8-
bit indexed color histogram equalization
• imhist = histogram display
• rgb2ntsc = 24-bit RGB color image to 24-bit
YIQ color image conversion
• ntsc2rgb = 24-bit YIQ color image to 24-bit
RGB color image conversion
3/6/2015 17
Image Histogram Equalizatio
3/6/2015
18
Equalization using MATLAB
3/6/2015
MATLAB Example 19
Linear Level Adjustment
• Sometimes, if the pixel range in an image is small, we can
adjust the image pixel level to make use of a full pixel range.
Hence, contrast of the image is enhanced.
3/6/2015 20
Level adjustment example
3/6/2015 21
Level adjustment (continued)
3/6/2015 22
3/6/2015 23
3/6/2015 24