Advertisement

OpenCV 创建并截取矩形区域

阅读量:

通过opencv实现鼠标绘制矩形功能,相关代码示例如下:

复制代码
    #include <cv.h>  
    #include <highgui.h>  
    #include <stdio.h>  
    #pragma comment( lib, "cv.lib" )  
    #pragma comment( lib, "cxcore.lib" )  
    #pragma comment( lib, "highgui.lib" )  
    IplImage* src = 0;   
    IplImage* dst = 0;   
    void on_mouse( int event, int x, int y, int flags, void* ustc)  
    {  
    static CvPoint pre_pt = {-1,-1};  
    static CvPoint cur_pt = {-1,-1};  
    CvFont font;  
    cvInitFont(&font, CV_FONT_HERSHEY_SIMPLEX, 0.5, 0.5, 0, 1, CV_AA);  
    char temp[16];  
    
    if( event == CV_EVENT_LBUTTONDOWN )  

全部评论 (0)

还没有任何评论哟~