browse the computer to find image

조회 수: 3 (최근 30일)
Guilherme Franklin
Guilherme Franklin 2021년 12월 29일
댓글: Adam Danz 2021년 12월 29일
Hi, I'm working with image processing and I can't find a code where, whenever I run the script, I can browse and choose the image on the computer, instead of changing my code.
I = imread('foto1.jpg');
res = quantSoja(I);
quantSoja() is a function I created for processing.
I want to replace "imread" with another command so that I can browse the computer.
  댓글 수: 3
Guilherme Franklin
Guilherme Franklin 2021년 12월 29일
Thank you very much, it worked perfectly.
Adam Danz
Adam Danz 2021년 12월 29일
You may also find this file exchange submission handy to view all images in a folder.

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

채택된 답변

Image Analyst
Image Analyst 2021년 12월 29일
Try this:
% Have user browse for a file, from a specified "starting folder."
% For convenience in browsing, set a starting folder from which to browse.
startingFolder = pwd; % or 'C:\wherever';
if ~isfolder(startingFolder)
% If that folder doesn't exist, just start in the current folder.
startingFolder = pwd;
end
% Get the name of the file that the user wants to use.
defaultFileName = fullfile(startingFolder, '*.*'); % or *.jpg if you want to limit files shown to JPG files.
[baseFileName, folder] = uigetfile(defaultFileName, 'Select a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
rgbImage = imread(fullFileName);
imshow(rgbImage);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by