Image processing help. Multiplication of Images gives different results at Unit16, unit 32, unit 8.
Show older comments
[EDIT: 20110611 23:32 CDT - reformat - WDR]
Codes :
a=imread('b.jpg');b=imread('c.jpg');c=a.*b;imshow(c)
a1=uint16(a);b1=uint16(b);c1=a1.*b1;imshow(c1)
a2=uint32(a);b2=uint32(b);c2=a2.*b2;imshow(c2)
I am not sure how to upload the picture I am using. I will let you know the problem now.
I am trying to 2 images. a and b.
1) Using unit 8 , I get some distortions.
2) Using unit 16, I am getting the required image.
3) Using unit 32, I am getting a complete black image.
Please let me know the problem. My friend needs this for her project. She asked me, I am not sure what is the problem. Please reply. Thank you.
Accepted Answer
More Answers (1)
Alex Taylor
on 13 Jun 2011
Hi Vijay,
Walter's answer is accurate. I just wanted to add that since you have the Image Processing Toolbox, you might look at the Image Processing functions im2uint16 and im2uint32.
Unlike the MATLAB casting functions Walter used, the Image Processing Toolbox conversion functions manage both the casting and rescaling of your data when moving to other datatypes.
doc im2uint16
Categories
Find more on Convert Image Type 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!