# of counts in whole image vs #counts in masked image +mask? shoul be same or not???
조회 수: 1 (최근 30일)
이전 댓글 표시
Dear all,
I did histograms of :
1. whole image
2. image masked
3. image with inverted masked
I would expect sum of counts in 2+3 shall be same as in 1. But it is not. So is this because of the mask line width (I do masking with imfreehand).. and double assigning of some pixels to masked and reversed masked region?, or is my procedure somehow wrong. Scheme is as follows
masked_image=whole_image.*mask;
inverse_masked_image=whole_image.*(~mask)
the numbers differ like 1=65536, and(2+3)=78086..
thanks!
댓글 수: 4
Image Analyst
2014년 5월 17일
I don't have that image. Can you illustrate with a standard demo image like cameraman.tif or something?
채택된 답변
Image Analyst
2014년 5월 17일
All images are the same size (unless you cropped them), so all images should have the same number of counts . The fact that some pixels have been set to 0 or 255 (masked) does not affect the number of pixels they have and so the count from imhist() or hist() or histc() will be the same, which is numel(grayImage).
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!