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

조회 수: 4 (최근 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