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


C++ DJI_event::set_DJI_event方法代码示例

本文整理汇总了C++中DJI_event::set_DJI_event方法的典型用法代码示例。如果您正苦于以下问题:C++ DJI_event::set_DJI_event方法的具体用法?C++ DJI_event::set_DJI_event怎么用?C++ DJI_event::set_DJI_event使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DJI_event的用法示例。


在下文中一共展示了DJI_event::set_DJI_event方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: guidance_callback


//.........这里部分代码省略.........
                    
                    for(size_t i=0;i<nextrightpts.size();i++)
                    {
                        if(nextrightpts[i].x>=0 && nextrightpts[i].x<=WIDTH && nextrightpts[i].y>=0 && nextrightpts[i].y<=HEIGHT)
                        {
                            CvScalar line_color; line_color = CV_RGB(255,0,0);
                            //int line_thickness = 1;
                            CvPoint p,q;
                            p.x = (int) prevrightpts[i].x;
                            p.y = (int) prevrightpts[i].y;
                            q.x = (int) nextrightpts[i].x;
                            q.y = (int) nextrightpts[i].y;
//                            double angle; angle = atan2( (double) p.y - q.y, (double) p.x - q.x );
//                            double hypotenuse; hypotenuse = sqrt( pow((p.y - q.y),2) + pow((p.x - q.x),2) );
//                            
////                            //scale the line by a factor of 3
//                            q.x = (int) (p.x - 2 * hypotenuse * cos(angle));
//                            q.y = (int) (p.y - 2 * hypotenuse * sin(angle));
//
//                            cvLine( &prevrightimg, p, q, line_color, line_thickness, CV_AA, 0 );
//                            
//                            p.x = (int) (q.x + 9 * cos(angle + pi / 4));
//                            p.y = (int) (q.y + 9 * sin(angle + pi / 4));
//                            cvLine( &prevrightimg, p, q, line_color, line_thickness, CV_AA, 0 );
//                            p.x = (int) (q.x + 9 * cos(angle - pi / 4));
//                            p.y = (int) (q.y + 9 * sin(angle - pi / 4));
//                            cvLine( &prevrightimg, p, q, line_color, line_thickness, CV_AA, 0 );
//
                            arrowedLine(right_mask, p, q, line_color);
                            circle(right_mask, nextrightpts[i], 2, Scalar(0,255,0),-1);
                            
                            kpts.push_back(nextrightpts[i]);
                        }
                    }
                    
                    imshow("right", right_mask);
                    moveWindow("right", 500, 0);
                    
                }
                
                
                
                if(frame_num>0)
                {
                    if(nextrightpts.size()<=MIN_FEATURES)
                    {
                        goodFeaturesToTrack(g_greyscale_image_right, prevrightpts, MAX_FEATURES, QUALITY_EIGVALUE, MIN_DISTANCE);
                    }
                    else
                    {
                        prevrightpts.assign(kpts.begin(), kpts.end());
                    }
                }
                
                g_greyscale_image_right.copyTo(prevrightimg);
                frame_num++;
            }
            
            
            //Stero matching
            
//            Mat g_l,g_r;
//            
//            cvtColor(g_greyscale_image_left, g_l, CV_BGR2GRAY);
//            cvtColor(g_greyscale_image_right,g_r, CV_BGR2GRAY);
            
            Mat imgDisparity16S = Mat( g_greyscale_image_left.rows, g_greyscale_image_left.cols, CV_16S );
            Mat imgDisparity8U = Mat( g_greyscale_image_left.rows, g_greyscale_image_left.cols, CV_8UC1 );
            
            int ndisparities = 16*4;
            int SADWindowSize = 7;
            
            Ptr<StereoBM> sbm = StereoBM::create( ndisparities, SADWindowSize );
            
            sbm->compute( g_greyscale_image_left, g_greyscale_image_right, imgDisparity16S );
            
            double minVal; double maxVal;
            
            minMaxLoc( imgDisparity16S, &minVal, &maxVal );
            
            printf("Min disp: %f Max value: %f \n", minVal, maxVal);
            
            imgDisparity16S.convertTo( imgDisparity8U, CV_8UC1, 255/(maxVal - minVal));
            
            namedWindow( "windowDisparity", WINDOW_AUTOSIZE );
            imshow( "windowDisparity", imgDisparity8U );
            moveWindow("windowDisparity", 500, 500);

            
        }
        waitKey(1);
        
    }
    
    g_lock.leave();
    g_event.set_DJI_event();
    
    
    return 0;
}
开发者ID:asambrekar11,项目名称:16-720-CV-Project,代码行数:101,代码来源:dji_lkt.cpp


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