how to convert a cell array into an image?
古いコメントを表示
I fetched an image from sql database but its returning format is like i=[75839 int8] how can i convert it into image plz help me out
採用された回答
その他の回答 (1 件)
Image Analyst
2014 年 10 月 4 日
編集済み: Image Analyst
2014 年 10 月 4 日
You need to take the (badly-named) i and reshape it into a 2 or 3D array, but you need to know the number of rows and columns.
cellContents = cell2mat(i); % Convert from cell to double.
grayImage = reshape(cellContents, [rows, columns]);
imshow(grayImage, []);
8 件のコメント
kanwal
2014 年 10 月 5 日
kanwal
2014 年 10 月 5 日
AS IA said, you will have to reshape that d into a 2D image, so you need to know the height and width of the image.
Now since, 75389 is a prime number, there's no way that it can be reshaped into a rectangle, so most likely, there is a header to the image. Do you know what that header is (or what the format of the image is)? If not, can you post the first few value of d (for example d(1:40))?
kanwal
2014 年 10 月 5 日
Guillaume
2014 年 10 月 5 日
Can you show the first few bytes d?
d(1:40)
kanwal
2014 年 10 月 5 日
Guillaume
2014 年 10 月 5 日
Your image is a png image, not a jpeg. The code I posted in my answer, with the typecast fix, should decode it.
kanwal
2014 年 10 月 6 日
カテゴリ
ヘルプ センター および File Exchange で Convert Image Type についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!