Ask Your Question

Revision history [back]

I think your keypoint are small and in gray image withe pixels cannot be seen easily.

{
    Mat img_1, img_2;
    img_1 = imread("g:/lib/opencv/samples/data/lena.jpg", CV_LOAD_IMAGE_GRAYSCALE);

    vector<Point2f> corners_1={Point(10,10),Point(30,100) ,Point(100,100) ,Point(30,200) ,Point(300,100) };

    vector<KeyPoint> keypoints_1;
    KeyPoint::convert(corners_1, keypoints_1, 10, 1, 0, -1);

    // Draw the keypoints

    Mat keypoint_img;
    Mat img;
    cvtColor(img_1,img,CV_GRAY2BGR);
    drawKeypoints(img, keypoints_1, keypoint_img, Scalar(127,200,10), 4);
    imshow("Keypoints", keypoint_img);
    imwrite("Keypoints.bmp", keypoint_img);
    waitKey(0);
}

I think your keypoint are small and in gray image withe pixels cannot be seen easily.

{
    Mat img_1, img_2;
    img_1 = imread("g:/lib/opencv/samples/data/lena.jpg", CV_LOAD_IMAGE_GRAYSCALE);

    vector<Point2f> corners_1={Point(10,10),Point(30,100) ,Point(100,100) ,Point(30,200) ,Point(300,100) };

    vector<KeyPoint> keypoints_1;
    KeyPoint::convert(corners_1, keypoints_1, 10, 1, 0, -1);

    // Draw the keypoints

    Mat keypoint_img;
    Mat img;
    cvtColor(img_1,img,CV_GRAY2BGR);
    drawKeypoints(img, keypoints_1, keypoint_img, Scalar(127,200,10), 4);
    imshow("Keypoints", keypoint_img);
    imwrite("Keypoints.bmp", keypoint_img);
    waitKey(0);
}

image description