image to an array

 Respuesta aceptada

NN
NN el 8 de Nov. de 2012

2 votos

Might help
Imagearray=double(imread('image's name (path).Image type e.g. tiff'));

2 comentarios

Elysi Cochin
Elysi Cochin el 8 de Nov. de 2012
Thanks all
Image Analyst
Image Analyst el 8 de Nov. de 2012
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.

Iniciar sesión para comentar.

Más respuestas (3)

Harshit
Harshit el 8 de Nov. de 2012

0 votos

Why do you wanna write an image into an array. Use reshape if you really want.
Walter Roberson
Walter Roberson el 8 de Nov. de 2012

0 votos

get() the CData property of the image; that will be an array.
Mohammed Manna
Mohammed Manna el 8 de Nov. de 2012
Editada: Mohammed Manna el 8 de Nov. de 2012

0 votos

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.

Categorías

Más información sobre Images en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 8 de Nov. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by