我有自己画的点数:
std::vector<CvPoint> shape1 = paintshape(0);
Run Code Online (Sandbox Code Playgroud)

现在我需要在这个形状周围得到一个边界框对象(点),
我在网上搜索了答案,但每个主题都在讨论识别whol图像文件中某些对象的边缘,然后制作边界框.
在我的情况下它是不同的,
谢谢 !
获取你的积分的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);
Run Code Online (Sandbox Code Playgroud)