how can i plot a histogram of pixel values?

1 view (last 30 days)
i'm working on a simulation and it contains a histogram of pixel differences for original image and marked one. but i do not understand this plot (that comes in attachment). can anybody please review it and guide me on that?
  2 Comments
sanaz
sanaz on 20 Jul 2014
i had but seems like it was not attached, i did again, can you see it now?

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 20 Jul 2014
Edited: Image Analyst on 20 Jul 2014
Your plot shows that there is a pixel-to-pixel difference (same location) of anywhere from -4 to +0.5 gray levels.
diffImage = double(image1) - double(image2);
minValue = min(diffImage(:));
maxValue = max(diffImage(:));
edges = linspace(minValue, maxValue, 500); % 500 bins
counts = histc(diffImage(:));
plot(edges, counts, 'b-');
grid on;
  3 Comments
sanaz
sanaz on 21 Jul 2014
i corrected it and got the right answer. thank you very much.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!