8.4.2.40. utilities
(packages/opencv/utilities.lsh)


dummy function that adds OpenCV C header files in C file

8.4.2.40.0. (dummy_utilities)
(packages/opencv/utilities.lsh)




8.4.2.40.1. (cvinitlineiterator array pt1 pt2 lineiterator connectivity)
(packages/opencv/utilities.lsh)




8.4.2.40.2. (cvsampleline array pt1 pt2 buffer connectivity)
(packages/opencv/utilities.lsh)




8.4.2.40.3. (cvgetrectsubpix src dst center)
(packages/opencv/utilities.lsh)




8.4.2.40.4. (cvgetquadranglesubpix src dstarr matrixarr filloutliers fillvalue)
(packages/opencv/utilities.lsh)




8.4.2.40.5. (cvcvtpixtoplane src dst0 dst1 dst2 dst3)
(packages/opencv/utilities.lsh)




8.4.2.40.6. (cvcvtplanetopix src0 src1 src2 src3 dst)
(packages/opencv/utilities.lsh)




8.4.2.40.7. (cvconvertscale src dst scale shift)
(packages/opencv/utilities.lsh)




8.4.2.40.8. (cvcvtscale src dst scale shift)
(packages/opencv/utilities.lsh)




8.4.2.40.9. (cvscale src dst scale shift)
(packages/opencv/utilities.lsh)




8.4.2.40.10. (cvconvertscaleabs src dst scale shift)
(packages/opencv/utilities.lsh)




8.4.2.40.11. (cvcvtscaleabs src dst scale shift)
(packages/opencv/utilities.lsh)




8.4.2.40.12. (cvabsdiff srca srcb dst)
(packages/opencv/utilities.lsh)




8.4.2.40.13. (cvabsdiffs src dst value)
(packages/opencv/utilities.lsh)




8.4.2.40.14. (cvmatchtemplate array templ result method)
(packages/opencv/utilities.lsh)




8.4.2.40.15. (cvbfastarctan y x angle len)
(packages/opencv/utilities.lsh)




8.4.2.40.16. (cvbcarttopolar y x magnitude angle len)
(packages/opencv/utilities.lsh)




8.4.2.40.17. (cvbsqrt x sqrtx len)
(packages/opencv/utilities.lsh)




8.4.2.40.18. (cvcheckarr arr flags minval maxval)
(packages/opencv/utilities.lsh)




8.4.2.40.19. (cvbinvsqrt x invsqrtx len)
(packages/opencv/utilities.lsh)




8.4.2.40.20. (cvbreciprocal x invx len)
(packages/opencv/utilities.lsh)




8.4.2.40.21. (cvbfastexp x expx len)
(packages/opencv/utilities.lsh)




8.4.2.40.22. (cvbfastlog x logx len)
(packages/opencv/utilities.lsh)




8.4.2.40.23. (cvrandinit state lower upper seed)
(packages/opencv/utilities.lsh)




8.4.2.40.24. (cvrandsetrange state lower upper index)
(packages/opencv/utilities.lsh)




8.4.2.40.25. (cvbrand state dst len)
(packages/opencv/utilities.lsh)




8.4.2.40.26. (cvrand state arr)
(packages/opencv/utilities.lsh)




8.4.2.40.27. (cvrandnext state)
(packages/opencv/utilities.lsh)


********************************************************

8.4.2.40.27.0. (cvInitLineIterator array pt1 pt2 lineiterator connectivity)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvInitLineIterator
 //    Purpose:
 //      Initializes iterator that gets all the pixels, lying on the raster line between
 //      two given points
 //    Context:
 //    Parameters:
 //        img  - image.
 //        pt1  - starting point
 //        pt2  - ending point. Both points must be inside the image
 //        lineIterator - pointer to initialized iterator state
 //    Returns:
 //        number of pixels between pt1 and pt2.
 //        It is equal to max( abs(pt1.x - pt2.x), abs(pt1.y - pt2.y))
 //F*/
 OPENCVAPI  int  cvInitLineIterator( const CvArr* array, CvPoint pt1, CvPoint pt2,
                                     CvLineIterator* lineIterator,
                                     int connectivity CV_DEFAULT(8));


8.4.2.40.27.1. (cvSampleLine array pt1 pt2 buffer connectivity)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvSampleLine
 //    Purpose:
 //      Fetch all the pixel, lying on the raster line between two given points and
 //      writes them to the buffer
 //    Context:
 //    Parameters:
 //        img  - image.
 //        pt1  - starting point
 //        pt2  - ending point. Both points must be inside the image
 //        buffer - pointer to destination buffer.
 //    Returns:
 //        number of pixels stored.
 //        It is equal to max( abs(pt1.x - pt2.x), abs(pt1.y - pt2.y))
 //F*/
 OPENCVAPI  int  cvSampleLine( const CvArr* array, CvPoint pt1, CvPoint pt2, void* buffer,
                               int connectivity CV_DEFAULT(8));


8.4.2.40.27.2. (cvGetRectSubPix src dst center)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvGetRectSubPix
 //    Purpose:
 //      Retrieves rectangle from the image with sub-pixel accuracy
 //    Context:
 //    Parameters:
 //        src  - source image.
 //        dst  - destination image.
 //        center - center point of the extracted rectangle.
 //                 Size of extracted rectangle is equal to
 //                 desination image ROI size.
 //    Returns:
 //F*/
 OPENCVAPI  void  cvGetRectSubPix( const CvArr* src, CvArr* dst, CvPoint2D32f center );


8.4.2.40.27.3. (cvGetQuadrangleSubPix src dstarr matrix)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvGetQuandrangleSubPix
 //    Purpose:
 //      Retrieves rectangle from the image with sub-pixel accuracy
 //    Context:
 //    Parameters:
 //        src  - source image.
 //        dst  - destination image.
 //        matrix - transformation matrix (2 rows x 3 columns).
 //                 ( a11  a12 | b1 )      dst([x,y]') = src(A[x y]' + b)
 //                 ( a21  a22 | b2 )      (bilinear interpolation is used)
 //    Returns:
 //F*/
 OPENCVAPI  void  cvGetQuadrangleSubPix( const CvArr* src, CvArr* dstarr,
                                         const CvArr* matrixarr)


8.4.2.40.27.4. (cvCvtPixToPlane src dst0 dst1 dst2 dst3)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvCvtPixToPlane
 //    Purpose:
 //      Splits source image into several separate planes
 //    Context:
 //    Parameters:
 //        src  - source image. Must have 3 or 4 channels.
 //        dst0, dst1, dst2, dst3  - destination images. Must have single channel.
 //               if src has 3 channels, dst3 must be NULL.
 //               if one of the destination images is not NULL,
 //               the corresponding channel is extracted from source image.
 //               Else, all 3 or 4 images must be non NULL and all the source image
 //               channels are written to destination images.
 //    Returns:
 //F*/
 OPENCVAPI  void  cvCvtPixToPlane( const void *src, void *dst0, void *dst1,
                                   void *dst2, void *dst3 );


8.4.2.40.27.5. (cvCvtPlaneToPix src0 src1 src2 src3 dst)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvCvtPlaneToPix
 //    Purpose:
 //      Composes destination image from separate single-channel images
 //    Context:
 //    Parameters:
 //        src0, src1, src2, src3  - source images. Must have single channel.
 //              if destination image has 3 channels, src3 must be NULL, else must be
 //              non NULL. Other images must always be non NULL.
 //        dst - destination image. Must have 3 or 4 channels.
 //    Returns:
 //F*/
 OPENCVAPI  void  cvCvtPlaneToPix( const void *src0, const void *src1,
                                   const void *src2, const void *src3,
                                   void *dst );


8.4.2.40.27.6. (cvConvertScale src dst scale shift)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvConvertScale
 //    Purpose:
 //      Converts image from one depth to another with linear transform
 //    Context:
 //    Parameters:
 //        src - source image.
 //        dst - destination image.
 //        scale - multiplier
 //        shift - delta. That is, dst(x,y) = src(x,y)*scale + shift.
 //    Returns:
 //    Notes:
 //        only float->uchar and uchar->float are supported by now.
 //F*/
 OPENCVAPI  void  cvConvertScale( const CvArr *src, CvArr *dst,
                                  double scale CV_DEFAULT(1),
                                  double shift CV_DEFAULT(0) );


8.4.2.40.27.7. (cvConvertScaleAbs src dst scale shift)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvConvertScaleAbs
 //    Purpose:
 //      Converts image from one depth to another
 //    Context:
 //    Parameters:
 //        src - source image.
 //        dst - destination image.
 //        scale - multiplier
 //        shift - delta. That is, dst(x,y) = abs(src(x,y)*scale + shift).
 //    Returns:
 //    Notes:
 //F*/
 OPENCVAPI  void  cvConvertScaleAbs( const void *src, void *dst,
                                     double scale CV_DEFAULT(1),
                                     double shift CV_DEFAULT(0) );


8.4.2.40.27.8. (cvAbsDiff srca srcb dst)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvAbsDiff
 //    Purpose:
 //      Finds per-pixel absolute difference between two images
 //    Context:
 //    Parameters:
 //        srcA - first source image.
 //        srcB - second source image
 //        dst  - destination image, May be equal to srcA or srcB
 //    Returns:
 //F*/
 OPENCVAPI  void  cvAbsDiff( const CvArr* srcA, const CvArr* srcB, CvArr* dst );


8.4.2.40.27.9. (cvAbsDiffS src dst value)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvAbsDiffS
 //    Purpose:
 //      Finds per-pixel absolute difference between image and scalar value
 //    Context:
 //    Parameters:
 //        src - source image.
 //        dst - destination image, May be equal to srcA or srcB
 //        value - scalar value to compare with
 //    Returns:
 //F*/
 OPENCVAPI  void  cvAbsDiffS( const CvArr* src, CvArr* dst, CvScalar value );


8.4.2.40.27.10. (cvMatchTemplate array templ result method)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name: cvMatchTemplate
 //    Purpose:
 //      measures similarity between template and overlapped windows in the source image
 //      and fills the resultant image with the measurements.
 //    Context:
 //    Parameters:
 //      img     - source image
 //      templ   - template to find
 //      result  - resultant image. its ROI must have size:
 //                     (img_width - templ_width + 1, img_height - templ_height + 1)
 //      method  - comparison method:
 //---------------------------------------------------------------------------------------
 //             CV_TM_SQDIFF:  res0(i,j)=sum(y=0,TH-1) sum(x=0,TW-1)[I(i+x,j+y)-T(x,y)]^2
 //                    (where  TW - template width, TH - template height
 //                          res0(i,j) - pixel value of result at location(i,j)
 //                                     (zero-th method)
 //                          Iij(x,y) - pixel value of source image at location(i+x,j+y)
 //                                     Iij alone means window of source image
 //                                     with top-left corner(i,j) and template size.
 //                          T(x,y) - pixel value of template at location(x,y)
 //                                   T alone means template.
 //---------------------------------------------------------------------------------------
 //             CV_TM_SQDIFF_NORMED:  res1(i,j) = res0(i,j)/
 //                                             (l2_norm(Iij)*l2_norm(templ);
 //                      where  l2_norm(A) = sqrt(
 //                                     sum(y=0,A_height-1) sum(x=0,A_width-1) A(x,y)^2);
 //---------------------------------------------------------------------------------------
 //             CV_TM_CCORR:  res2(i,j)=sum(y=0,TH-1) sum(x=0,TW-1)[Iij(x,y)*T(x,y)]
 //---------------------------------------------------------------------------------------
 //             CV_TM_CCORR_NORMED:  res3(i,j) = res2(i,j)/[l2_norm(Iij)*l2_norm(templ)];
 //---------------------------------------------------------------------------------------
 //             CV_TM_CCOEFF:  res4(i,j)=sum(y=0,TH-1) sum(x=0,TW-1) [I'ij(x,y)*T'(x,y)]
 //                   where A'(x,y) = A(x,y)-1/(A_width*A_height)*
 //                                   sum(l=0,A_height-1) sum(k=0,A_width-1)A(k,l)
 //---------------------------------------------------------------------------------------
 //             CV_TM_CCOEFF_NORMED:
 //                   res5(i,j)=res4(i,j)/[l2_norm(I'ij)*l2_norm(T')]
 //---------------------------------------------------------------------------------------
 //    Returns:
 //F*/
 /* method for comparing two images */


8.4.2.40.27.11. (cvbFastArctan y x angle len)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvbFastArctan
 //    Purpose:
 //      Calculates arctangent for arrays of abscissas and ordinates
 //    Context:
 //    Parameters:
 //        y - array of abscissas
 //        x - array of ordinates
 //        angle - array of results: array[i] = arctan(y[i]/x[i])
 //        len - number of elements in arrays
 //    Returns:
 //    Notes:
 //      The function takes into account signs of both argument, so it is similar
 //      to atan2, but it returns angle in degrees(from 0 to 359.999 degrees)
 //      Maximal error is ~0.1 degreee.
 //F*/
 OPENCVAPI  void  cvbFastArctan( const float* y, const float* x, float* angle, int len );


8.4.2.40.27.12. (cvbCartToPolar y x magnitude angle len)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvbCartToPolar
 //    Purpose:
 //      Converts input arrays of abscissas and ordinates to polar form
 //    Context:
 //    Parameters:
 //        y - array of abscissas
 //        x - array of ordinates
 //        magnitude - array of magnitudes: mag[i] = sqrt(y[i]*y[i] + x[i]*x[i])
 //        angle - array of angles: array[i] = arctan(y[i]/x[i])
 //        len - number of elements in arrays
 //    Returns:
 //    Notes:
 //      The function calculates angle(similar to cvbFastArctan) and magnitude for
 //      every 2D vector(x[i],y[i]). Both output arguments are optional. If some
 //      output parameter is absent, corresponding part is not calculated
 //F*/
 OPENCVAPI  void  cvbCartToPolar( const float* y, const float* x,
                                 float* magnitude, float* angle, int len );


8.4.2.40.27.13. (cvbSqrt x sqrtx len)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvbSqrt
 //    Purpose:
 //      Calculates square root for array of floats
 //    Context:
 //    Parameters:
 //        x - array of arguments
 //        sqrt_x - array of results
 //        len - number of elements in arrays
 //    Returns:
 //    Notes:
 //      Elements of input array must be non-negative, else the result is not defined.
 //      Maximal relative error is ~3e-7
 //F*/
 OPENCVAPI  void  cvbSqrt( const float* x, float* sqrt_x, int len );


8.4.2.40.27.14. (cvCheckArr arr flags minval maxval)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvCheckArr
 //    Purpose:
 //      Checks array for bad elements (NaNs, Infinities or just too big
 //                                     positive or negative values)
 //    Context:
 //    Parameters:
 //      arr - input array
 //      flags - operation flags, that may be zero or combination of the following values:
 //               CV_CHECK_RANGE - the function checks that the array elements are
 //                                within [minVal,maxVal) range. By default, only NaNs
 //                                and Infinities are checked.
 //               CV_CHECK_QUIET - do not raise error if some elements is out of
 //                                range. It is not a default mode.
 //    Returns:
 //      1 if array is ok, 0 otherwise. If CV_CHECK_QUIET is not set, function
 //      raises the CV_StsOutOfRange error in the latter case.
 //F*/


8.4.2.40.27.15. (cvbInvSqrt x invsqrtx len)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvbInvSqrt
 //    Purpose:
 //      Calculates inverse square root for array of floats
 //    Context:
 //    Parameters:
 //        x - array of arguments
 //        sqrt_x - array of results
 //        len - number of elements in arrays
 //    Returns:
 //    Notes:
 //      Elements of input array must be positive, else the result is not defined.
 //      Maximal relative error is ~2e-7
 //F*/
 OPENCVAPI  void  cvbInvSqrt( const float* x, float* inv_sqrt_x, int len );


8.4.2.40.27.16. (cvbReciprocal x invx len)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvbReciprocal
 //    Purpose:
 //      Calculates inverse value(1/x) for array of floats
 //    Context:
 //    Parameters:
 //        x - array of arguments
 //        inv_x - array of results
 //        len - number of elements in arrays
 //    Returns:
 //    Notes:
 //      For zero elements result is 0.
 //      Maximal relative error is <2e-7
 //F*/
 OPENCVAPI  void  cvbReciprocal( const float* x, float* inv_x, int len );


8.4.2.40.27.17. (cvbFastExp x expx len)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvbFastExp
 //    Purpose:
 //      Calculates fast exponent approximation for array of floats
 //    Context:
 //    Parameters:
 //        x - array of arguments
 //        exp_x - array of results
 //        len - number of elements in arrays
 //    Returns:
 //    Notes:
 //      Overflow is not handled yet. Underflow is handled.
 //      Maximal relative error is ~7e-6
 //F*/
 OPENCVAPI  void  cvbFastExp( const float* x, double* exp_x, int len );


8.4.2.40.27.18. (cvbFastLog x logx len)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvbFastLog
 //    Purpose:
 //      Calculates fast logarithm approximation for array of doubles
 //    Context:
 //    Parameters:
 //        x - array of arguments
 //        log_x - array of logarithms of absolute values of arguments
 //        len - number of elements in arrays
 //    Returns:
 //    Notes:
 //      Negative values are negated before logarithm is taken.
 //      Logarithm of 0 gives large negative number(~700)
 //      Maximal relative error is ~3e-7
 //F*/
 OPENCVAPI  void  cvbFastLog( const double* x, float* log_x, int len );


8.4.2.40.27.19. (cvRandInit state lower upper seed)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvRandInit
 //    Purpose:
 //      Initializes random number generator(RNG)
 //    Context:
 //    Parameters:
 //      state - pointer to initialized RNG state
 //      lower - lower bound of random values
 //      upper - upper bound of random values.
 //              Generated random numbers belong to range [lower,upper)
 //      seed  - initializing 32-bit integer for RNG
 //    Returns:
 //F*/
 OPENCVAPI  void  cvRandInit( CvRandState* state, double lower, double upper, int seed );


8.4.2.40.27.20. (cvRandSetRange state lower upper index)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //    Name:    cvRandSetRange
 //    Purpose: sets range of generated random numbers without reinitializing RNG
 //    Context:
 //    Parameters:
 //      state - pointer to state structure
 //      lower - lower bound
 //      upper - upper bound
 //      dim  - optional parameter.
 //             Index of the dimension to set the range for (0th, 1st etc.)
 //             -1 means to set the same range for all dimensions.
 //    Returns:
 //      CV_OK or error code if:
 //         state pointer is zero or
 //         lower bound greater than upper bound.
 //    Notes:
 //F*/
 OPENCVAPI  void  cvRandSetRange( CvRandState* state, double lower, double upper,
                                  int index CV_DEFAULT(-1));


8.4.2.40.27.21. (cvbRand state dst len)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvbRand
 //    Purpose:
 //      Fills array of floats with random numbers and updates RNG state
 //    Context:
 //    Parameters:
 //      state - RNG state
 //      dst   - destination floating-point array
 //      len   - number of elements in the array.
 //    Returns:
 //F*/
 OPENCVAPI  void  cvbRand( CvRandState* state, float* dst, int len );


8.4.2.40.27.22. (cvRand state arr)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvRand
 //    Purpose:
 //      Fills an array with random numbers and updates RNG state
 //    Context:
 //    Parameters:
 //      state - RNG state
 //      arr   - the destination array
 //    Returns:
 //F*/
 OPENCVAPI  void  cvRand( CvRandState* state, CvArr* arr );


8.4.2.40.27.23. (cvRandNext state)
(packages/opencv/utilities.lsh)


 /*F///////////////////////////////////////////////////////////////////////////////////////
 //
 //    Name:    cvRandNext
 //    Purpose:
 //      Updates RNG state and returns 32-bit random number
 //    Context:
 //    Parameters:
 //      state - RNG state
 //    Returns:
 //      random number
 //F*/
 OPENCVAPI  unsigned  cvRandNext( CvRandState* state );