Opencv 如何存储一维向量<;点2f>;在Mat中,如何访问Mat中的这些点?

Opencv 如何存储一维向量<;点2f>;在Mat中,如何访问Mat中的这些点?,opencv,vector,mat,Opencv,Vector,Mat,我有一个点2f的1D向量。我将这些点存储在尺寸为6x6的2D垫中。现在如何访问这些点?谢谢您的帮助:)我现在整理了答案 vector<Point2f>centers(36); //I have 1D vector of points which is of size 36 Mat new_mat = Mat(centers).reshape(6, 6); //1d vector to 6x6matrix **/*Actually the Point2f, when stored i

我有一个点2f的1D向量。我将这些点存储在尺寸为6x6的2D垫中。现在如何访问这些点?

谢谢您的帮助:)我现在整理了答案

vector<Point2f>centers(36); //I have 1D vector of points which is of size 36
Mat new_mat = Mat(centers).reshape(6, 6); //1d vector to 6x6matrix

**/*Actually the Point2f, when stored in Mat makes use of the channels for storing the float values*/**

Mat test = new_mat.reshape(2, 6);// this makes 6 channels into two rows

**/*My objective here is to transpose the vector  which is now stored in Mat*/**

Mat q1 = test.t();//transposed 6 channel mat

vector<Point2f>x(q1.begin<Point2f>(), q1.end<Point2f>());//transposed vector
vectorcents(36)//我有点的一维向量,大小为36
新垫=垫(中心)。重塑(6,6)//一维向量到6x6矩阵
**/*实际上,当存储在Mat中时,Point2f利用通道存储浮点值*/**
材料试验=新材料重塑(2,6);//这将6个通道分成两行
**/*我的目标是转置现在存储在Mat中的向量*/**
Mat q1=test.t()//转置6通道mat机
vectrox(q1.begin(),q1.end())//转置向量
现在,我们可以通过test.at(0,1)或相应地访问Mat中存储的Point2f

摘要:
VECTRORX->Mat(2D)尺寸6x6->重塑->在Mat中进行更改或修改->再次转换为VECTRORX_输出

您使用哪种语言?您还可以附加示例代码段吗?mat元素的类型是什么?为什么选择6x6垫?这不是取决于点的数量(向量的大小)吗?@ ZDAR我使用VS Open CV 3.2,C++。我现在将附加代码。@Mick一种类型的垫子是float。6x6是我的要求。是的,这也取决于向量的大小。我将附上代码片段以供澄清