how to store values in second column of cell array
Show older comments
In the following program, I get the value 200 X 1 after reshaping function, I want to store ground truth a label like 1 1 1 1 1 for the first five images then second 2 2 2 2 2 up to 40 images e.g.
1600x1 uint8 1
1600x1 uint8 1
1600x1 uint8 1
1600x1 uint8 1
1600x1 uint8 1
1600x1 uint8 2
1600x1 uint8 2
1600x1 uint8 2
1600x1 uint8 2
1600x1 uint8 2
.
.
1600x1 uint8 40
1600x1 uint8 40
1600x1 uint8 40
1600x1 uint8 40
1600x1 uint8 40
clc;
clear all;
faceData = cell(40,5); % or cell(5,40)
for i=1:40
cd(strcat('s',num2str(i)));
for j=1:5
v=imread(strcat(num2str(j),'.bmp'));
v1 = imresize(v,[40,40]);
[x1,y1] = size(v1);
v1=v1(:); % it make long vertical vector
w = uint8(v1);
faceData{i,j} = w;
end
cd ..
end
faceData = reshape(faceData,[],1);
6 Comments
madhan ravi
on 21 Oct 2018
size(yourcell) ?
Balaji M. Sontakke
on 21 Oct 2018
Edited: Guillaume
on 21 Oct 2018
Kevin Chng
on 21 Oct 2018
faceData = reshape(faceData,[],2);
2 columns ! Does it answer you?
Balaji M. Sontakke
on 21 Oct 2018
Edited: Guillaume
on 21 Oct 2018
Kevin Chng
on 21 Oct 2018
200/5 = 40, therefore,
faceData = reshape(faceData,[],40);
Balaji M. Sontakke
on 21 Oct 2018
Edited: Guillaume
on 21 Oct 2018
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!