OPENCV 初探(三)

Code
GUI
窗口函数:
      cvNamedWindow(const char* name,
                               int flags = CV_WINDOW_AUTOSIZE);   flags=0 可拉伸

      cvDestroyWindow();

      void* cvGetWindowHandle( const char* name );
      const char* cvGetWindowName( void* window_handle );

      void cvResizeWindow(
      const char* name,
      int width,
      int height
      );

      void cvMoveWindow( const char* name, int x, int y );
      void cvDestroyAllWindows( void );
      int cvStartWindowThread( void );

等待键盘:
     while( 1 ) {
            if( cvWaitKey(100)==27 ) break;                   cvWaitKey(0) 一直等待
      }


鼠标:
      void CvMouseCallback(
      int event,
      int x,
      int y,
      int flags,
      void* param
      );

      void cvSetMouseCallback(
      const char* window_name,
      CvMouseCallback on_mouse,
      void* param = NULL
      );

滑动条:
      int cvCreateTrackbar(
      const char* trackbar_name,
      const char* window_name,
      int* value,
      int count,
      CvTrackbarCallback on_change
      );

      void (*callback)( int position )

      int cvGetTrackbarPos(
      const char* trackbar_name,
      const char* window_name
      );

      void cvSetTrackbarPos(
      const char* trackbar_name,
      const char* window_name,
      int pos
      );


HARDWARE
      CvCapture* cvCreateFileCapture( const char* filename );
      CvCapture* cvCreateCameraCapture( int index );    -1 可打开列表供选择
      int cvGrabFrame( CvCapture* capture );  1 }                                          
                                                                                    }   <=>IplImage* cvQueryFrame( CvCapture* capture );
      IplImage* cvRetrieveFrame( CvCapture* capture );2}
      
      void cvReleaseCapture( CvCapture** capture );

       double cvGetCaptureProperty(
      CvCapture* capture,
      int property_id
      );
      int cvSetCaptureProperty(
      CvCapture* capture,
      int property_id,
      double value
      );

      CvVideoWriter* cvCreateVideoWriter(
      const char* filename,
      int fourcc,
      double fps,
      CvSize frame_size,
      int is_color = 1
      );

      int cvWriteFrame(
      CvVideoWriter* writer,
      const IplImage* image
      );

      void cvReleaseVideoWriter(
      CvVideoWriter** writer
      );
FILE SYSTEM

      IplImage* cvLoadImage(
            const char* filename,
            int iscolor = CV_LOAD_IMAGE_COLOR (自动转换为3channelsx8bits)                   
                             //CV_LOAD_IMAGE_GRAYSCALE
                             //CV_LOAD_IMAGE_ANYCOLOR,
                             //CV_LOAD_IMAGE_UNCHANGED,  ///+CV_LOAD_IMAGE_ANYDEPTH
            );
          
           CV_LOAD_IMAGE_COLOR | CV_LOAD_IMAGE_ANYDEPTH.(设置色深)
          
      int cvSaveImage(
            const char* filename,
            const CvArr* image
      );

图像转换:
      void cvConvertImage(
      const CvArr* src,
      CvArr* dst,
      int flags = 0                                        flip the image vertically
      );
    
 
原文地址:https://www.cnblogs.com/westwind/p/1533322.html