简体   繁体   English

如何在关键点中编写坐标?

[英]How to write coordinates in keypoint?

我有图像的一个像素的坐标(例如int i,j; ),如何将它们写成如下图所示的向量?

std::vector<KeyPoint> keypoint_object;

You can do a class: 您可以上一堂课:

class Coordinate{
public:
   int x;
   int y;
}

... ...

vector <Coordinate> name;

Coordinate coordinate;
coordinate.x = 1~
coordinate.y = 5~

name.push_back(coordinate);

This is what are you looking for? 你在找什么 I hope this will help you! 我希望这能帮到您!

From the documentation , I see there is a constructor for KeyPoint that allows insertion of your indices. 文档中 ,我看到有一个KeyPoint的构造函数,允许您插入索引。 However it requires an additional parameter size, and I don't know what you need that to be. 但是,它需要额外的参数大小,我不知道您需要什么。

However, the general idea would be this: 但是,一般的想法是这样的:

keypoint_object.push_back(KeyPoint(i,j,0));

Here, i and j are implicitly cast to float (I assume that is what you require) and the third argument is 0 (as it's mandatory) -- you probably want a more sensible argument here. 在这里, ij被隐式转换为float (我假设这是您所需要的),而第三个参数是0 (因为它是强制性的)–您可能希望在这里使用一个更明智的参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM