How to load specific image extension from specific path directory MATLAB ?
1 次查看(过去 30 天)
显示 更早的评论
Hi. How can I load all image that has png,jpeg and jpg extension in a specific path directory by using push button ?
Someone please help me.
0 个评论
回答(1 个)
chandrapal Singh
2019-9-6
Create a Pushbutton and use the following code
path=uigetdir();
path
img_directory= dir(path);
total_images= length(img_directory)-2;
total_images
for i=3:length(img_directory)
im= imread(strcat(path,'\',img_directory(i).name));
im=imresize(im, [512 512]);
out{:,:,i-2}=im;
end
3 个评论
Walter Roberson
2019-9-6
See also https://www.mathworks.com/matlabcentral/answers/478309-facing-difficulty-in-converting-a-matlab-function-to-c-code#comment_742361 for why using dir results that way is wrong
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!