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

📄 ipl.pas

📁 Delphi版本的OpenCV头文件库(以及诸多实例)
💻 PAS
📖 第 1 页 / 共 4 页
字号:
(*
               INTEL CORPORATION PROPRIETARY INFORMATION
This software is supplied under the terms of a license agreement or
nondisclosure agreement with Intel Corporation and may not be copied
or disclosed except in accordance with the terms of that agreement.
  Copyright (c) 1998-2000 Intel Corporation. All Rights Reserved.

From:
Purpose: IPL Common Header file
*)

unit IPL;

{$A+,Z+}

interface

uses
  Windows;

type
  Float  = Single;
  PFloatArray = array of Float;
  PFloat = ^Float;
  P2PFloat = ^PFloat;

  Short  = SmallInt;
  PShort = ^Short;

  PDouble = ^Double;
  P2PDouble = ^PDouble;

  IPLStatus = Integer;

{---------------------------  Library Version  ----------------------------}
type
  PIPLLibVersion = ^TIPLLibVersion;
  TIPLLibVersion = record
    Major           : Integer;       // e.g. 1
    Minor           : Integer;       // e.g. 00
    Build           : Integer;       // e.g. 01
    Name            : PChar;         // e.g. "ipl6l.lib","iplm5.dll"
    Version         : PChar;         // e.g. "v1.00"
    InternalVersion : PChar;         // e.g. "[1.00.01, 07/25/96]"
    BuildDate       : PChar;         // e.g. "Jun 1 96"
    CallConv        : PChar;         // e.g. "DLL"
  end;

function iplGetLibVersion : PIPLLibVersion; stdcall;
{
Returns:    the structure of information about  version of IPL library
}

{==========================================================================
      Section: Error Handling Functions
 ==========================================================================}

{------------------------  Error Call definition  -------------------------}

type
  TIPLErrorCallBack = function(
    Status : IPLStatus;
    FuncName : PChar;
    Context  : PChar;
    FileName : PChar;
    Line     : Integer) : IplStatus; stdcall;

{----------------------  IPLErrStatus Declaration  ------------------------}

const
  _StsMaskImg_              = (-100);

  IPL_StsOk                 =  0;  // everithing is ok
  IPL_StsBackTrace          = -1;  // pseudo error for back trace
  IPL_StsError              = -2;  // unknown /uiplecified error
  IPL_StsInternal           = -3;  // internal error (bad state)
  IPL_StsNoMem              = -4;  // insufficient memory
  IPL_StsBadArg             = -5;  // function arg/param is bad
  IPL_StsBadFunc            = -6;  // unsupported function
  IPL_StsNoConv             = -7;  // iter. didn't converge
  IPL_StsAutoTrace          = -8;  // Tracing through ipltrace.h

  IPL_HeaderIsNull          = -9;  // image header is NULL
  IPL_BadImageSize          = -10; // Image size is invalid
  IPL_BadOffset             = -11; // Offset is invalid
  IPL_BadDataPtr            = -12; // Image must be tiled or must have
                                   // nonzero data pointer
  IPL_BadStep               = -13;
  IPL_BadModelOrChSeq       = -14;
  IPL_BadNumChannels        = -15;
  IPL_BadNumChannel1U       = -16;
  IPL_BadDepth              = -17;
  IPL_BadAlphaChannel       = -18;
  IPL_BadOrder              = -19;
  IPL_BadOrigin             = -20;
  IPL_BadAlign              = -21;
  IPL_BadCallBack           = -22;
  IPL_BadTileSize           = -23;
  IPL_BadCOI                = -24;
  IPL_BadROISize            = -25;

  IPL_MaskIsTiled           = -26;

  IPL_StsNullPtr                = -27; // Null pointer
  IPL_StsVecLengthErr           = -28; // Incorrect vector length
  IPL_StsFilterStructContentErr = -29; // Incorr. filter structure content
  IPL_StsKernelStructContentErr = -30; // Incorr. transform kernel content
  IPL_StsFilterOffsetErr        = -31; // Incorrect filter ofset value

  IPL_MaskBadImageSize      = IPL_BadImageSize    + _StsMaskImg_;
  IPL_MaskBadOffset         = IPL_BadOffset       + _StsMaskImg_;
  IPL_MaskBadDataPtr        = IPL_BadDataPtr      + _StsMaskImg_;
  IPL_MaskBadStep           = IPL_BadStep         + _StsMaskImg_;
  IPL_MaskBadModelOrChSeq   = IPL_BadModelOrChSeq + _StsMaskImg_;
  IPL_MaskBadNumChannels    = IPL_BadNumChannels  + _StsMaskImg_;
  IPL_MaskBadDepth          = IPL_BadDepth        + _StsMaskImg_;
  IPL_MaskBadAlphaChannel   = IPL_BadAlphaChannel + _StsMaskImg_;
  IPL_MaskBadOrder          = IPL_BadOrder        + _StsMaskImg_;
  IPL_MaskBadOrigin         = IPL_BadOrigin       + _StsMaskImg_;
  IPL_MaskBadAlign          = IPL_BadAlign        + _StsMaskImg_;
  IPL_MaskBadCOI            = IPL_BadCOI          + _StsMaskImg_;
  IPL_MaskBadROISize        = IPL_BadROISize      + _StsMaskImg_;

function  iplGetErrStatus        : IPLStatus;  stdcall;
{
Purpose:    Gets last error status
}

procedure iplSetErrStatus(Status : IPLStatus); stdcall;
{
Purpose:    Sets error status
}

{----------------------  IPLStdErrMode Declaration  ------------------------}

const
  IPL_ErrModeLeaf   = 0;           // Print error and exit program
  IPL_ErrModeParent = 1;           // Print error and continue
  IPL_ErrModeSilent = 2;           // Don't print and continue

function  iplGetErrMode      : Integer;  stdcall;
procedure iplSetErrMode(Mode : Integer); stdcall;
{
Name:       iplGetErrMode, iplSetErrMode
Purpose:    gets/sets error mode
}

function iplError(Status   : IPLStatus;
                  Func     : PChar;
                  Context  : PChar;
                  FileName : PChar;
                  Line     : Integer) : IPLStatus; stdcall;
{
Purpose:    performs basic error handling
Returns:    last status
}

function iplErrorStr(Status : IPLStatus) : PChar; stdcall;
{
Purpose:    translates an error status code into a textual description
}

function iplRedirectError(
  iplErrorFunc : TIPLErrorCallBack) : TIPLErrorCallBack;  stdcall;
{
Purpose:    assigns a new error-handling function
Returns:    old error-handling function
Parameters: new error-handling function
}

{-----------------  Predefined error-handling functions  ------------------}

{
    Output to:
        iplNulDevReport - nothing
        iplStdErrReport - console (printf)
        iplGuiBoxReport - MessageBox (Win32)
}
function iplNulDevReport(Status   : IPLStatus;
                         FuncName : PChar;
                         Context  : PChar;
                         FileName : PChar;
                         Line     : Integer) : IPLStatus; stdcall;
function iplStdErrReport(Status   : IPLStatus;
                         FuncName : PChar;
                         Context  : PChar;
                         FileName : PChar;
                         Line     : Integer) : IPLStatus; stdcall;
function iplGuiBoxReport(Status   : IPLStatus;
                         FuncName : PChar;
                         Context  : PChar;
                         FileName : PChar;
                         Line     : Integer) : IPLStatus; stdcall;

{==========================================================================
      Section: Memory Allocation Functions
 ==========================================================================}

function  iplMalloc( Len : Integer) : Pointer;  stdcall;
function  iplwMalloc(Len : Integer) : PShort;   stdcall;
function  ipliMalloc(Len : Integer) : PInteger; stdcall;
function  iplsMalloc(Len : Integer) : PFloat;   stdcall;
function  ipldMalloc(Len : Integer) : PDouble;  stdcall;
{
Name:       iplMalloc, iplwMalloc, ipliMalloc, iplsMalloc, ipldMalloc
Purpose:    Allocate memory aligned on 32 bytes
Returns:    a pointer to an aligned memory block or NULL if no memory.
Parameters: Len - size of required memory block in elements.
            For iplMalloc length in bytes, for others a type of an
            element depends on behalf of function (see type of return).

Notes:     The only function to free the memory allocated by any of
           these functions is iplFree().
}

procedure iplFree(   P   : Pointer); stdcall;
{
Purpose:    Frees memory allocated by one of the ipl?Malloc functions.
Notes:      The function iplFree() cannot be used to free memory
            allocated by standard functions like malloc() or calloc().
}

{==========================================================================
      Section: Misc macros and definitions
 ==========================================================================}

function IPL_DegToRad(Deg : Extended) : Extended;
function IPLsDegToRad(Deg : Float)    : Float;
function IPLdDegToRad(Deg : Double)   : Double;

const
  IPL_EPS  = 1.0E-12;
  IPL_PI   = 3.14159265358979324;
  IPL_2PI  = 6.28318530717958648;
  IPL_PI_2 = 1.57079632679489662;
  IPL_PI_4 = 0.785398163397448310;

{----------------------  Code for channel sequence  -----------------------}
const
  IPL_CSEQ_G     = $00000047;      //* "G"    */
  IPL_CSEQ_GRAY  = $59415247;      //* "GRAY" */
  IPL_CSEQ_BGR   = $00524742;      //* "BGR"  */
  IPL_CSEQ_BGRA  = $41524742;      //* "BGRA" */
  IPL_CSEQ_RGB   = $00424752;      //* "RGB"  */
  IPL_CSEQ_RGBA  = $41424752;      //* "RGBA" */

  {==== IPLibrary Definitions ===================================================}
  IPL_DEPTH_SIGN = Integer($80000000);
  IPL_DEPTH_MASK = $7FFFFFFF;

  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_GET_TILE_TO_READ  = 1;
  IPL_GET_TILE_TO_WRITE = 2;
  IPL_RELEASE_TILE      = 4;

  IPL_LUT_LOOKUP = 0;
  IPL_LUT_INTER  = 1;

(*
{==== Code for channel sequence ============================================}
  IPL_CSEQ_G     = $00000047;      //* "G"    */
  IPL_CSEQ_GRAY  = $59415247;      //* "GRAY" */
  IPL_CSEQ_BGR   = $00524742;      //* "BGR"  */
  IPL_CSEQ_BGRA  = $41524742;      //* "BGRA" */
  IPL_CSEQ_RGB   = $00424752;      //* "RGB"  */
  IPL_CSEQ_RGBA  = $41424752;      //* "RGBA" */
*)

{==== Common Types =========================================================}
type
  PIplImage = ^TIplImage; // defined later
  P2PIplImage = ^PIplImage;
  TIplCallBack = procedure(const Img    : PIplImage;
                                 XIndex : Integer;
                                 YIndex : Integer;
                                 Mode   : Integer); stdcall;
{
   Purpose:        Type of functions for access to external manager of tile

⌨️ 快捷键说明

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