Hi, how do I save the output to a specific folder?

3 ビュー (過去 30 日間)
Syafiqah Daud
Syafiqah Daud 2018 年 8 月 2 日
コメント済み: Syafiqah Daud 2018 年 8 月 2 日
Hi, I am trying to save the output of this code but I can't seem to use imsave or imwrite.
I = imread('C:\Users\Student\Desktop\Vehicle number plate recognition\vehicles\vehicle10.jpg');
BW = im2bw(I,0.4);
se = strel('rectangle', [2 20]);
BW_opened = imclose(BW,se);
figure, imshow(BW_opened,[])
s=regionprops(BW_opened,'Area','BoundingBox');
[hh,ii] = sort([s.Area],'descend');
out = imcrop(I,s(ii(2)).BoundingBox);
figure,imshow(out);
out = 'my new image.png'; % Whatever....
fullFileName = fullfile(out, 'C:\Users\Student\Desktop\Vehicle number plate recognition\test images');
imwrite(out, fullFileName);
I would get an error of :| | _Error using imwrite>parse_inputs (line 528) The first argument should not be a character vector.
Error in imwrite (line 418) [data, map, filename, format, paramPairs] = parse_inputs(varargin{:});||
Error in licenseplatecrop (line 13) imwrite(out, fullFileName);_

採用された回答

KSSV
KSSV 2018 年 8 月 2 日
I = imread('C:\Users\Student\Desktop\Vehicle number plate recognition\vehicles\vehicle10.jpg');
BW = im2bw(I,0.4);
se = strel('rectangle', [2 20]);
BW_opened = imclose(BW,se);
figure, imshow(BW_opened,[])
s=regionprops(BW_opened,'Area','BoundingBox');
[hh,ii] = sort([s.Area],'descend');
out = imcrop(I,s(ii(2)).BoundingBox);
figure,imshow(out);
out_path = 'C:\Users\Student\Desktop\Vehicle number plate recognition\vehicles'; % Give path here
fullFileName = fullfile(out_path, 'test_image.jpg');
imwrite(out, fullFileName);
  1 件のコメント
Syafiqah Daud
Syafiqah Daud 2018 年 8 月 2 日
Hi, can i ask how do i am able to change the file name into a new name each time i save a new output?

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by