필터 지우기
필터 지우기

How can I take input image from user and Display

조회 수: 11 (최근 30일)
Prayag Bhatia
Prayag Bhatia 2019년 2월 13일
댓글: Prayag Bhatia 2019년 2월 14일
ext='*.jpg' ;
folder='C:\Users\prayag\Desktop\images-capstone';
image=uigetfile([folder '\' ext]) ;
I want to read any image from folder and display it using imshow, But when I use imshow I am not getting any image.
figure ;
imshow(image) ;

채택된 답변

Geoff Hayes
Geoff Hayes 2019년 2월 13일
Prayag - assuming that the user actually chooses a file via
image=uigetfile([folder '\' ext]) ;
then image (this is poorly named as it conflicts with a built-in MATLAB function of the same name) will just be the name of the file and not the image itself (and so is an invalid input for imshow). Instead consider the following
[filename, path] = uigetfile(fullfile(folder,ext)) ;
imageData = imread(fullfile(path, filename));
imshow(imageData);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by