How to divide intensity values of one grayscale image to the intensity values of another grayscale image??

1 Ansicht (letzte 30 Tage)
Please help! I have two gray scale images. I want to divide each pixel value of one image with the corresponding pixel value of the other gray scale image.
Simply put, how to divide pixels of one gray scale image to the other?
Thanks.

Akzeptierte Antwort

Image Analyst
Image Analyst am 2 Sep. 2014
If they're uint8, be sure to cast to double first or else you'll get clipping.
ratioImage = double(image1) ./ double(image2);
To display, use []:
imshow(ratioimage, []);
You can cast back to uint8 if you want, but that will lose fractions less than 1, so it should only be done when you know all the numbers will be well above 1.
ratioImage = uint8(ratioImage);
  1 Kommentar
Hamza Ahmed
Hamza Ahmed am 2 Sep. 2014
Thanks for the advice Image analyst! I see why I was having problems with my result. After converting to double, it worked perfectly! Thanks

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Stephen23
Stephen23 am 2 Sep. 2014
If each of your grayscale images is the same size matrix, then you can simply use the matrix right division . This also has the shorthand ./ .

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by