How to creat a sparse matrix?
古いコメントを表示
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
回答 (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 件のコメント
jagannath mishra
2013 年 5 月 19 日
Youssef Khmou
2013 年 5 月 19 日
編集済み: Youssef Khmou
2013 年 5 月 19 日
hi jagannath,
I think it works, here is an example using the picture 'circuit.tf' whose class is uint8 :
I=imread('circuit.tif');
G=sparse(im2double(I));
jagannath mishra
2013 年 5 月 20 日
編集済み: jagannath mishra
2013 年 5 月 20 日
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);
カテゴリ
ヘルプ センター および File Exchange で Resizing and Reshaping Matrices についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!