简体   繁体   English

C ++ OpenCV从点向量获取边界框

[英]C++ OpenCV get Bounding Box From Vector Of Points

I have vector of points i drawed by my self : 我有自己画的点数:

std::vector<CvPoint> shape1 = paintshape(0);

http://s29.postimg.org/brkfri6uv/box.jpg

Now i need to get a bounding box object (points) around this shape , 现在我需要在这个形状周围得到一个边界框对象(点),

i have searched the web for answeres but every topic is talking about recognizing the edge of some object inside whol image file and then making the bounding box. 我在网上搜索了答案,但每个主题都在讨论识别whol图像文件中某些对象的边缘,然后制作边界框。

in my case its different , 在我的情况下它是不同的,

Thanks ! 谢谢 !

get the boundingRect for your points: 获取你的积分的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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM