Ask Your Question

theo-b's profile - activity

2015-05-15 06:56:25 -0600 commented question Segfault when accessing keypoint[i].pt (keypoint coordinates)

OK sorry, that fixed it. Should I delete my question?

2015-05-15 01:07:00 -0600 received badge  Editor (source)
2015-05-14 13:07:21 -0600 asked a question Segfault when accessing keypoint[i].pt (keypoint coordinates)

I'm trying to access the coordinates of keypoints picked up from an image by SimpleBlobDetect. As per here my code is as follows:

vector<KeyPoint> keypoints;
float kpt_x, kpt_y;

for(int i=0; i<=keypoints.size(); i++)
{
     kpt_x = keypoints[i].pt.x;
     kpt_y = keypoints[i].pt.y;
}

But this throws a segfault on each line within the for loop.

Why? Is this the correct way of accessing keypoint coordinates?

EDIT: When I run debugger, it shows that the error is on the line kpt_x = keypoints[i].pt.x;

2015-05-14 13:07:20 -0600 commented answer How to get the coordinate from "class KeyPoint"?

This gives me a segfault. why?