Add two images and keep the values of pixels of new image not exceeding 1.
Show older comments
Hi Everyone! I have problem, I add two gray scale images X and Y. The values of X and Y are between 0 and 1 as these are gray images. But by adding X and Y some values of the pixel in new image that is Z are exceeding from 1. The reason is that some pixel of X having value 0.9 and when it is added to some Y pixel having values 0.9, then the new value is 1.8 which is acceding to 1. I want to keep all the values to 1 that are exceeding from 1 by addition X and Y , if the values of the pixel on new image Z is not exceeding 1 then don't make any change to that values of Z image.
I hope will g0t my point... if not please write in comment.. :)
Answers (1)
Matt J
on 5 Nov 2012
Z=X+Y;
Z(Z>1)=1;
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!