Images obtained by GAN could not be shown
조회 수: 3 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Hiro Yoshino
2022년 6월 15일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Modify Image Colors에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!