有什么办法可以把vector<Point2f>转换成vector<Keypoint>吗?

Is there any way to convert vector<Point2f> to vector<Keypoint>?

我可以看到我们可以通过以下方法从 Points 转换 Keypoints:

vector<Point2f> points1; 
KeyPoint::convert(keypoints1, points1);

如果有人可以建议我将 vector<Point2f> 转换为 vector<Keypoint>,我会很棒吗?

根据this link,只是:

create for each point a new Keypoint with size 1:

std::vector<cv::Keypoint> keypoints;
for( size_t i = 0; i < inputs.size(); i++ ) {
   keypoints.push_back(cv::Keypoint(inputs[i], 1.f));
}