How to divide intensity values of one grayscale image to the intensity values of another grayscale image??
1 view (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
Image Analyst
on 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);
More Answers (1)
Stephen23
on 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 ./ .
0 Comments
See Also
Categories
Find more on Image Processing Toolbox 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!