📄 opencv.pas
字号:
(*********************************************************************
* *
* Borland Delphi 4,5,6,7 API for *
* Intel Open Source Computer Vision Library *
fCvSize2D32f * *
* *
* Portions created by Intel Corporation are *
* Copyright (C) 2000, Intel Corporation, all rights reserved. *
* *
* The original files are: CV.h, CVTypes.h, highgui.h *
* *
* *
* The original Pascal code is: OpenCV.pas, released 29 May 2003. *
* *
* The initial developer of the Pascal code is Vladimir Vasilyev *
* home page : http://www.nextnow.com *
* email : Vladimir@nextnow.com *
* W-develop@mtu-net.ru *
* *
* Contributors: Andrey Klimov *
*********************************************************************
* Expanded version to use CAMShift functions *
* G. De Sanctis - 9/2005 *
* *
*********************************************************************
* *
* *
* The contents of this file are used with permission, subject to *
* the Mozilla Public License Version 1.1 (the "License"); you may *
* not use this file except in compliance with the License. You may *
* obtain a copy of the License at *
* http://www.mozilla.org/MPL/MPL-1.1.html *
* *
* Software distributed under the License is distributed on an *
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or *
* implied. See the License for the specific language governing *
* rights and limitations under the License. *
* *
*********************************************************************)
unit OpenCV;
{$A+,Z+}
{$ASSERTIONS on}
interface
uses
Windows,Sysutils,Math,Graphics, IPL;
const
cvDLL = 'CV100.DLL';
HighGUI_DLL='highgui100.dll';
cxCore = 'CXCORE100.DLL';
IPL_DEPTH_SIGN = $80000000 ;
CV_PI = PI;
IPL_DEPTH_1U = 1 ;
IPL_DEPTH_8U = 8 ;
IPL_DEPTH_16U = 16 ;
IPL_DEPTH_32F = 32 ;
IPL_DEPTH_8S = (IPL_DEPTH_SIGN or 8) ;
IPL_DEPTH_16S= (IPL_DEPTH_SIGN or 16);
IPL_DEPTH_32S =(IPL_DEPTH_SIGN or 32);
IPL_DATA_ORDER_PIXEL= 0;
IPL_DATA_ORDER_PLANE = 1;
IPL_ORIGIN_TL= 0 ;
IPL_ORIGIN_BL= 1 ;
IPL_ALIGN_4BYTES= 4;
IPL_ALIGN_8BYTES= 8 ;
IPL_ALIGN_16BYTES= 16 ;
IPL_ALIGN_32BYTES= 32 ;
IPL_ALIGN_DWORD = IPL_ALIGN_4BYTES;
IPL_ALIGN_QWORD = IPL_ALIGN_8BYTES;
IPL_BORDER_CONSTANT= 0 ;
IPL_BORDER_REPLICATE= 1 ;
IPL_BORDER_REFLECT = 2 ;
IPL_BORDER_WRAP = 3;
CV_32F = 4;
CV_32FC1 = CV_32F + 0*8;
CV_MAT_TYPE_MASK = 31;
CV_MAT_MAGIC_VAL = $42420000;
CV_MAT_CONT_FLAG_SHIFT = 9;
CV_MAT_CONT_FLAG = 1 shl CV_MAT_CONT_FLAG_SHIFT;
CV_MAT_CN_MASK = 3 shl 3;
CV_MAT_DEPTH_MASK = 7;
CV_RODRIGUES_M2V = 0;
CV_RODRIGUES_V2M = 1;
CV_LU = 0;
CV_SVD = 1;
CV_BGR2Gray = 6;
CV_RGB2GRAY = 7;
CV_BGR2HSV = 40;
CV_GRAY2BGR = 8;
CV_FILLED = -(1);
CV_AA = 16;
CV_LKFLOW_PYR_A_READY = 1;
CV_LKFLOW_PYR_B_READY = 2;
CV_LKFLOW_INITIAL_GUESSES = 4;
type
CvContourRetrievalMode = ( CV_RETR_EXTERNAL , //retrieves only the extreme outer contours (list);
CV_RETR_LIST, // retrieves all the contours (list);
CV_RETR_CCOMP, // retrieves the two-level hierarchy (list of connected components);
CV_RETR_TREE ); // retrieves the complete hierarchy (tree).
CvChainApproxMethod = (CV_CHAIN_APPROX_SIMPLE,CV_CHAIN_APPROX_NONE);
CvPolyApproxMethod = (CV_POLY_APPROX_DP);
PCvVect32f = PSingle;
TCvVect32fArr=array of Single;
PCvMatr32f = PSingle;
TCvMatr32fArr=array of Single;
TIntegerArr=array of Integer;
CvSize = record
width : integer;
height : integer;
end;
TCvSize = CvSize;
PCvSize = ^TCvSize;
CvPoint2D32f = record
x : Single;
y : Single;
end;
TCvPoint2D32f = CvPoint2D32f;
PCvPoint2D32f = ^TCvPoint2D32f;
TCvPoint2D32fArr=array of TCvPoint2D32f;
CvPoint3D32f = record
x : Single;
y : Single;
z : Single;
end;
TCvPoint3D32f = CvPoint3D32f;
PCvPoint3D32f = ^TCvPoint3D32f;
TCvPoint3D32fArr=array of TCvPoint3D32f;
TMatData = record
ptr: PUCHAR;
end;
CvMat = record
type_ : Integer;
step : Integer;
refcount : PInteger;
data : TMatData;
rows : Integer;
cols : Integer;
end;
TCvMat = CvMat;
PCvMat = ^TCvMat;
{ CvArr* is used to pass arbitrary array-like data structures into the functions where the particular
array type is recognized at runtime }
PCvArr = Pointer;
P2PCvArr = ^PCvArr;
//****************************************************************************************\
//* Multi-dimensional dense array (CvMatND) *
//****************************************************************************************/
const
CV_MATND_MAGIC_VAL = $42430000;
CV_TYPE_NAME_MATND = 'opencv-nd-matrix';
CV_MAX_DIM = 32;
CV_MAX_DIM_HEAP = 1 shl 16;
type
CvMatND = record
_type : longint;
dims : longint;
refcount : ^longint;
data : record
case longint of
0 : ( ptr : ^uchar );
1 : ( fl : ^double );
2 : ( db : ^double );
3 : ( i : ^longint );
4 : ( s : ^smallint );
end;
dim : array[0..(CV_MAX_DIM)-1] of record
size : longint;
step : longint;
end;
end;
{***************************************************************************************\
* Histogram *
\*************************************************************************************** }
type
CvHistType = longint;
const
CV_HIST_MAGIC_VAL = $42450000;
CV_HIST_UNIFORM_FLAG = 1 shl 10;
{ indicates whether bin ranges are set already or not }
CV_HIST_RANGES_FLAG = 1 shl 11;
CV_HIST_ARRAY = 0;
CV_HIST_SPARSE = 1;
CV_HIST_TREE = CV_HIST_SPARSE;
{ should be used as a parameter only,
it turns to CV_HIST_UNIFORM_FLAG of hist->type }
CV_HIST_UNIFORM = 1;
{ for uniform histograms }
{ for non-uniform histograms }
{ embedded matrix header for array histograms }
type
CvHistogram = record
_type : longint;
bins : PCvArr;
thresh : array[0..(CV_MAX_DIM)-1] of array[0..1] of float;
thresh2 : P2Pfloat;
mat : CvMatND;
end;
PCvHistogram = ^CvHistogram;
//******************************** Memory storage ****************************************/
Type
PCvMemBlock = ^TCvMemBlock;
CvMemBlock = Record
prev : PCvMemBlock;
next : PCvMemBlock;
end;
TCvMemBlock = CvMemBlock;
Const CV_STORAGE_MAGIC_VAL = $42890000;
Type
PCvMemStorage = ^TCvMemStorage;
CvMemStorage = Record
signature : integer;
bottom : PCvMemBlock; //* first allocated block */
top : PCvMemBlock; //* current memory block - top of the stack */
parent : PCvMemStorage; //* borrows new blocks from */
block_size: integer; //* block size */
free_space: integer; //* free space in the current block */
end;
TCvMemStorage = CvMemStorage;
{********************************** Sequence ****************************************** }
{ previous sequence block }
{ next sequence block }
{ index of the first element in the block +
sequence->first->start_index }
{ number of elements in the block }
{ pointer to the first element of the block }
type
PCvSeqBlock = ^CvSeqBlock;
CvSeqBlock = record
prev : PCvSeqBlock;
next : PCvSeqBlock;
start_index : longint;
count : longint;
data : Pchar;
end;
PCvSeq = ^CvSeq;
pcvTreeNodeType = ^cvTreeNodeType;
cvTreeNodeType = record
flags : integer; //* micsellaneous flags */ \
header_size : integer; //* size of sequence header */ \
h_prev: pcvTreeNodeType; //* previous sequence */ \
h_next: pcvTreeNodeType; //* next sequence */ \
v_prev: pcvTreeNodeType; //* 2nd previous sequence */ \
v_next: pcvTreeNodeType;
end; // 2nd next sequence */
CvRect = record
x : integer;
y : integer;
width : integer;
height : integer;
end;
CvSeq = record
flags : longint;
header_size : longint;
h_prev : PCvSeq;
h_next : PCvSeq;
v_prev : PCvSeq;
v_next : PCvSeq;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -