本文整理汇总了C++中CvBlobs::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ CvBlobs::empty方法的具体用法?C++ CvBlobs::empty怎么用?C++ CvBlobs::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvBlobs
的用法示例。
在下文中一共展示了CvBlobs::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
CvContourPolygon *sPolygon = cvSimplifyPolygon(polygon, 5.0);
CvContourPolygon *cPolygon = cvPolygonContourConvexHull(sPolygon);
cvRenderContourChainCode(&(*it).second->contour, blobFrame, CV_RGB(255, 0 ,0));
cvRenderContourPolygon(sPolygon, blobFrame, CV_RGB(0, 0, 255));
cvRenderContourPolygon(cPolygon, blobFrame, CV_RGB(0, 255, 0));
delete cPolygon;
delete sPolygon;
delete polygon;
// Render internal contours:
//for(CvContoursChainCode::const_iterator jt=(*it).second->internalContours.begin(); jt!=(*it).second->internalContours.end(); ++jt)
//cvRenderContourChainCode((*jt), blobFrame);
renderPoint = getshPoint();
renderPoint.x - 2.0;
renderPoint.y - 2.0;
//cvCircle(blobFrame, renderPoint, 3, CV_RGB(0.0, 255.0, 255.0), 1);
}
cvCircle(blobFrame, renderPoint, 3, CV_RGB(0.0, 255.0, 255.0), 4, CV_AA, 0);
cvShowImage("Rendering with Blobls",blobFrame);
// ********************************************************************** MOUSE ***************************************************************************** //
/** Working with CvBlob contures to drag out each blob moments in an image frame. Then we need to calculate the (x1, y1) posision of that
particular blob-conture. Point p(x1, y1) actually means the pixel position on the 480 / 320 camera frame. Then We need to map the p with
the screen Resolution (in our case it is 1920 / 1080) we are using on our OP. This p(x, y) is then passed to the Display Handler class for working it out .**/
if(mouse){
if(blobs.empty()){ // // if the hands gets out of the camera frame
//cout << "No blobs .." <<endl;
frameout = true; // // turning the FRAMEOUT flag to true to indicate hand is out of frame
t_holder = 0; // // IF hand is out the time clock will reset to zero
currentGest.clear(); // // clears the gesture buffer
}
for (CvBlobs::const_iterator it=blobs.begin(); it!=blobs.end(); ++it){
// calculating the conture pixel into (640 x 480) camera frame
double moment10 = it->second->m10;
double moment01 = it->second->m01;
double area = it->second->area;
int x1 = (int)moment10 / area;
int y1 = (int)moment01 / area;
//.........................................................GESTURE RELATED.................................................................//
if(motiongesture){
//cout << "Motion Gesture Activated" <<endl;
time_t t_current = time(NULL); // // get the current sec from 1/1/1970
if(t_holder == 0){
t_holder = (int)t_current;
}
int currentsec = (int)t_current - t_holder; // // holds time interval sinces hand is on frame
if(currentsec <= 4){ // //Time window to perform gesture is 4 sceonds
//Point p(x1, y1);
//cout << p;