groupRectangles
- Library/opencv
- 2012. 11. 23.
OpenCV :groupRectangles()
OpenCV version : 2.4.3
#include "" 부분은 태그를 방해하므로~
#include <iostream>
#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\opencv.hpp>
using namespace std;
using namespace cv;
함수원형
CV_EXPORTS void groupRectangles(CV_OUT CV_IN_OUT vector& rectList, int groupThreshold, double eps=0.2); CV_EXPORTS_W void groupRectangles(CV_OUT CV_IN_OUT vector & rectList, CV_OUT vector & weights, int groupThreshold, double eps=0.2); CV_EXPORTS void groupRectangles( vector & rectList, int groupThreshold, double eps, vector * weights, vector * levelWeights ); CV_EXPORTS void groupRectangles(vector & rectList, vector & rejectLevels, vector & levelWeights, int groupThreshold, double eps=0.2); CV_EXPORTS void groupRectangles_meanshift(vector & rectList, vector & foundWeights, vector & foundScales, double detectThreshold = 0.0, Size winDetSize = Size(64, 128));
int main()
{
std::vector vecList;
cv::Rect rect1(2,2,2,2);
//cv::Rect rect2(2,2,2,2);
cv::Rect rect3(30,30,30,30);
//cv::Rect rect4(2,2,2,2);
vecList.push_back(rect1);
//vecList.push_back(rect2);
vecList.push_back(rect3);
//vecList.push_back(rect4);
cv::groupRectangles( vecList, 2);
return 0;
}
Rect 를 이용하여 간단한 사용방법이다.
결과화면
결과는 간단히 사각형을 검출 후 추출하였을 때이다.
사각형 검출은 따로 포스팅을 한다.
결과화면과 같이 사각형을 1번씩 검출하게 된다.
GroupRectangles 함수를 사용하지 않게 되면 사각형을 여러번 찾게되는 문제가 생기니 계산하지말고 간단히 있는 함수를 사용하자.
'Library > opencv' 카테고리의 다른 글
| opencv camera frame rate (0) | 2012.11.23 |
|---|---|
| using openCV2.4.3 for Detect Rectangle (0) | 2012.11.23 |
| Rectangle Detection (0) | 2012.11.21 |
| IplImage or CvMat to Mat (0) | 2012.11.21 |
| opencv2.4.3 for android (win,mac, ubuntu) (0) | 2012.11.20 |