如何在一个有意义的单位中关联(X,Y)坐标对



我有一个2D数组,其中每一行是一个特征向量。每个特征向量为[x1 y1 x2 y2 x3 y3 x4 y4],其中(x1,y1)为第一个特征点的坐标,(x2, y2)为第二个特征点的坐标,以此类推…

我需要将特征点作为神经网络的输入。现在,我如何将x1和y1组合成一个有意义的单位然后再将其输入神经网络?我被困在这里了……有谁能给点建议吗?我在什么地方读到过我们必须使用一些二维变换…像圣言…但我不知道怎么做??

我正在使用c++和OpenCV 2.3

任何帮助将非常感激…谢谢!!

根据我的理解,基本需要一个数据结构来关联(x1,y1)和(x2,y2)等等。在这种情况下,可以将std::pair与std::vector一起使用。你可以参考下面的例子。

std::pair<double,double> firstCoordinate,secondCoordinate;
std::pair<std::pair<double,double>,std::pair<double,double> > coordinateMap;
std::vector<std::pair<std::pair<double,double>,std::pair<double,double> > > coordinateMapVector;

在上面的例子中,firstCoordinate和secondCoordinate分别是(x1,y1)和(x2,y2),它们可以使用coordinateMap进行映射。而coordinateMapVector将拥有两个坐标系之间所有这样的映射的集合。

同样,上述共享数据结构也可以通过以下方式进行更新。

firstCoordinate  = std::make_pair(1.0,1.0);
secondCoordinate = std::make_pair(2.0,2.0);
coordinateMap    = std::make_pair(firstCoordinate,secondCoordinate);
coordinateMapVector.push_back(coordinateMap);

最新更新