How to creat a sparse matrix?
1 次查看(过去 30 天)
显示 更早的评论
sir,i have an image and want to find out its "SPARSE-MATRIX".i have tried the code like S=sparse(a);where 'a' is my image.but i got an error like "Undefined function or method 'sparse' for input arguments of type 'uint8'."MY AIM IS JUST TO FIND OUT THE SPARSE MATRIX OF THE IMAGE.Thanks in advance
0 个评论
回答(1 个)
Youssef Khmou
2013-5-18
hi,
i think you have to transform your matrix from Unsigned integer 8 to double, try :
G=sparse(im2double(a)); % or simply double(a)
4 个评论
Youssef Khmou
2013-5-20
the result you have is something else different, maybe you are applying binary transformation, try :
I=imread('test.jpg'); % where test.jpg is your sample
doubleI=im2double(I);
F=rgb2gray(doubleI);
G=sparse(F);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!