我对图像处理很陌生,想生成一个存储 10 个图像的数组。之后,我想通过一些代码运行一个 for 循环,该代码识别图像的一些属性,特别是生物样本的表面积,然后吐出一个包含 10 个区域的数组。
以下是我迄今为止设法报废的内容,这是随之而来的错误消息:
??? Index exceeds matrix dimensions.
Error in ==> Testing1 at 14
nova(i).img = imread([myDir B(i).name]);
以下是我迄今为止一直在处理的代码:
my_Dir = 'AC04/';
ext_img='*.jpg';
B = dir([my_Dir ext_img]);
nfile = max(size(B));
nova = zeros(1,nfile);
for i = 1:nfile
nova(i).img = imread([myDir B(i).name]);
end
areaarray = zeros(1,nfile);
for k = 1:nfile
[nova(k), threshold] = edge(nova(k), 'sobel');
.
.
.
.%code in this area is irrelevant to the problem I think%
.
.
.
areaarray(k) = bwarea(BWfinal);
end
areaarray