Index exceeds matrix dimension

2 visualizzazioni (ultimi 30 giorni)
Matteo Foglio
Matteo Foglio il 12 Giu 2017
Modificato: Adam il 12 Giu 2017
I have this error and I do not understand why. Here's the code:
>> I1_inliers
I1_inliers =
608×1 SURFPoints array with properties:
Scale: [1×608 single]
SignOfLaplacian: [1×608 int8]
Orientation: [1×608 single]
Location: [608×2 single]
Metric: [1×608 single]
Count: 608
>> I1_inliers(1)
ans =
SURFPoints with properties:
Scale: 2.8000
SignOfLaplacian: 1
Orientation: 0.3424
Location: [753.3676 999.5223]
Metric: 1.8129e+04
Count: 1
>> I1_inliers(2)
Index exceeds matrix dimensions.
I have the same error for every index but 1.
  5 Commenti
Matteo Foglio
Matteo Foglio il 12 Giu 2017
About length
>> length(I1_inliers)
Function 'subsindex' is not defined for values of class 'SURFPoints'.
SURFPoints is a class of the computer vision toolbox. They represent a set of features inside images.
Adam
Adam il 12 Giu 2017
Modificato: Adam il 12 Giu 2017
I suspect that it is actually a scalar with an overloaded size function, looking at it again. I have done that myself once or twice on a class (and usually regretted it afterwards because it confuses me too much).
The size function can be overloaded so that in a case like yours where the object contains a lot of arrays all of the same size the 'size' function is programmed to return that size which over-rides the usual size function which would return [1 1] as the size.
So even though it claims to be a 608x1 array it actually isn't and is just a scalar object containing arrays of length 608.
You would need to access the individual properties with indexing in that case.
I don't have the Computer Vision Toolbox though so I am just surmising based on the symptoms you describe and what is shown when you display the object

Accedi per commentare.

Risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by