How can you use svd() command on an uint8 matrix?
20 views (last 30 days)
Show older comments
Nicholas
on 14 Dec 2024 at 15:12
Answered: Walter Roberson
on 14 Dec 2024 at 17:04
I am trying to use single value decomposition on the matrix for an image to do image compression. When trying to use the svd() command, it says my input must be single or double. For reference, the matrix is a 2583 x 4220 uint8 matrix. The image of which is a 3 x 3 matrix.
0 Comments
Accepted Answer
Walter Roberson
on 14 Dec 2024 at 17:04
In order to run svd() on a uint8 matrix, you need to run your own svd() function that handles singular value decomposition on a uint8 matrix, and save the code in a file named '@uint8/svd.m' . In theory that should act to define svd on datatype uint8.
Most people find it easiest to
[U,S,V] = svd(double(YourMatrixNameGoesHere));
0 Comments
More Answers (0)
See Also
Categories
Find more on Linear Algebra 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!