Clarification of idx in Planar Object Measuring tutorial
Show older comments
Under the "Detect Coins" paragraph in the "Measuring Planar Objects using a calibrated camera" example, the lines:
[areas, boxes] = step(blobAnalysis, imCoin);
% Sort connected components in descending order by area
[~, idx] = sort(areas, 'Descend');
% Get the two largest components.
boxes = double(boxes(idx(1:2), :));
% Adjust for coordinate system shift caused by undistortImage
boxes(:, 1:2) = bsxfun(@plus, boxes(:, 1:2), newOrigin);
I am uncertain of what the brackets, after the second occurrence of idx, are trying to define. I am trying to apply this to my own image and it gives me an error which states: Index exceeds matrix dimensions. Could someone please clarify this for me?
2 Comments
Guillaume
on 3 Jul 2015
Could you provide a link to the tutorial you mention? You can right click on the page in the help browser and select Get Page Address.
Kasia Hearn
on 3 Jul 2015
Accepted Answer
More Answers (0)
Categories
Find more on Image Processing and Computer Vision in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!