vector form of cuboid.

I'm in need to concatenate the pixel values of 3 images(16 X 16 patches in an image sequence) which is stored in a folder,along with row order to form a vector component.How to access those images to form a vector?

 Akzeptierte Antwort

Matt J
Matt J am 30 Sep. 2012

1 Stimme

If I've understood your question, you would
(1) use IMREAD to read the images from the folders into MATLAB matrix variables A,B,C.
(2) Concatenate them as D=[A,B,C]
(3) Change D to a vector by doing D=D(:), or D=reshape(D,[],1) or similar.

5 Kommentare

Berbia
Berbia am 1 Okt. 2012
Bearbeitet: Walter Roberson am 1 Okt. 2012
Thank u..I got the vector, but in my work it is just one vector component. I have to repeat the same for images recorded at different times for whole vector. Instead of specifying names explicitly I use the code and decided to increment no for read next images.
no=0;
n={sprintf('Crop_seq %4.4d.png', no+1);sprintf('Crop_seq %4.4d.png', no+2);sprintf('Crop_seq %4.4d.png', no+3)};
A=imread(n{1});
I don't know how to represent the whole vector?Pls help...
Matt J
Matt J am 1 Okt. 2012
Bearbeitet: Matt J am 1 Okt. 2012
It's less and less clear to me what you mean by "vector component". What's wrong with the following?
no=0;
n={sprintf('Crop_seq %4.4d.png', no+1);sprintf('Crop_seq %4.4d.png', no+2);sprintf('Crop_seq %4.4d.png', no+3)};
A=imread(n{1});
B=imread(n{2});
C=imread(n{3});
wholevector = reshape([A,B,C],[],1);
Berbia
Berbia am 2 Okt. 2012
What I have expect is the following code...
for no=1:5 n=sprintf('Crop_seq%4.4d.png',no+1);sprintf('Crop_seq%4.4d.png',no+2);
sprintf('Crop_seq %4.4d.png', no+3)};
A=imread(n{1});
B=imread(n{2});
C=imread(n{3});
wholevector(no) = {reshape([A,B,C],[],1)};
end
D=[wholevector{1};wholevector{2};wholevector{3};wholevector{4};
wholevector{5}];
I got it now. Thanks for ur guidance..
Matt J
Matt J am 2 Okt. 2012
OK, I'm glad. FYI, you can create D more briefly use comma-separated-list features of MATLAB:
D=vertcat(wholevector{:});
Berbia
Berbia am 2 Okt. 2012
Helpful information...! Thanks a lot..

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Create System Objects finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 30 Sep. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by