现在的位置: 首页 > 综合 > 正文

openCV图像变换

2014年02月07日 ⁄ 综合 ⁄ 共 7299字 ⁄ 字号 评论关闭

//做卷积     
      void cvFilter2D(
            const CvArr* src,
            CvArr* dst,
            const CvMat* kernel,                     //如果定义了anchor可为偶数,否则为奇数         且类型须为CV_32FC1
            CvPoint anchor = cvPoint(-1,-1)     //默认值为核的中间点
      );
//处理边界
    void cvCopyMakeBorder(
            const CvArr* src,
            CvArr* dst,
            CvPoint offset,                             //原始图片放置目标图像偏移 ref:cvPoint((N-1)/2,(N-1)/2)      
                                                                (Ax , Ay) anchor不在正中心时
            int bordertype,                            //IPL_BORDER_CONSTANT or IPL_BORDER_REPLICATE
                                                               (IPL_BORDER_REFLECT and IPL_BORDER_WRAP)  no implement   now      
            CvScalar value = cvScalarAll(0)
     );
//卷积应用之一:导数
      cvSobel(
            const CvArr* src,      
            CvArr* dst,                                //IPL_DEPTH_16S防止溢出
            int xorder,                                 //xorder,yorder必须非零
            int yorder,
            int aperture_size = 3                  //模板大小             CV_SCHARR可减少小尺寸Sobel算子不精确的问题
      );

    void cvLaplace(
            const CvArr* src,                8u   32f
            CvArr* dst,                        16s  32f
            int apertureSize = 3
      );

      void cvCanny(
            const CvArr* img,               //须是灰度图
            CvArr* edges,
            double lowThresh,
            double highThresh,
            int apertureSize = 3
      );

//Hough变换
      CvSeq* cvHoughLines2(
            CvArr* image,
            void* line_storage,
            int method,                       //SHT不用param1 param2                   PPHT                                      MSHT         
            double rho,
            double theta,
            int threshold,                    //检测多少个点才返回线
            double param1 = 0,                                                                  返回线的最小长度                       rho/param1
            double param2 = 0                                                                   线的分隔(共线时是否合并)         theta/param2
      );

      CvSeq* cvHoughCircles(
            CvArr* image,
            void* circle_storage,
            int method,                       //必须设为CV_HOUGH_GRADIENT
            double dp,                        //output精度  dp>=1
            double min_dist,               //将其视为两个圆的最小距离
            double param1 = 100,       //CANNY门限 high=param1  low=param1/2
            double param2 = 300,       //累积门限
            int min_radius = 0,
            int max_radius = 0
      );
//映射
      void cvRemap(
            const CvArr* src,
            CvArr* dst,
            const CvArr* mapx,
            const CvArr* mapy,
            int flags = CV_INTER_LINEAR | CV_WARP_FILL_OUTLIERS,                    //CV_WARP_FILL_OUTLIERS外面的将被填充
            CvScalar fillval = cvScalarAll(0)
      );
//flags values Meaning
CV_INTER_NN Nearest neighbor
CV_INTER_LINEAR Bilinear (default)
CV_INTER_AREA Pixel area resampling
CV_INTER_CUBIC Bicubic interpolation

//几何变换
//For Dense
      void cvWarpAffine(                                                                        void cvWarpPerspective(      
            const CvArr* src,                                                                           const CvArr* src,
            CvArr* dst,                                                                                    CvArr* dst,
            const CvMat* map_matrix,      //(3x2)                                              const CvMat* map_matrix,           //(3x3)
            int flags = CV_INTER_LINEAR | CV_WARP_FILL_OUTLIERS,                int flags = CV_INTER_LINEAR + CV_WARP_FILL_OUTLIERS,
            CvScalar fillval = cvScalarAll(0)                                                         CvScalar fillval = cvScalarAll(0)
      );                                                                                                );
//较上面在某些情况下简单易用
      void cvGetQuadrangleSubPix(
            const CvArr* src,
            CvArr* dst,
            const CvMat* map_matrix
      );

      CvMat* cvGetAffineTransform(                                                          CvMat* cvGetPerspectiveTransform(
            const CvPoint2D32f* pts_src,      3_POINTS                                            const CvPoint2D32f* pts_src,      4_POINTS
            const CvPoint2D32f* pts_dst,                                                                const CvPoint2D32f* pts_dst,
            CvMat* map_matrix                                                                               CvMat* map_matrix
      );                                                                                                   );

      CvMat* cv2DRotationMatrix(                                                                         
            CvPoint2D32f center,
            double angle,
            double scale,
            CvMat* map_matrix
      );
//For Sparse
      void cvTransform(                                                                         void cvPerspectiveTransform(
            const CvArr* src,                                                                           const CvArr* src,
            CvArr* dst,                                                                                    CvArr* dst,
            const CvMat* transmat,                                                                  const CvMat* mat
            const CvMat* shiftvec = NULL                                                    );
      );

//坐标变换
      void cvCartToPolar(
            const CvArr* x,
            const CvArr* y,
            CvArr* magnitude,
            CvArr* angle = NULL,
            int angle_in_degrees = 0
      );

      void cvPolarToCart(
            const CvArr* magnitude,
            const CvArr* angle,
            CvArr* x,      
            CvArr* y,
            int angle_in_degrees = 0
      );

     void cvLogPolar(
            const CvArr* src,
            CvArr* dst,
            CvPoint2D32f center,      
            double m,
            int flags = CV_INTER_LINEAR | CV_WARP_FILL_OUTLIERS
      );
//离散傅里叶变换
      void cvDFT(
            const CvArr* src,
            CvArr* dst,                                                                                 CV_DXT_INV_SCALE 
            int flags,                  //CV_DXT_FORWARD           CV_DXT_INVERSE            CV_DXT_SCALE       CV_DXT_ROWS (打包方式不一样)
            int nonzero_rows = 0   //当非  2^ 3^ 5^整数倍时  可忽略的行
      );
//为了避免解包再乘而使用的API
      void cvMulSpectrums(
            const CvArr* src1,
            const CvArr* src2,
            CvArr* dst,
            int flags           //CV_DXT_MUL_CONJ(乘以共轭)            CV_DXT_FORWARD
      );
//离散余弦变换
      void cvDCT(
            const CvArr* src,
            CvArr* dst,
            int flags            //已经考虑SCALE  CV_DXT_SCALE 没效果
      );

      void cvIntegral(                              
            const CvArr* image,                              1  2  3                    1   3    6
            CvArr* sum,                                         2  3  4                    3   8   15
            CvArr* sqsum = NULL,                          3  4  5                    6  15   27
            CvArr* tilted_sum = NULL
      );
      
      Void cvDistTransform(
            const CvArr* src,
            CvArr* dst,
            int distance_type = CV_DIST_L2,
            int mask_size = 3,
            const float* kernel = NULL,
            CvArr* labels = NULL
      );
//直方图均衡
      void cvEqualizeHist(
            const CvArr* src,
            CvArr* dst
      );

 

源文件:http://www.cnblogs.com/westwind/archive/2009/08/04/1538590.html

抱歉!评论已关闭.