subtract each pixel from average pixel value
Ältere Kommentare anzeigen
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?
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 17 Mai 2019
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 Kommentare
Ahmad Alenezi
am 10 Okt. 2019
I think the last answer is right !
Image Analyst
am 12 Okt. 2019
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.
Kategorien
Mehr zu Image Category Classification finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!