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

5 Ansichten (letzte 30 Tage)
Syafiqah Daud
Syafiqah Daud am 2 Aug. 2018
Kommentiert: Syafiqah Daud am 2 Aug. 2018
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);_

Akzeptierte Antwort

KSSV
KSSV am 2 Aug. 2018
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 Kommentar
Syafiqah Daud
Syafiqah Daud am 2 Aug. 2018
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?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by