gpt4 book ai didi

matlab - 如何在 MATLAB 中的 for 循环中读取多个图像?

转载 作者:行者123 更新时间:2023-12-01 22:24:48 24 4
gpt4 key购买 nike

我已将结果分段存放在文件夹中。这些需要在 for 循环中读取并在循环中进一步处理。我尝试阅读如下:

for i=1:10 
file_name=dir(strcat('C:\Users\adminp\Desktop\dinosaurs\'));
im=imread(strcat('C:\Users\adminp\Desktop\dinosaurs\',file_name(i).name));
%processing of read image
end

抛出错误:???在 370 处使用 ==> imread 时出错无法打开文件“C:\Users\adminp\Desktop\dinosaurs\”。用于阅读;您可能没有读取权限。

请指出我哪里出错了。

最佳答案

我猜你的问题是:

file_name(1).name = .     % Stands for current directory
file_name(2).name = .. % Stands for parent directory
file_name(3).name = your_file_name.jpg

现在,做:

images = dir('*JPG')
for i=1:numel(images)
file_name=dir(strcat('C:\Users\adminp\Desktop\dinosaurs\'));
im=imread(strcat('C:\Users\adminp\Desktop\dinosaurs\',images(i).name));
%processing of read image
end

关于matlab - 如何在 MATLAB 中的 for 循环中读取多个图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27978817/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com