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

📄 opencv.pas

📁 Delphi版本的OpenCV头文件库(以及诸多实例)
💻 PAS
📖 第 1 页 / 共 4 页
字号:
          total : longint;
          elem_size : longint;
          block_max : Pchar;
          ptr : Pchar;
          delta_elems : longint;
          storage : PCvMemStorage;
          free_blocks : PCvSeqBlock;
          first : PCvSeqBlock;
       end;

{************************************ CvScalar **************************************** }

     CvScalar = record
          val : array[0..3] of double;
       end;
{************************************** CvRect **************************************** }
    PCvContour = ^CvContour;
    CvContour = record
    //---- Seq
      flags : integer;
      header_size : integer;
      h_prev : PCvContour;
      h_next : PCvContour;
      v_prev : PCvContour;
      v_next : PCvContour;
      // CV_SEQUENCE_FIELDS
      total : longint;
      elem_size : longint;
      block_max : Pchar;
      ptr : Pchar;
      delta_elems : longint;
      storage : PCvMemStorage;
      free_blocks : PCvSeqBlock;
      first : PCvSeqBlock;
      //CV_SEQUENCE_FIELDS
      rect : CvRect ;
      color : integer;
      reserved : array [0..2] of integer;
    end;
  type

  {*************************** Connected Component  ************************************* }
  { area of the connected component   }
  { average color of the connected component  }
  { ROI of the component   }
  { optional component boundary
           (the contour might have child contours corresponding to the holes) }

     CvConnectedComp = record
          area : double;
          value : CvScalar;
          rect : CvRect;
          contour : PCvSeq;
       end;
     PCvConnectedComp = ^CvConnectedComp;
{****************************** CvPoint and variants ********************************** }
  type

     pCvPoint = ^CvPoint;
     CvPoint = record
          x : longint ;
          y : longint;
       end;
 const

  CVPOINT0 : CvPoint =
      (
        x : 0;
        y : 0;      ) ;

  type
     CvPoint2D64f = record
          x : double;
          y : double;
       end;

     CvPoint3D64f = record
          x : double;
          y : double;
          z : double;
       end;

     CvSize2D32f = record
          width : float;
          height : float;
       end;
  { center of the box  }
  { box width and length  }
  { angle between the horizontal axis
                               and the first side (i.e. length) in radians  }

     CvBox2D = record
          center : CvPoint2D32f;
          size : CvSize2D32f;
          angle : float;
       end;
     PCvBox2D = ^CvBox2D;
  { Line iterator state  }
  { pointer to the current point  }
  { Bresenham algorithm state  }

     CvLineIterator = record
          ptr : ^uchar;
          err : longint;
          plus_delta : longint;
          minus_delta : longint;
          plus_step : longint;
          minus_step : longint;
       end;


//*********************************** CvTermCriteria *************************************/
Const
 CV_TERMCRIT_ITER = 1;
 CV_TERMCRIT_NUMB = CV_TERMCRIT_ITER;
 CV_TERMCRIT_EPS  = 2;

Type
  CvTrackbarCallback = procedure(pos : integer);

  CvTermCriteria  = Record
                      type_   : integer;  { may be combination of CV_TERMCRIT_ITER, CV_TERMCRIT_EPS }
                      maxIter : integer;
                      epsilon : double;
                    end;
  TCvTermCriteria = CvTermCriteria;
{\*********************************** CvTermCriteria *************************************}

{CVAPI(int) cvCreateTrackbar( const char* trackbar_name, const char* window_name,
                             int* value, int count, CvTrackbarCallback on_change );}
 function   cvCreateTrackbar( trackbar_name : pChar; window_name : pChar;
                              value : pinteger; count : integer; on_change :CvTrackbarCallback) : integer;cdecl;


 procedure  cvCircle( img: PCvArr; center: CvPoint; radius: longint;
                       color: CvScalar; thickness: longint = 1;
                       line_type: longint = 8; shift: longint = 0); cdecl;


 Procedure cvFindExtrinsicCameraParams( numPoints         : integer;
                                        imageSize         : TCvSize;
                                        imagePoints32f    : PCvPoint2D32f;
                                        objectPoints32f   : PCvPoint3D32f;
                                        focalLength32f    : PCvVect32f;
                                        principalPoint32f : TCvPoint2D32f;
                                        distortion32f     : PCvVect32f;
                                        rotVect32f        : PCvVect32f;
                                        transVect32f      : PCvVect32f 
                                        ); cdecl;


{ Calibrates camera using multiple views of calibration pattern }
{
 Procedure  cvCalibrateCamera2( numImages         : Integer;        //int
                               numPoints         : PInteger;       //int*
                               imageSize         : TCvSize;        //CvSize
                               imagePoints32f    : PCvPoint2D32f;  //CvPoint2D32f*
                               objectPoints32f   : PCvPoint3D32f;  //CvPoint3D32f*
                               distortion32f     : PCvVect32f;     //CvVect32f
                               cameraMatrix32f   : PCvMatr32f;     //CvMatr32f
                               transVects32f     : PCvVect32f;     //CvVect32f
                               rotMatrs32f       : PCvMatr32f;     //CvMatr32f
                               useIntrinsicGuess : Integer         //int
                               ); cdecl;
    }

 procedure  cvLine( img : pCvArr;  pt1, pt2 : CvPoint;
                    color : CvScalar; thickness:integer;line_type : integer = 8; shift :integer = 0);cdecl;

 Procedure cvRodrigues( rotMatrix : PCVMAT;
                        rotVector : PCVMAT;
                        jacobian  : PCVMAT;
                        convType  : Integer ); cdecl ;


                       
 { Allocates array data }
 Procedure cvCreateData(var arr : PCvArr ); cdecl;
 { Releases array data  }
 Procedure cvReleaseData(arr : Pointer ); cdecl;

{ /* Allocates and initalizes CvMat header */
CVAPI(CvMat*)  cvCreateMatHeader( int rows, int cols, int type );}
  function  cvCreateMatHeader(rows,cols,atype : integer ) : pCvMat ;cdecl;



 Function  cvInvert( const A : PCvArr; B : PCvArr; method : integer ) : double; cdecl;
 Function  cvPseudoInverse( const src : PCvArr; dst : PCvArr ) : double;

 Procedure cvMatMulAdd( const  A,B,C : PCvArr;  D : PCvArr ); cdecl;
 Procedure cvMatMul( A,B,D : PCvArr );


 Function  cvMat_( rows, cols, type_: Integer; data : Pointer ):TCvMat;
 Function  cvmGet( const mat : PCvMat; i, j : integer): Single;
 Procedure cvmSet( mat : PCvMat; i, j : integer; val: Single);

 Function  cvSize_( width, height : integer ) : TcvSize;
 { load image from file
   iscolor: >0 - output image is always color,
             0 - output image is always grayscale,
            <0 - output image is color or grayscale dependending on the file }
 Function  cvLoadImage( const filename : PChar; iscolor : integer=1) : PIplImage; cdecl;
 Function  cvSaveImage( const filename : PChar; const image : Pointer) : integer; cdecl;

   { Finds a sparse set of points within the selected region
   that seem to be easy to track }
 procedure  cvGoodFeaturesToTrack( image: PCvArr;
                                   eig_image: PCvArr;
                                   temp_image: PCvArr;
                                   corners: PCvPoint2D32f;
                                   corner_count: PINT;
                                   quality_level: Double;
                                   min_distance: double;
                                   mask: PCvArr = nil;
                                   block_size: longint = 3;
                                   use_harris: longint = 0;
                                   k: double = 0.04 ); cdecl;

{ It is Lucas & Kanade method, modified to use pyramids.
   Also it does several iterations to get optical flow for
   every point at every pyramid level.
   Calculates optical flow between two images for certain set of points (i.e.
   it is a "sparse" optical flow, which is opposite to the previous 3 methods) }
 procedure  cvCalcOpticalFlowPyrLK( prev: PCvArr;
                                    curr: PCvArr;
                                     prev_pyr: PCvArr;
                                     curr_pyr: PCvArr;
                                     prev_features: PCvPoint2D32f;
                                     curr_features: PCvPoint2D32f;
                                     count: longint;
                                     win_size: CvSize;
                                     level: longint;
                                     status: pchar;
                                     track_error: PSingle;
                                     criteria: CvTermCriteria;
                                     flags: longint );  cdecl;


 {CVAPI(char*)  cvGetSeqElem( const CvSeq* seq, int index ); }
 function   cvGetSeqElem(const seq  : pCvSeq ; index : integer):pchar;cdecl;
 { Allocates and initializes IplImage header }
 Function cvCreateImageHeader( size : TCvSize; depth, channels : integer ) : PIplImage; cdecl;
 { Releases (i.e. deallocates) IPL image header  : void  cvReleaseImageHeader( IplImage** image );}
 Procedure cvReleaseImageHeader( var image : PIplImage ); cdecl;
 { Releases IPL image header and data }
 procedure cvReleaseImage(var image: PIplImage); cdecl;
 { Creates a copy of IPL image (widthStep may differ). }
 Function  cvCloneImage( const image : PIplImage ) : PIplImage; cdecl;


const  CV_HOUGH_STANDARD =0 ;
       CV_HOUGH_PROBABILISTIC = 1 ;
       CV_HOUGH_MULTI_SCALE = 2   ;
       CV_HOUGH_GRADIENT =3;

 { Converts input array from one color space to another. }
 Procedure cvCvtColor( const src : Pointer; dst : Pointer; colorCvtCode : integer );  cdecl;

{ CVAPI(void)  cvThreshold( const CvArr*  src, CvArr*  dst,
                          double  threshold, double  max_value,                           int threshold_type );}

// Types of thresholding
const
 CV_THRESH_BINARY   =   0;  // value = value > threshold ? max_value : 0       */
 CV_THRESH_BINARY_INV = 1;  // value = value > threshold ? 0 : max_value       */
 CV_THRESH_TRUNC   =    2 ; // value = value > threshold ? threshold : value   */
 CV_THRESH_TOZERO  =    3 ; // value = value > threshold ? value : 0           */
 CV_THRESH_TOZERO_INV=  4 ; // value = value > threshold ? 0 : value           */
 CV_THRESH_MASK     =   7 ;
 CV_THRESH_OTSU     =   8 ; // use Otsu algorithm to choose the optimal threshold value;                                 combine the flag with one of the above CV_THRESH_* values */

  procedure cvThreshold( src : pCvArr;   dst : pCvArr ;  threshold,max_value : double; threshold_type  :integer );cdecl;

 { CVAPI(void)  cvCanny( const CvArr* image, CvArr* edges, double threshold1,
                      double threshold2, int  aperture_size CV_DEFAULT(3) ); }
  procedure cvCanny( image : pCvArr;   edges : pCvArr ;  threshold1,threshold2 : double; aperture_Size  :integer = 3);cdecl;

{CVAPI(CvSeq*)  cvHoughLines2( CvArr* image, void* line_storage, int method,
                              double rho, double theta, int threshold,     double param1 CV_DEFAULT(0), double param2 CV_DEFAULT(0));}
  function cvHoughLines2( image : pCvArr;   line_storage : pointer ;  method : integer; rho, theta : double; threshold : integer ;
                           param1 : double = 0; param2 : double =0 ) : PCvSeq;cdecl;

{  CVAPI(void) cvSobel( const CvArr* src, CvArr* dst,
                    int xorder, int yorder,                    int aperture_size CV_DEFAULT(3));}

  procedure cvSobel(const image : PIplImage;   edges : PIplImage ; xOrder, yOrder : longint; aperture_Size  :integer = 3);cdecl;
{ CVAPI(void) cvLaplace( const CvArr* src, CvArr* dst,                      int aperture_size CV_DEFAULT(3) );}
  procedure cvLaplace(const image : PIplImage;   dst : PIplImage ; aperture_Size  :integer = 3);cdecl;

 { Creates new memory storage.
   block_size == 0 means that default, somewhat optimal size, is used (currently, it is 64K). }

 Function  cvCreateMemStorage( block_size : integer ) : PCvMemStorage; cdecl;
 { Releases memory storage. All the children of a parent must be released before
   the parent. A child storage returns all the blocks to parent when it is released  }
 Procedure cvReleaseMemStorage( var storage : PCvMemStorage ); cdecl;


{
   int cvFindContours(IplImage* img, CvMemStorage* storage, CvSeq** firstContour, int headerSize=sizeof(CvContour),
                      CvContourRetrievalMode mode=CV_RETR_LIST,CvChainApproxMethod
                      method=CV_CHAIN_APPROX_SIMPLE);
 }

 { Detects corners on a chess-board - "brand" OpenCV calibration pattern }
 Function  cvFindChessBoardCornerGuesses( const arr          : Pointer;

⌨️ 快捷键说明

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