我有自己绘制的点 vector :
std::vector<CvPoint> shape1 = paintshape(0);
现在我需要围绕这个形状获得一个边界框对象(点),
我在网上搜索了答案,但每个话题都在谈论 识别整个图像文件中某些对象的边缘,然后制作边界框。
在我的例子中是不同的,
谢谢!
最佳答案
获取boundingRect对于你的观点:
#include "opencv2/imgproc/imgproc.hpp"
// please use stuff from the cv:: namespace, not the outdated Cv*
std::vector<cv::Point> shape1 = paintshape(0);
cv::Rect r = cv::boundingRect(shape1);
关于C++ OpenCV 从点 vector 获取边界框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26251534/