image to an array

3 次查看(过去 30 天)
Elysi Cochin
Elysi Cochin 2012-11-8
how to write a image to an array

采纳的回答

NN
NN 2012-11-8
Might help
Imagearray=double(imread('image's name (path).Image type e.g. tiff'));
  2 个评论
Elysi Cochin
Elysi Cochin 2012-11-8
Thanks all
Image Analyst
Image Analyst 2012-11-8
Or maybe when you say write you mean imwrite to write the image array out to disk:
imwrite(yourImage, filename);
Using precise unambiguous terminology is important if you want a precise answer.

请先登录,再进行评论。

更多回答(3 个)

Harshit
Harshit 2012-11-8
Why do you wanna write an image into an array. Use reshape if you really want.

Walter Roberson
Walter Roberson 2012-11-8
get() the CData property of the image; that will be an array.

Mohammed Manna
Mohammed Manna 2012-11-8
编辑:Mohammed Manna 2012-11-8
Simply do this
targetImg = imread("path");
targetImg = targetImg(:); % You can take a transpose too if you like
If you need to convert it to one of the primitive types, you can do so by
targetImg = double(targetImg);
targetImg = float(targetImg);
% etc.
If you have performance/speed/parallel processing related issues. I suggest you also look into get() CDATA property of the image. I am not sure why you need the array of an image. I must say that I cannot remember if about the float(). But the point is proven. Hope this helps you.

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by