Add two images and keep the values of pixels of new image not exceeding 1.

4 次查看(过去 30 天)
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.. :)

回答(1 个)

Matt J
Matt J 2012-11-5
Z=X+Y;
Z(Z>1)=1;

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by