Re-extract final images after vectorizing a set of images

1 view (last 30 days)
I have 20 images each of which is 175 x 200. then i create a matrix X and unfold each image into it. so that X becomes a (175*200, 20 ). I applied Non-negative matrix factorization on this X data. and reconstructed it into a X_hat matrix. Now I would like to extract the individual images back.
m=200;
n=175;
N=20;
X= [];
avg= zeros(m*n,1);
count=0;
for j=1:N
figure(1)
ff=['faces/stallone',num2str(j,'%02d'), '.jpg']; % Load images
u = imread(ff);% read into X
imshow(u)
set(gcf, 'Position',[100 100 500 500])
if (size(u,3)==1)
M= double(u);
else
M= double(rgb2gray(u));
end
pause(0.1);
R= reshape(M,m*n,1); % before (n,m) now (m*n,1)
X= [X,R]; % stack them into X
avg =avg +R;
count=count+1;
end
[ X_hat] = NMF(Q, X_hat,Winit,Hinit); % I applied NMF and obtained X_hat
How do I get the individual 20 images from this X_hat

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!