필터 지우기
필터 지우기

How to save all figure as jpeg format in folder?

조회 수: 18 (최근 30일)
Mei Synn Tan
Mei Synn Tan 2017년 3월 11일
편집: Mei Synn Tan 2017년 3월 13일
srcFiles = dir('C:\Users\fit\Documents\MATLAB\H\*.jpg'); % the folder in which ur images exists
for i = 1 : length(srcFiles)
filename = strcat('C:\Users\fit\Documents\MATLAB\H\',srcFiles(i).name);
I = imread(filename);
I = rgb2gray(I);
I = im2double(I);
origin = I;
regions = detectMSERFeatures(I);
figure; imshow(I); hold on; plot(regions, 'showPixelList', true, 'showEllipses', false);
end
saveas(figurename,' C:\Users\fit\Documents\MATLAB\H'.'jpg')

답변 (1개)

Image Analyst
Image Analyst 2017년 3월 11일
편집: Image Analyst 2017년 3월 11일
  댓글 수: 3
Image Analyst
Image Analyst 2017년 3월 12일
Check your filename - is it different each time? Maybe put this after imshow():
drawnow;
Maybe also try closing the figure after you save it
close(f);
Mei Synn Tan
Mei Synn Tan 2017년 3월 13일
편집: Mei Synn Tan 2017년 3월 13일
Thanks Image Analyst, I was solve my problem. Here it is. Dear Image Analyst, how to automatically crop out the MSER region area and paste in figure?
srcFiles = dir('C:\Users\fit\Downloads\Code\export figure\Arabian_Horses\*.jpg'); % the folder in which ur images exists
for i = 1 : length(srcFiles)
filename = strcat('C:\Users\fit\Downloads\Code\export figure\Arabian_Horses\',srcFiles(i).name);
I = imread(filename);
I = rgb2gray(I);
I = im2double(I);
origin = I;
regions = detectMSERFeatures(I);
f=figure(); imshow(I,'Border','tight'); hold on; plot(regions, 'showPixelList', true, 'showEllipses', false);
export_fig (sprintf('figure%d',i),'-jpg');
end

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by