how to convert image of size < 256*256unit8> into size<256*256double> on matlab
2 views (last 30 days)
Show older comments
i have two image(suppose a and b) of size 256*256unit8 and of size 256*256double. and i want to modulate both image so how to do? modulation means a.*b but due to different size a.*b gives an error, so how to make same size of both images?
0 Comments
Accepted Answer
Jan
on 22 Mar 2017
Edited: Jan
on 22 Mar 2017
But both images have the same size, only the type differs. If you get an error, it would be useful if you post the complete message and the line of code, which produces the error.
The double array might have values between 0.0 and 1.0, while the uint8 image contains values in the range of 0 to 255. For the result this might be important. So perhaps you want:
a = randi([0, 255], 256, 256, 'uint8');
b = rand(256, 256);
c = double(a)/255 .* b;
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!