From: ImageAnalyst on
What do you mean by "field"? You seem to want to reshape the whole 2D
image into a 1D linear vector and then stuff that into one row of a 2D
image. That will work if all images are the same size but won't if
they're different sizes, in which case you'll have to use a cell
array.

Or maybe by "field" you mean a member of a structure? Or maybe you
mean one cell in a cell array? I not really sure what you mean. But,
with lingo I use, a row in a 2D matrix is not called a "field" -- it's
called a "row."
From: us on
"Juraj "
> % here it should work with fields
> % test_faces(i,k) = face(k); ??? can it be done somehow???

do you not read the replies(!?)...
you were told already to use pre-allocated CELLs to store the current FACE, which you presumably retrieve from a randomly selected file from your list, eg,

face=imread('currentfile');
% then, maybe(?), something like this
face=face(:).';
% who knows, given your incomplete code and description
% - where do you get your FACE...
% - what do you mean by FIELD...

us
From: Juraj on
this is full code:

[faceImages] = textread('faces\zoznam.txt', '%s');

face=[];
faces=[];
test_faces=[];

for i=1:length(faceImages)
str = strcat('faces\',faceImages{i});
[face]=imread(str);
[faceWidth,faceHeight]=size(face);
face=reshape(face,faceWidth*faceHeight,1);

for j=1:length(face) % variable face is a list of images
faces(i,j) = face(j); % faces is variable containg image data, size is 432×240
end
end

ImageFiles = dir('C:\Users\yuriv\Desktop\bio\faces');
totalNumberOfFiles = length(ImageFiles)-1;
scrambledList = randperm(totalNumberOfFiles);
numberIWantToUse = 5;
loop_counter = 1;
for index = scrambledList(1:numberIWantToUse)
baseFileName = ImageFiles(index).name;
fprintf(1, 'File #%d = File #%d of original list = %s\n', loop_counter, index, baseFileName);
loop_counter = loop_counter + 1;
% here i need variable test_faces with parameters numberIWantToUse×240
% it has to have the same format
end

[Psi, Vecs, Features] = pc_train(faces, 9);
%[id] = pc_test(Psi, Vecs, Features, 9, testFace, idMap);
%[id_map_elem] = pc_test(Psi, Vecs, Features, 9, test_faces, id_map);

i hope you will understand me:) i need a variable similar to faces
From: ImageAnalyst on
On Feb 27, 12:05 pm, "Juraj " <yuray.va...(a)gmail.com> wrote:
> this is full code:
> [code snipped]
>
> i hope you will understand me:) i need a variable similar to faces
-------------------------------------------------------------
Yes I already saw that, but apparently you didn't see my reply. And
no, I not sure I understand you. You didn't describe what a field is,
nor do I understand what test_faces is. But now it appears that all
your images are the same size: 432x240, so you don't need to use a
cell array. Maybe test_faces is simply certain rows extracted from
faces()? If so, then do
test_faces(loop_counter, :) = faces(index, :);
That will stuff a random row from faces into the next row of
test_faces.
From: Juraj on
yeeeah,
test_faces(loop_counter, :) = faces(index, :);
i needed this one line:) thanks a lot!