How can you use svd() command on an uint8 matrix?

20 views (last 30 days)
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.

Accepted Answer

Walter Roberson
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));

More Answers (0)

Categories

Find more on Linear Algebra in Help Center and File Exchange

Products


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!