Images obtained by GAN could not be shown
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I run the codes at https://www.mathworks.com/help/deeplearning/ug/train-generative-adversarial-network.html which generates 25 new images and shows the generated images after tiling and scaling by this;
I = imtile(extractdata( dlXGeneratedNew ));
I = rescale(I);
But, I want to show each generated image (separately) without tiling and scaling, and to put them into the array called Images(224,224,3,25). So, I have written this;
rows = 5; columns=5; ind=1;
% Get size of 1
row1 = rows/5;
col1 = columns/5;
for col = 1 : 5
leftCol = (col-1) * col1 + 1;
rightCol = leftCol + col1 - 1;
for row = 1 : 5
topRow = (row-1) * row1 + 1;
bottomRow = topRow + row1 - 1;
thisImage = I(topRow:bottomRow, leftCol:rightCol, :);
figure(ind); imshow(thisImage);
Images(:,:,:,ind) = thisImage;
ind = ind + 1;
end
end
Here, thisImage returns as 1x1x3 single array. So, its size and format is different from an input image, which is 224x224x3 uint8.
Could you please help me to solve this problem
0 Kommentare
Antworten (1)
Hiro Yoshino
am 15 Jun. 2022
I belive the lines
I = imtile(extractdata( dlXGeneratedNew ));
I = rescale(I);
are not behaving as you would expect.
The function imtile accepts multiple files and put them into a small image. So you should remove it as follows:
I = extractdata( dlXGeneratedNew );
img = I (:,:,:,idx)
igm = rescale(img);
where idx represent the index of the image of your interest.
1 Kommentar
Siehe auch
Kategorien
Mehr zu Convert Image Type finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!