How do I write images to a specific folder ?
조회 수: 15 (최근 30일)
이전 댓글 표시
Hello! I read 8 pictures (different names) using imread function, obtain edge maps named ED1 to ED8, each edge map corresponding to one image. I wish to write all the edge results to a specific folder C:\Edgeresults. Also, the name of the images should be same as readed image. I tried to imwrite them but saved individually on my directory. How can I achieve this ?
ED1=edge(Imgry1,'canny');
ED2=edge(Imgry2,'canny');
ED3=edge(Imgry3,'canny')
ED4=edge(Imgry4,'canny');
ED5=edge(Imgry5,'canny');
ED6=edge(Imgry6,'canny');
ED7=edge(Imgry7,'canny');
ED8=edge(Imgry8,'canny');
Thanks
댓글 수: 2
Adam
2018년 11월 14일
doc fullfile
will let you compose a full file path to prepend to a filename, which you should get in the habit of doing to save things somewhere explicit rather than wherever happens to be the current folder.
채택된 답변
ES
2018년 11월 14일
You can give the full file path to imwrite.
FILENAME = ['C:\Edgeresults\', filename1];
imwrite(A,FILENAME,FMT)
댓글 수: 4
Walter Roberson
2020년 3월 28일
Replace
FILENAME = [myFolder, outFileName]
with
FILENAME = fullfile(myFolder, outFileName);
Raoul Fiorentini
2020년 12월 15일
편집: Raoul Fiorentini
2020년 12월 15일
Im a bit in late ahah, but maybe this can help:
FILENAME = string(strcat(myFolderpath, filename, '.bmp')); % replace '.bmp' with the format you want
imwrite(image, FILENAME)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!