why we need to convert the uint8 to double
4 views (last 30 days)
Show older comments
double()
1 Comment
Answers (1)
Star Strider
on 7 Feb 2016
Most images are uint8, and this limits most operations to 8-bit precision, if they can be done at all. (Many functions accept only double-precision arguments.) You need to convert them to double to perform certain calculations on them such as fft2, fftn, or other such operations.
2 Comments
Walter Roberson
on 7 Feb 2016
In particular if you want to do image subtraction then you need to convert to a data type that supports signed values.
Also if you want to calculate ratios then you need a floating point data type as ratios of integers immediately rounds to 0 or 1.
Image Analyst
on 7 Feb 2016
conv2() is also a really common image processing routine that requires doubles. Summing also would if you would exceed the max value allowable for that integer type.
See Also
Categories
Find more on Image Filtering and Enhancement in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!