当前位置: 首页>>代码示例>>C++>>正文


C++ CvBlobs::empty方法代码示例

本文整理汇总了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;
开发者ID:shazzadhub,项目名称:G-MAC,代码行数:67,代码来源:main.cpp


注:本文中的CvBlobs::empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。