how to read an image with name given by the user?

18 visualizaciones (últimos 30 días)
Aldo Olivares
Aldo Olivares el 4 de Dic. de 2017
Respondida: Image Analyst el 4 de Dic. de 2017
I was looking for how to use the imread function to read an image which is a webcam shot so I use imwrite with a dialog box which the user gives the name of the image but for further processing I do not know how to read that image that changes according to the user modify his name.
  1 comentario
KSSV
KSSV el 4 de Dic. de 2017
imread is used to read the image....._imwrite_ is used to write data into image.....what is your question?

Iniciar sesión para comentar.

Respuestas (2)

Walter Roberson
Walter Roberson el 4 de Dic. de 2017
[filename, pathname] = uiputfile('*.*', 'Save as');
if ~ischar(filename); return; end %user cancelled
fullname = fullfile(pathname, filename);
imwrite(TheSnapshotArray, fullname);

Image Analyst
Image Analyst el 4 de Dic. de 2017
Get your snapshot however, like...
snapshot = getsnapshot();
Then use imsave().
Or you can use imputfile() if you don't have the Image Processing Toolbox
% Get the name of the file that the user wants to save.
% Note, if you're saving an image you can use imsave() instead of uiputfile().
startingFolder = userpath % Or "pwd" or wherever you want.
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uiputfile(defaultFileName, 'Specify a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
imwrite(snapshot, fullFileName);

Categorías

Más información sobre Convert Image Type en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by