saving an image in a specific folder

조회 수: 3 (최근 30일)
hasan alhussaini
hasan alhussaini 2018년 5월 17일
댓글: Image Analyst 2019년 4월 23일
Hello,
i'm trying to save an image to a specific folder, however when i save the image i would like to give it any name i want.
similar to saving a word document, and a dialogue box pops up and asks you where would you like the destination folder and the name of the file

채택된 답변

Stephen23
Stephen23 2018년 5월 17일
편집: Stephen23 2018년 5월 17일
Use uiputfile to get the file name and path, e.g. where I is your image array:
[F,P] = uiputfile();
imwrite(I,fullfile(P,F))
  댓글 수: 8
Image Analyst
Image Analyst 2018년 5월 17일
Try this fix
if ~contains(F, '.tif', 'IgnoreCase', true)
% User did not enter the .tif extension. add it for them.
F = [F, '.tif']; % Append .tif
end
fullFileName = fullfile(P, F);
imwrite(I, fullFileName);
hasan alhussaini
hasan alhussaini 2018년 5월 17일
it works perfectly! thank you ^^

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Image Analyst
Image Analyst 2018년 5월 17일
You can use imsave():
img = imread('peppers.png');
imshow(img); % Display image
[filename, user_canceled] = imsave();
Or else the longer way with uiputfile():
% 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(yourImage, fullFileName);

akshatha nayak
akshatha nayak 2019년 4월 23일
How to take real world image of person eye and store it in mysql database and use that image for comparing with other image ?
  댓글 수: 1
Image Analyst
Image Analyst 2019년 4월 23일
Start a new question with this, and BE SURE to add the database tag, and DatabaseToolbox product when you post it.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by