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!