I am converting some corners (Point2f) to KeyPoints and afterwards I want to draw them with the OpenCV function drawKeypoints. But no KeyPoint is drawn after all. I get no error but just my input image.
Here is my code:
Mat img_1, img_2;
img_1 = imread(argv[1], CV_LOAD_IMAGE_GRAYSCALE);
// Retrieving some corners (Point2f)
// ....
// Convert to keypoints
vector<KeyPoint> keypoints_1;
KeyPoint::convert(corners_1, keypoints_1, 1, 1, 0, -1);
// Draw the keypoints
Mat keypoint_img;
drawKeypoints(img_1, keypoints_1, keypoint_img, Scalar::all(-1), 4);
imshow("Keypoints", keypoint_img);
imwrite("Keypoints.bmp", keypoint_img);
waitKey(0)
I tried changing the Flag of drawKeypoints and I printed the following
float x = keypoints_1[0].pt.x;
float y = keypoints_1[0].pt.y;
cout << keypoints_1.size() << " " << x << " " << y << endl;
which gives me:
960 932.142 1448.33