- Suppose the image as following-
Why does the image after subtracting the original image from average image displays a black screen
7 views (last 30 days)
Show older comments
karishma koshy on 14 Jul 2019
Commented: KALYAN ACHARJYA on 14 Jul 2019
Why does the image after subtracting the original image from average image displays a black screen?
Edited: KALYAN ACHARJYA on 14 Jul 2019
There may be two issues-
image=[3 4 5;5 6 7;1 2 0];
If you calulate the average of the image,you will get the almost same image (near values).Therefore original image - average image = Near about zero matrix or lower values, hence difference may show as black image (image having lower pixels values).
2. If the difference is smaller range, Matlab auto set to display, therefore use full scale range
Better to check the pixels on difference image, you may easily find out the reason.
Still, not clear let me know.
More Answers (1)
Image Analyst on 14 Jul 2019
Some or all of your values may be small (too dark to see) or would be negative (and so they will be clipped to zero if you have a uint8 image). Cast to double before subtracting, so negative numbers will be allowed (not clipped), then use  in imshow() so that negative numbers will show up:
diffImage = double(image1) - double(image2);
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!