Error "Subscript indices must either be real positive integers or logicals" on a matlab based example
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Chetana Nimmakayala
el 28 de Feb. de 2016
Respondida: Dima Lisin
el 29 de Feb. de 2016
In the MATLAB examples page for Computer Vision System Toolbox, there is a code for Object Detection in a Cluttered Scene Using Point Feature Matching. I am running the same code on my system, however it is giving the error "Subscript indices must either be real positive integers or logicals" where the code tries to match the similarity between the two images.
This is the code:
I1 = rgb2gray(imread('kitchen.jpg'));
I2 = rgb2gray(imread('loops.jpg'));
points1 = detectSURFFeatures(I1);
points2 = detectSURFFeatures(I2);
[features1, valid_points1] = extractFeatures(I1, points1);
[features2, valid_points2] = extractFeatures(I2, points2);
indexPairs = matchFeatures(features1, features2);
matchedPoints1 = valid_points1(indexPairs(:, 1), :); //ERROR
matchedPoints2 = valid_points2(indexPairs(:, 2), :);
figure; showMatchedFeatures(I1, I2, matchedPoints1, matchedPoints2);
I am new to MATLAB and just trying to understand concepts however I got stuck in this. Any help is appreciated. Thank you.
1 comentario
Respuesta aceptada
Dima Lisin
el 29 de Feb. de 2016
This error means that matchFeatures didn't find any matches and indexPairs is empty. If it is expected that sometimes you do not find any matches, then you should check indexPairs for being empty. Otherwise you should tweak the parameters of matchFeatures, detectSURFFeatures, or extractFeatures to get more matches.
You should first check how many features you detect in the first place. If that number is too low and you have a high-resolution image, then I would increase the NumOctaves parameter of detectSURFFeatures. You can also try decreasing MetricThreshold.
If you detect enough features but still don't get any matches, then you can try increasing the MaxRatio parameter of matchFeatures.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Computer Vision with Simulink en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!