从matlab中的文件夹加载所有图像
我有一个文件夹,其中包含多个图像,我想加载所有这些图像,并分别进行处理…我如何使用matlab做到这一点? 我尝试使用下面的代码,它表示无法读取xyz.jpg。找不到此类文件或目录…xyz是该文件夹中的第一个文件从matlab中的文件夹加载所有图像,matlab,Matlab,我有一个文件夹,其中包含多个图像,我想加载所有这些图像,并分别进行处理…我如何使用matlab做到这一点? 我尝试使用下面的代码,它表示无法读取xyz.jpg。找不到此类文件或目录…xyz是该文件夹中的第一个文件 imagefiles = dir('F:\SIFT_Yantao\demo-data\*.jpg'); nfiles = length(imagefiles); % Number of files found for i=1:nfiles currentfilen
imagefiles = dir('F:\SIFT_Yantao\demo-data\*.jpg');
nfiles = length(imagefiles); % Number of files found
for i=1:nfiles
currentfilename=imagefiles(i).name;
I2 = imread(currentfilename);
[pathstr, name, ext] = fileparts(currentfilename);
textfilename = [name '.mat'];
fulltxtfilename = [pathstr textfilename];
load(fulltxtfilename);
descr2 = des2;
frames2 = loc2;
do_match(I1, descr1, frames1, I2, descr2, frames2) ;
end
您可以轻松加载具有相同类型的多个图像,如下所示: imgPath='此处插入包含图像的文件夹';dCell=dir[imgPath.png']; %注意:根据需要更改每个序列的文件类型.png、*.bmp或*.jpg 对于d=1:lengthdCell Seq{d}=imread[imgPath dCelld.name];
结束代码和问题怎么可能完全相同?这算什么作业吗?好吧,这很有效……但我现在想提取它的文件名,我该怎么做?如果所有图像的类型都相同,你不需要知道它们的文件名。加载所有图像后,可以在matlab中访问它们。