How can I take input image from user and Display
7 次查看(过去 30 天)
显示 更早的评论
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) ;
0 个评论
采纳的回答
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 Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!