"Index in position 2 exceeds array bounds." - imfindcircles

조회 수: 1 (최근 30일)
Hanne
Hanne 2024년 4월 16일
답변: Taylor 2024년 4월 16일
Running the code:
I = imread('L1.tif');
[centersBright,radiiBright,metricBright] = imfindcircles(I,[10 30], ...
'ObjectPolarity','bright','Sensitivity',0.92,'EdgeThreshold',0.1);
xi = centersBright(:,1);
yi = centersBright(:,2);
P = impixel(I,xi,yi);
Intensity = P(:,1);
clearvars -except Intensity centersBright
It gives me the error message : "Index in position 2 exceeds array bounds.", and I do not know how to resolve it. I am expecting the funciton to identify ~7 circles.

답변 (1개)

Taylor
Taylor 2024년 4월 16일
If you run this in a script, MATLAB will tell you exactly what line is yielding the error. You are trying to indexing to a position that is greater than the size of a particular dimension of a variable. For example, centersBright should be an mx2 array where m is the number of circles found. Let's say 7 circles were found, so centersBright is 7x2. If you were to index to centersBright(10,1) you would get a similar error because you are trying to reference to a tenth circle that does not exist.

카테고리

Help CenterFile Exchange에서 Call MATLAB from C에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by