画像の一括保存

21 visualizaciones (últimos 30 días)
Kodai Sato
Kodai Sato el 13 de En. de 2020
Respondida: Kenta el 13 de En. de 2020
セマンティックセグメンテーションを行うにあたってデータセットを作成するため上のURLを参考にrandomCropWindow2dを使用して画像のランダム抽出を行ったところ,画像を表示させることは出来たのですが,保存されたファイルは真っ白でうまく保存することが出来ません.複数枚の画像を一括で保存する方法を教えてください.
A = imread('1.jpg');
%imshow(A)
targetSize = [96 96];
for i=1:10
wini = randomCropWindow2d(size(A),targetSize);
Bi = imcrop(A,wini);
imshow(Bi)
filename=['image1_',num2str(i),'.png'];
saveas(gcf,filename)
end

Respuesta aceptada

Kenta
Kenta el 13 de En. de 2020
こんにちは、単に切り出すというだけであれば下のようにすれば可能です。
pauseは見やすくするために書いているので不要です。
またランダムに回転させたり色を変化させたりしながら切り出したかったらこちらをご参照ください。
result.PNG
A = imread('onion.png');
%imshow(A)
targetSize = [96 96];
figure;
for i=1:10
wini = randomCropWindow2d(size(A),targetSize);
Bi = imcrop(A,wini);
imshow(Bi)
pause(.3)
filename=['image1_',num2str(i),'.png'];
imwrite(Bi,filename)
end

Más respuestas (0)

Categorías

Más información sobre Convert Image Type en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!