Question

Matlab code(well commented): Develop an Algorithm to generate a histogram by counting the different intensity levels....

Matlab code(well commented): Develop an Algorithm to generate a histogram by counting the different intensity levels. Use your algorithm with the image and compare to results to the 'imhist()' command results on the image.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) Without IMHIST Function:

I=imread('pout.tif');   % Reading Image

[r,c]=size(I)          

n=r*c;                  % Total Pixels

x=1:256;

y=x';

G=imhist(I);            % G contains number of pixels at each

                          Intensity

cdf=cumsum(G);

cdfmin=min(cdf);

for i=1:256

h(i)= round(((cdf(i)-cdfmin)/(n-1))*255); %equalized pixel

                                           intensities                             

end

T=[y,G,cdf,h'];         % to generate table

new_image = zeros(r,c); % creating New Image matrix

new_image = uint8(new_image);

for i=1:r

     for j=1:c

               new_image(i,j) = h(I(i,j)+1);

     end

end

subplot(2,2,1);imshow(I);title('original image');

subplot(2,2,2);imhist(I);title('histogram of original image');

subplot(2,2,3);imshow(new_image);title('equalized image');

subplot(2,2,4);imhist(new_image);title('histogram of Eq. Image’);

Add a comment
Know the answer?
Add Answer to:
Matlab code(well commented): Develop an Algorithm to generate a histogram by counting the different intensity levels....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT