"Index in position 2 exceeds array bounds." - imfindcircles
1 view (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Taylor
on 16 Apr 2024
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.
0 Comments
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!