You are on page 1of 4

clc; imag=imread('cameraman.

jpg'); subplot(2, 2, 1); imshow(imag); title('Original Image'); h=imhist(imag); subplot(2, 2, 2); bar(h); title('Hitogram of Original Image'); g=histeq(imag); subplot(2, 2, 3); imshow(g); title('Hitogram Equalization of Original Image'); l=imhist(g); subplot(2, 2, 4); bar(l); title('Hitogram of Equalized Image ');

Original Image 2000 1500 1000 500 0 Hitogram Equalization of Original Image 2000 1500 1000 500 0

Hitogram of Original Image

100

200

300

Hitogram of Equalized Image

100

200

300

clc; Image = imread('lena.jpg'); [rows columns numberOfColorBands] = size(Image); subplot(2, 2, 1); imshow(Image); title('Original Color Image'); redPlane = Image(:, :, 1); greenPlane = Image(:, :, 2); bluePlane = Image(:, :, 3);

pixelCountR = imhist(redPlane); subplot(2, 2, 2); bar(pixelCountR, 'r'); title('Histogram of red plane'); pixelCountG = imhist(greenPlane); subplot(2, 2, 3); bar(pixelCountG, 'g'); title('Histogram of green plane'); pixelCountB = imhist(bluePlane); subplot(2, 2, 4); bar(pixelCountB, 'b'); title('Histogram of blue plane');

imageeq=rgb2gray(Image); figure(); subplot(2, 2, 1); imshow(imageeq); title('Converted Image'); hist=imhist(imageeq); subplot(2, 2, 2); bar(hist); title('Histogram of Converted Image'); histe=histeq(imageeq); subplot(2, 2, 3); imshow(histe) title('Histogram Equalization'); histei=imhist(histe); subplot(2, 2, 4); bar(histei); title('Histogram of Equalized Image');

Original Color Image 6000

Histogram of red plane

4000

2000

0 Histogram of green plane 3000 4000 3000 2000 1000 1000 0

100

200

300

Histogram of blue plane

2000

100

200

300

100

200

300

Converted Image 3000

Histogram of Converted Image

2000

1000

0 Histogram Equalization 6000

100

200

300

Histogram of Equalized Image

4000

2000

100

200

300

You might also like