how to read an image with name given by the user?
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
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?
Respuestas (2)
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);
Now use the techniques described at http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
0 comentarios
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);
0 comentarios
Ver también
Categorías
Más información sobre Convert Image Type en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!