How can I take input image from user and Display

7 ビュー (過去 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);
  1 件のコメント
Prayag Bhatia
Prayag Bhatia 2019 年 2 月 14 日
Thank you so much !!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by