subtract each pixel from average pixel value
이전 댓글 표시
i have taken mean pixel value of an image and now i have to subtract from each pixel value of the image the average pixel value...how can i do it?
채택된 답변
추가 답변 (1개)
Image Analyst
2019년 5월 17일
Try (for an integer gray level image):
newImage = double(yourImage) - meanValue;
where you said you already have the meanValue, or
meanValue = mean2(yourImage);
if you don't.
newImage will be a floating point image, which is the only way to handle negative values in the subtraction.
댓글 수: 2
Ahmad Alenezi
2019년 10월 10일
I think the last answer is right !
Image Analyst
2019년 10월 12일
Correct. And since about half the values will be negative if you subtract the mean, the accepted answer will be wrong for about half the pixels, whereas my code won't be wrong for any of them.
카테고리
도움말 센터 및 File Exchange에서 Image Category Classification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!