c++ - 如何将 vector<vector<Point>> 轮廓转换为 CVPoint 或 cvpoint2d32f?

标签 c++ opencv image-processing vector contour

如何从 vector<vector<Point>> contours 转换至 CVPointcvpoint2d32fvector<vector<Point>> contours CvPoint cvpcvpoint2d32f Cvp32

我的轮廓中有三个对象,我只想复制到 CvPointCvPoint2d32F .

最佳答案

如果要将第i vector 和其中的第j元素复制到CvPoint:

CvPoint p = contours[i][j];

如果你想复制到cvPoint2D32f:

CvPoint2D32f p2 = cvPoint2D32f(contours[i][j].x, contours[i][j].y);

附注:建议:CvPointCvPoint2d32Fold OpenCV APIs ,您应该改用新的 API PointPoint2f

关于c++ - 如何将 vector<vector<Point>> 轮廓转换为 CVPoint 或 cvpoint2d32f?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23485334/

相关文章:

image - 检测图像上文本存在的算法

python - TensorFlow 二值图像分类 : Predict Probability of each class for each image in data set

c++ - 如何以线程安全的方式更改目录?

c++ - 处理孙子控件的 WM_NOTIFY

c++ - C++中虚方法的误解

python - OpenCV 通过填充调整大小

python-3.x - 将RGB数据映射到图例中的值

c++ - 如何使用 Xlib 模拟拖动 Action ?

image-processing - OpenCv 构建时不保存图像?

opencv - 使用特征检测的对象跟踪