⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cv.h

📁 微软的基于HMM的人脸识别原代码, 非常经典的说
💻 H
📖 第 1 页 / 共 5 页
字号:
//    Notes:
//             Source and destination image must be equal types and planes
//F*/
OPENCVAPI void cvPyrSegmentation( IplImage* src,
                               IplImage* dst,
                               CvMemStorage *storage,
                               CvSeq **comp,
                               int level, double threshold1,
                               double threshold2 );


/****************************************************************************************\
*                              Derivative calculation                                    *
\****************************************************************************************/

/*F///////////////////////////////////////////////////////////////////////////////////////
//    Name:    cvSobel
//    Purpose: calculates an image derivative d^(xorder+yorder)I/((dx)^xorder)*(dy^yoder))
//             by convolving the image with extended Sobel operators.
//             No scaling is performed.
//
//             |-1 -2 -1|     |-1 0 1|
//             | 0  0  0| and |-2 0 2| are partial cases of it.
//             | 1  2  1|     |-1 0 1|
//
//             First one corresponds to xorder = 0, yorder = 1, apertureSize = 3,
//             And the second corresponds to xorder = 1, yorder = 0, apertureSize = 3.
//    Context:
//    Parameters:
//      src    - source image
//      deriv  - destination derivative image
//      xorder - order of x derivative
//      yorder - order of y derivative
//      apertureSize - size of colvolution operator. Must be odd: 3, 5, ...
//    Returns:
//    Notes:
//      The function uses replicatation border mode
//F*/
OPENCVAPI void cvSobel( IplImage* src,
                     IplImage* deriv,
                     int xorder,
                     int yorder,
                     int apertureSize CV_DEFAULT(3) );

/*F///////////////////////////////////////////////////////////////////////////////////////
//    Name:     cvLaplace
//    Purpose:  Calculates Laplacian of the image: deltaI = d^2(I)/dx^2 + d^2(I)/dy^2.
//              Sobel operator is used for calculating derivatives.
//    Context:
//    Parameters:
//      src - source image
//      dst - destination image
//      apertureSize - size of applied aperture
//    Returns:
//    Notes:
//F*/
OPENCVAPI void cvLaplace( IplImage* src,
                       IplImage* dst,
                       int apertureSize CV_DEFAULT(3) );

/****************************************************************************************\
*                                    Morphology                                          *
\****************************************************************************************/

/*F///////////////////////////////////////////////////////////////////////////////////////
//
//    Name:    cvCreateStructuringElementEx
//    Purpose:
//      Allocates and fills IplConvKernel structure
//      which can be used as a structuring element in following morphological operations
//    Context:
//    Parameters:
//        cols   - number of columns in the kernel
//        rows   - number of rows in the kernel
//        anchorX - x-coordinate of anchor point(0..cols-1)
//        anchorY - y-coordinate of anchor point(0..rows-1)
//        shape   - shape of the structuring element
//              CV_SHAPE_RECT - rectangular element
//              CV_SHAPE_CROSS - cross-shaped element
//              CV_SHAPE_ELLIPSE - elliptic element
//              CV_SHAPE_CUSTOM - arbitrary element.
//              <values> array determines mask
//        values  - mask array. non-zero pixels determine shape of the element
//    Returns:
//        structuring element
//F*/
OPENCVAPI  IplConvKernel*  cvCreateStructuringElementEx( int  cols,    int rows,
                                                      int  anchorX, int anchorY,
                                                      CvElementShape shape,
                                                      int* values CV_DEFAULT(0) );


/*F///////////////////////////////////////////////////////////////////////////////////////
//
//    Name:    cvReleaseStructuringElement
//    Purpose:
//      Releases structuring element and clears pointer
//    Context:
//    Parameters:
//        element - double pointer to structuring element
//    Returns:
//F*/
OPENCVAPI  void  cvReleaseStructuringElement( IplConvKernel** element );


/*F///////////////////////////////////////////////////////////////////////////////////////
//
//    Name:    cvErode
//    Purpose:
//      Applies minimum filter to the source image given a structuring element
//    Context:
//    Parameters:
//        src    - source image
//        dst    - destination image, may be the same as source one.
//        element - structuring element.
//                  If the pointer is 0, 3x3 rectangular element is used.
//        iterations - how many times the erosion needs to be applied
//    Returns:
//F*/
OPENCVAPI  void  cvErode( IplImage* src, IplImage* dst,
                       IplConvKernel* element CV_DEFAULT(0),
                       int iterations CV_DEFAULT(1) );

/*F///////////////////////////////////////////////////////////////////////////////////////
//
//    Name:    cvDilate
//    Purpose:
//      Applies maximum filter to the source image given a structuring element
//    Context:
//    Parameters:
//        src    - source image
//        dst    - destination image, may be the same as source one.
//        element - structuring element.
//                  If the pointer is 0, 3x3 rectangular element is used.
//        iterations - how many times the dilation needs to be applied
//    Returns:
//F*/
OPENCVAPI  void  cvDilate( IplImage* src, IplImage* dst,
                        IplConvKernel* element CV_DEFAULT(0),
                        int iterations CV_DEFAULT(1) );

/*F///////////////////////////////////////////////////////////////////////////////////////
//
//    Name:    cvMorphologyEx
//    Purpose:
//      Applies one of the extended morphological operations, which based on
//      erosion and dilatation
//    Context:
//    Parameters:
//        src    - source image
//        dst    - destination image, may be the same as source one.
//        temp   - temporary image. The parameter must be non-zero
//                 if operation is CV_MOP_TOPHAT or CV_MOP_BLACKHAT and src == dst, or
//                 if operation is CV_MOP_GRADIENT
//        element - structuring element.
//                  If the pointer is 0, 3x3 rectangular element is used.
//        operation - one of the following:
//               (let's nB = "<element>, applied <iterations> times")
//                CV_MOP_OPEN:   dst = dilate(erode(src,nB),nB);
//                CV_MOP_CLOSE:  dst = erode(dilate(src,nB),nB);
//                CV_MOP_GRADIENT: dst = dilate(src,nB)-erode(src,nB)
//                CV_MOP_TOPHAT:   dst = src - erode(src,nB)
//                CV_MOP_BLACKHAT: dst = dilate(src,nB) - src
//        iterations - how many times the erosion/dilation needs to be applied
//    Returns:
//F*/
OPENCVAPI  void  cvMorphologyEx( IplImage* src, IplImage* dst,
                              IplImage* temp, IplConvKernel* element,
                              CvMorphOp operation, int iterations CV_DEFAULT(1) );

/****************************************************************************************\
*                                  Image Statistics                                      *
\****************************************************************************************/

/****************************************************************************************\
*      Image statistics functions support the next image formats:                        *
*         single-channel: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_32F                      *
*         three-channel: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_32F (COI must be != 0)    *
\****************************************************************************************/

/*F///////////////////////////////////////////////////////////////////////////////////////
//
//    Name:    cvSumPixels
//    Purpose:
//      Sums all the pixels in the image ROI
//    Context:
//    Parameters:
//        img - input image.
//    Returns:
//        sum of pixels in the ROI
//F*/
OPENCVAPI  double  cvSumPixels( IplImage* img );


/*F///////////////////////////////////////////////////////////////////////////////////////
//
//    Name:    cvCountNonZero
//    Purpose:
//      Counts all the non-zero pixels in the image ROI
//    Context:
//    Parameters:
//        img - input image.
//    Returns:
//        count of non-zero pixels
//F*/
OPENCVAPI  int  cvCountNonZero( IplImage* img );


/*F///////////////////////////////////////////////////////////////////////////////////////
//
//    Name:    cvMean
//    Purpose:
//      Calculates average pixel value of image region
//    Context:
//    Parameters:
//        img - input image.
//        mask - byte-depth, single channel image, non-zero pixels of which
//               determine processes region
//    Returns:
//        average value
//F*/
OPENCVAPI  double  cvMean( IplImage* img, IplImage* mask CV_DEFAULT(0) );
#define cvMeanMask cvMean

/*F///////////////////////////////////////////////////////////////////////////////////////
//
//    Name:    cvMean_StdDev
//    Purpose:
//      Calculates mean and standard deviation of pixels in the image region
//    Context:
//    Parameters:
//        img - input image.
//        mean - mean value
//        std_dev - standard deviation
//        mask - mask(byte-depth, single channel)
//    Returns:
//F*/
OPENCVAPI  void    cvMean_StdDev( IplImage* img, double* mean, double* std_dev,
                                IplImage* mask CV_DEFAULT(0) );
#define cvMean_StdDevMask(img, mask, mean, std_dev) cvMean_StdDev(img, mean, std_dev, mask)


/*F///////////////////////////////////////////////////////////////////////////////////////
//
//    Name:    cvMinMaxLoc
//    Purpose:
//      Finds minimum and maximum pixel values in the image region
//      and determines their locations.
//    Context:
//    Parameters:
//        img - input image.
//        minVal - minimum value
//        maxVal - maximum value
//        minLoc - location of the minimum
//        maxLoc - location of the maximum
//        mask - mask(byte-depth, single channel)
//    Returns:
//    Note:
//      If there are several global minimums and/or maximums,
//      function returns the most top-left extremums.
//F*/
OPENCVAPI  void  cvMinMaxLoc( IplImage* img, double* min_val, double* max_val,
                           CvPoint* min_loc CV_DEFAULT(0),
                           CvPoint* max_loc CV_DEFAULT(0),
                           IplImage* mask CV_DEFAULT(0) );
#define cvMinMaxLocMask(img, mask, min_val, max_val, min_loc, max_loc) \
        cvMinMaxLoc(img, min_val, max_val, min_loc, max_loc, mask)


/*F///////////////////////////////////////////////////////////////////////////////////////
//
//    Name:    cvMoments
//    Purpose:
//      Calculates moments(up to third order) of the image ROI.
//      It fills moments state and after that, it is possible to
//      return concrete moments using
//        cvGetSpatialMoment, cvGetCentralMoment or
//        cvGetNormalizedCentralMoment
//    Context:
//    Parameters:
//        img - input image
//        moments - output moments state.
//        binary - if non zero, function treats non-zero pixels as 1s.
//    Returns:
//F*/
OPENCVAPI void cvMoments( IplImage* img, CvMoments* moments, int binary CV_DEFAULT( 0 ));


/*F///////////////////////////////////////////////////////////////////////////////////////
//
//    Name:    cvGetSpatialMoment, cvGetCentralMoment, cvGetCentralNormalizedMoment
//    Purpose:
//      Returns different moments(up to third order) from moments state.
//        for raster image, these moments are defined as:
//        mij = spatial_moment(i,j) = sum(y=0,H-1) sum(x=0,W-1) [I(x,y) *(x^i) *(y^j)]
//       (where I(x,y) means pixel value at point(x,y). x^y means x power y).
//
//        muij = central_moment(i,j) = sum(y=0,H-1) sum(x=0,W-1)
//                                     [I(x,y) *(x-mean_x)^i) *((y-mean_y)^j)]
//       (where mean_x = m10/m00, mean_y = m01/m00.
//         it's easy to see that mu00 = m00, mu10 = mu01 = 0)
//
//        nu_ij = central_normalized_moment(i,j) = muij/(m00^((i+j)/2+1))
//    Context:
//    Parameters:
//        moments - moment state( filled by cvMoments or cvContourMoments )
//        x_order - x order of the moment
//        y_order - y order of the moment.
//        The following condition has to be satifsied:
//          0 <= x_order + y_order <= 3
//    Returns:
//        Required moment
//F*/
OPENCVAPI  double  cvGetSpatialMoment( CvMoments* moments, int x_order, int y_order );
OPENCVAPI  double  cvGetCentralMoment( CvMoments* moments, int x_order, int y_order );
OPENCVAPI  double  cvGetNormalizedCentralMoment( CvMoments* moments,
                                              int x_order, int y_order );


/*F///////////////////////////////////////////////////////////////////////////////////////
//
//    Name:    cvGetHuMoments
//    Purpose:
//      Calculates seven Hu invariants from normalized moments of second and third order
//    Context:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -