How do I write images to a specific folder ?

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
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.
Chidiebere Ike
Chidiebere Ike 2018 年 11 月 14 日
Thanks but not clear enough...

サインインしてコメントする。

 採用された回答

ES
ES 2018 年 11 月 14 日

1 投票

You can give the full file path to imwrite.
FILENAME = ['C:\Edgeresults\', filename1];
imwrite(A,FILENAME,FMT)

4 件のコメント

Chidiebere Ike
Chidiebere Ike 2018 年 11 月 14 日
Thanks.. Solved
Malayappan Shridhar
Malayappan Shridhar 2020 年 3 月 28 日
It is not working for me.
I have the following
FILENAME = [myFolder, outFileName]
imbin = imbinarize(uint8(f));
imshow(imbin);
imwrite(imbin,FILENAME);
FILENAME = ["C:\ISI-Kappa\FromWorkBin\Front_1" "b_180311788230057_Front.jpg"]
outFileName = b_180311788230057_Front.jpg
I get an error saying "A filename must be supplied."
Walter Roberson
Walter Roberson 2020 年 3 月 28 日
Replace
FILENAME = [myFolder, outFileName]
with
FILENAME = fullfile(myFolder, outFileName);
Raoul Fiorentini
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 件)

カテゴリ

ヘルプ センター および File ExchangeConvert Image Type についてさらに検索

質問済み:

2018 年 11 月 14 日

編集済み:

2020 年 12 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by