フィルターのクリア

Why does the image after subtracting the original image from average image displays a black screen

2 ビュー (過去 30 日間)
Why does the image after subtracting the original image from average image displays a black screen?

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 7 月 14 日
編集済み: KALYAN ACHARJYA 2019 年 7 月 14 日
There may be two issues-
  1. Suppose the image as following-
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
imshow(difference_image,[]);
Better to check the pixels on difference image, you may easily find out the reason.
Still, not clear let me know.
  3 件のコメント
Image Analyst
Image Analyst 2019 年 7 月 14 日
Unless your image1 was always brighter than every pixel in image 2, then you'll still have the problem I described below in my answer, and that is, negative values will be clipped. So simply using [] and not casting to double will ONLY show you positive differences, not negative differences. That's why it's safer to always cast to double when you're doing a subtraction, like I showed you in my answer. But if your first image is always brighter, or you only care about the pixels that are brighter, then doing a subtraction without casting to double would be OK (though it's not a good practice in general).

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2019 年 7 月 14 日
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);
imshow(diffImage, []);

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by