Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
Hanne
Hanne el 16 de Abr. de 2024
Respondida: Taylor el 16 de Abr. de 2024
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.

Respuestas (1)

Taylor
Taylor el 16 de Abr. de 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.

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by