(* ImageEn Build 7.0.0.06.2637 @ 7-4-17 14:58:42.679 *) (* Copyright (c) 1998-2017 by Carlotta Calandra. All rights reserved. Copyright (c) 2011-2017 by Xequte Software. This software comes without express or implied warranty. In no case shall the author be liable for any damage or unwanted behavior of any computer hardware and/or software. Author grants you the right to include the component in your application, whether COMMERCIAL, SHAREWARE, or FREEWARE. ImageEn, IEvolution and ImageEn ActiveX may not be included in any commercial, shareware or freeware libraries or components. www.ImageEn.com *) (* File version 1010 *) unit ievision; {$R-} {$Q-} {$Z4} {$I ie.inc} {$ifdef IEVISION} interface uses Types, Windows, SysUtils, Classes, Math, ActiveX; const {!! IEVision Embedded Classifiers Declaration } IEVC_EYE = ':EYE'; IEVC_EYE_TREE_EYE_GLASSES = ':EYETREEEYEGLASSES'; IEVC_FRONTAL_FACE_ALT = ':FRONTALFACEALT'; IEVC_FRONTAL_FACE_ALT_2 = ':FRONTALFACEALT2'; IEVC_FRONTAL_FACE_ALT_TREE = ':FRONTALFACEALTTREE'; IEVC_FRONTAL_FACE_DEFAULT = ':FRONTALFACEDEFAULT'; IEVC_FULL_BODY = ':FULLBODY'; IEVC_LOWER_BODY = ':LOWERBODY'; IEVC_PROFILE_FACE = ':PROFILEFACE'; IEVC_UPPER_BODY = ':UPPERBODY'; IEVC_LEFT_EYE_2_SPLITS = ':LEFTEYE2SPLITS'; IEVC_RIGHT_EYE_2_SPLITS = ':RIGHTEYE2SPLITS'; IEVC_LBP_FRONTAL_FACE = ':LBPFRONTALFACE'; IEVC_CASCADE_SMILE = ':CASCADESMILE'; IEVC_FRONTAL_CAT_FACE = ':FRONTALCATFACE'; IEVC_FRONTAL_CAT_FACE_EXT = ':FRONTALCATFACEEXTENDED'; IEVC_LICENSE_PLATE_RUS = ':LICENSEPLATERUS'; IEVC_RUSSIAN_PLATE_NUMBER = ':RUSSIANPLATENUMBER'; IEVC_ALL_CLASSIFIERS = IEVC_EYE + #13#10 + IEVC_EYE_TREE_EYE_GLASSES + #13#10 + IEVC_FRONTAL_FACE_ALT + #13#10 + IEVC_FRONTAL_FACE_ALT_2 + #13#10 + IEVC_FRONTAL_FACE_ALT_TREE + #13#10 + IEVC_FRONTAL_FACE_DEFAULT + #13#10 + IEVC_FULL_BODY + #13#10 + IEVC_LOWER_BODY + #13#10 + IEVC_PROFILE_FACE + #13#10 + IEVC_UPPER_BODY + #13#10 + IEVC_LEFT_EYE_2_SPLITS + #13#10 + IEVC_RIGHT_EYE_2_SPLITS + #13#10 + IEVC_LBP_FRONTAL_FACE + #13#10 + IEVC_CASCADE_SMILE + #13#10 + IEVC_FRONTAL_CAT_FACE + #13#10 + IEVC_FRONTAL_CAT_FACE_EXT + #13#10 + IEVC_LICENSE_PLATE_RUS + #13#10 + IEVC_RUSSIAN_PLATE_NUMBER ; {!!} type /////////////////////////////////////////////////// // primitive types uint8_t = byte; uint16_t = word; uint32_t = longword; int8_t = shortint; int16_t = smallint; int32_t = integer; int64_t = int64; bool32 = longbool; uint8_p = ^uint8_t; uint16_p = ^uint16_t; uint32_p = ^uint32_t; int8_p = ^int8_t; int16_p = ^int16_t; int32_p = ^int32_t; int64_p = ^int64_t; bool32_p = ^bool32; float_p = ^single; double_p = ^double; /////////////////////////////////////////////////// // enums {$WARNINGS OFF} {!! TIEVisionLibraryInfo Declaration } TIEVisionLibraryInfo = ( ievLIBNAME = 0, ievLIBVERSION = 1, ievLIBPLATFORM = 2, ievLIBFILENAME = 3, ievISTRIAL = 4 ); {!!} {!! TIEVisionChannelFormat Declaration } TIEVisionChannelFormat = ( ievUINT8 = 0, // 8 bit unsigned ievSINT8 = 1, // 8 bit signed ievUINT16 = 2, // 16 bit unsigned ievSINT16 = 3, // 16 bit signed ievSINT32 = 4, // 32 bit signed ievFLOAT32 = 5, // 32 bit floating point ievFLOAT64 = 6, // 64 bit floating point ievUINT1 = $A0000001 // 1 bit per pixel ); {!!} {!! TIEVisionCvtColorCode Declaration } TIEVisionCvtColorCode = ( ievBGR2BGRA = 0, ievRGB2RGBA = 0, ievBGRA2BGR = 1, ievRGBA2RGB = 1, ievBGR2RGBA = 2, ievRGB2BGRA = 2, ievRGBA2BGR = 3, ievBGRA2RGB = 3, ievBGR2RGB = 4, ievRGB2BGR = 4, ievBGRA2RGBA = 5, ievRGBA2BGRA = 5, ievBGR2GRAY = 6, ievRGB2GRAY = 7, ievGRAY2BGR = 8, ievGRAY2RGB = 8, ievGRAY2BGRA = 9, ievGRAY2RGBA = 9, ievBGRA2GRAY = 10, ievRGBA2GRAY = 11, ievBGR2BGR565 = 12, ievRGB2BGR565 = 13, ievBGR5652BGR = 14, ievBGR5652RGB = 15, ievBGRA2BGR565 = 16, ievRGBA2BGR565 = 17, ievBGR5652BGRA = 18, ievBGR5652RGBA = 19, ievGRAY2BGR565 = 20, ievBGR5652GRAY = 21, ievBGR2BGR555 = 22, ievRGB2BGR555 = 23, ievBGR5552BGR = 24, ievBGR5552RGB = 25, ievBGRA2BGR555 = 26, ievRGBA2BGR555 = 27, ievBGR5552BGRA = 28, ievBGR5552RGBA = 29, ievGRAY2BGR555 = 30, ievBGR5552GRAY = 31, ievBGR2XYZ = 32, ievRGB2XYZ = 33, ievXYZ2BGR = 34, ievXYZ2RGB = 35, ievBGR2YCrCb = 36, ievRGB2YCrCb = 37, ievYCrCb2BGR = 38, ievYCrCb2RGB = 39, ievBGR2HSV = 40, ievRGB2HSV = 41, ievRGB2Lab = 45, ievBGR2Lab = 44, ievBayerBG2BGR = 46, ievBayerGB2BGR = 47, ievBayerRG2BGR = 48, ievBayerGR2BGR = 49, ievBayerBG2RGB = 48, ievBayerGB2RGB = 49, ievBayerRG2RGB = 46, ievBayerGR2RGB = 47, ievBGR2Luv = 50, ievRGB2Luv = 51, ievBGR2HLS = 52, ievRGB2HLS = 53, ievHSV2BGR = 54, ievHSV2RGB = 55, ievLab2BGR = 56, ievLab2RGB = 57, ievLuv2BGR = 58, ievLuv2RGB = 59, ievHLS2BGR = 60, ievHLS2RGB = 61 ); {!!} {!! TIEVisionInterpolation Declaration } TIEVisionInterpolation = ( ievNEAREST = 0, ievLINEAR = 1, ievCUBIC = 2, ievAREA = 3, ievLANCZOS4 = 4 ); {!!} {!! TIEVisionFlipMode Declaration } TIEVisionFlipMode = ( ievX_AXIS = 0, // flip X axis ievY_AXIS = 1, // flip Y axis ievXY_AXISES = -1 // flip X and Y axis ); {!!} {!! TIEVisionFileStreamMode Declaration } TIEVisionFileStreamMode = ( ievREAD = 0, // read only ievCREATE = 1, // create file ievREADWRITE = 2 // read and write ); {!!} {!! TIEVisionSeekOffset Declaration } TIEVisionSeekOffset = ( ievSET = 0, // set absolute position ievCUR = 1, // set from current position ievEND = 2 // set from the end ); {!!} {!! TIEVisionFileFormat Declaration } TIEVisionFileFormat = ( ievTIFF = 1, // TIFF ievJPEG = 3, // JPEG ievBMP = 5, // BMP ievPNG = 8, // PNG ievPXM = 12, // PXM ievJ2K = 14, // JPEG2000 ievRAS = 30, // Sun Rasters ievHEX = 100 // ASCII HEX digits, separating planes ); {!!} {!! TIEVisionHaarInvert Declaration } TIEVisionHaarInvert = ( ievNOINVERT = 0, // do not invert samples ievINVERT = 1, // always invert samples ievRANDOM_INVERT = $7FFFFFFF // random invert samples ); {!!} {!! TIEVisionHaarMode Declaration } TIEVisionHaarMode = ( ievBASIC = 0, ievCORE = 1, ievALL = 2 ); {!!} {!! TIEVisionHaarBoostType Declaration } TIEVisionHaarBoostType = ( ievDISCRETE_ADABOOST = 0, ievREAL_ADABOOST = 1, ievLOGITBOOST = 2, ievGENTLE_ADABOOST = 3 ); {!!} {!! TIEVisionHaarStumpError Declaration } TIEVisionHaarStumpError = ( ievMISCLASSIFICATION_ERROR = 0, ievGINI_ERROR = 1, ievENTROPY_ERROR = 2 ); {!!} {!! TIEVisionPropertyTreeFormat Declaration } TIEVisionPropertyTreeFormat = ( ievXML = 0, ievINFO = 1, ievINI = 2, ievJSON = 3 ); {!!} {!! TIEVisionBorderType Declaration } TIEVisionBorderType = ( ievBORDER_CONSTANT = 0, ievBORDER_REPLICATE = 1, ievBORDER_REFLECT = 2, ievBORDER_WRAP = 3, ievBORDER_REFLECT_101 = 4, ievBORDER_TRANSPARENT = 5, ievBORDER_ISOLATED = 16 ); {!!} {!! TIEVisionSmoothType Declaration } TIEVisionSmoothType = ( ievBLUR_NO_SCALE = 0, ievBLUR = 1, ievGAUSSIAN = 2, ievMEDIAN = 3, ievBILATERAL = 4 ); {!!} {!! TIEVisionHistogramType Declaration } TIEVisionHistogramType = ( ievARRAY = 0, ievSPARSE = 1 ); {!!} {!! TIEVisionSortOrder Declaration } TIEVisionSortOrder = ( ievASCENDING = 0, ievDESCENDING = 1 ); {!!} {!! TIEVisionCovarFlags Declaration } TIEVisionCovarFlags = ( ievSCRAMBLED = 0, ievNORMAL = 1, ievUSE_AVG = 2, ievSCALE = 4, ievROWS = 8, ievCOLS = 16 ); {!!} {!! TIEVisionCmpOp Declaration } TIEVisionCmpOp = ( ievEQUAL = 0, ievGREATER = 1, ievGREATER_EQUAL = 2, ievLESS = 3, ievLESS_EQUAL = 4, ievNOT_EQUAL = 5 ); {!!} {!! TIEVisionDCTFlags Declaration } TIEVisionDCTFlags = ( ievDCT_FORWARD = 0, ievDCT_INVERSE = 1, ievDCT_ROWS = 4 ); {!!} {!! TIEVisionDFTFlags Declaration } TIEVisionDFTFlags = ( ievDFT_FORWARD = 0, ievDFT_INVERSE = 1, ievDFT_SCALE = 2, ievDFT_INVERSE_SCALE = 3, ievDFT_ROWS = 4 ); {!!} {!! TIEVisionGEMMFlags Declaration } TIEVisionGEMMFlags = ( ievGEMM_NONE = 0, ievGEMM_A_T = 1, ievGEMM_B_T = 2, ievGEMM_C_T = 4 ); {!!} {!! TIEVisionInvertMethod Declaration } TIEVisionInvertMethod = ( ievLU = 0, ievSVD = 1, ievSVD_SYM = 2 ); {!!} {!! TIEVisionReduceOp Declaration } TIEVisionReduceOp = ( ievREDUCE_SUM = 0, ievREDUCE_AVG = 1, ievREDUCE_MAX = 2, ievREDUCE_MIN = 3 ); {!!} {!! TIEVisionSolveMethod Declaration } TIEVisionSolveMethod = ( ievSOLVE_LU = 0, ievSOLVE_SVD = 1, ievSOLVE_SVD_SYM = 2 ); {!!} {!! TIEVisionSVBFlags Declaration } TIEVisionSVBFlags = ( ievSVB_NONE = 0, ievSVB_MODIFY_A = 1, ievSVB_U_T = 2, ievSVB_V_T = 4 ); {!!} {!! TIEVisionSVDFlags Declaration } TIEVisionSVDFlags = ( ievSVD_NONE = 0, ievSVD_MODIFY_A = 1, ievSVD_U_T = 2, ievSVD_V_T = 4 ); {!!} {!! TIEVisionContourRetrMode Declaration } TIEVisionContourRetrMode = ( ievEXTERNAL = 0, ievLIST = 1, ievCCOMP = 2, ievTREE = 3 ); {!!} {!! TIEVisionContourApproxMethod Declaration } TIEVisionContourApproxMethod = ( ievCHAIN_CODE = 0, ievCHAIN_APPROX_NONE = 1, ievCHAIN_APPROX_SIMPLE = 2, ievCHAIN_APPROX_TC89_L1 = 3, ievCHAIN_APPROX_TC89_KCOS = 4, ievLINK_RUNS = 5 ); {!!} {!! TIEVisionInpaintMethod Declaration } TIEVisionInpaintMethod = ( ievINPAINT_NS = 0, ievINPAINT_TELEA = 1 ); {!!} {!! TIEVisionOCRPageSegmentationMode Declaration } TIEVisionOCRPageSegmentationMode = ( ievOCROSD_ONLY = 0, // Orientation and script detection only. ievOCRAUTO_OSD = 1, // Automatic page segmentation with orientation and script detection. (OSD) ievOCRAUTO_ONLY = 2, // Automatic page segmentation, but no OSD, or OCR. ievOCRAUTO = 3, // Fully automatic page segmentation, but no OSD. ievOCRSINGLE_COLUMN = 4, // Assume a single column of text of variable sizes. ievOCRSINGLE_BLOCK_VERT_TEXT = 5, // Assume a single uniform block of vertically aligned text. ievOCRSINGLE_BLOCK = 6, // Assume a single uniform block of text. (Default.) ievOCRSINGLE_LINE = 7, // Treat the image as a single text line. ievOCRSINGLE_WORD = 8, // Treat the image as a single word. ievOCRCIRCLE_WORD = 9, // Treat the image as a single word in a circle. ievOCRSINGLE_CHAR = 10 // Treat the image as a single character. ); {!!} {!! TIEVisionOCRScriptDirection Declaration } TIEVisionOCRScriptDirection = ( ievOCRDIR_NEUTRAL = 0, // Text contains only neutral characters. ievOCRDIR_LEFT_TO_RIGHT = 1, // Text contains no Right-to-Left characters. ievOCRDIR_RIGHT_TO_LEFT = 2, // Text contains no Left-to-Right characters. ievOCRDIR_MIX = 3 // Text contains a mixture of left-to-right ); {!!} {!! TIEVisionOCROrientation Declaration } TIEVisionOCROrientation = ( ievOCROrientPAGE_UP = 0, ievOCROrientPAGE_RIGHT = 1, ievOCROrientPAGE_DOWN = 2, ievOCROrientPAGE_LEFT = 3 ); {!!} {!! TIEVisionOCRWritingDirection Declaration } TIEVisionOCRWritingDirection = ( ievOCRWritDirLEFT_TO_RIGHT = 0, ievOCRWritDirRIGHT_TO_LEFT = 1, ievOCRWritDirTOP_TO_BOTTOM = 2 ); {!!} {!! TIEVisionOCRTextlineOrder Declaration } TIEVisionOCRTextlineOrder = ( ievOCRTxtlineOrderLEFT_TO_RIGHT = 0, ievOCRTxtlineOrderRIGHT_TO_LEFT = 1, ievOCRTxtlineOrderTOP_TO_BOTTOM = 2 ); {!!} {!! TIEVisionOCREngine Declaration TIEVisionOCREngine = ( ievOCRFAST = 0, ievOCRCUBE = 1, ievOCRACCURATE = 2 ); Description The engine(s) used for OCR recognition: Type Description ievOCRFAST Use only the base OCR engine for faster processing ievOCRCUBE Use the Cube OCR engine for better accuracy (slower) ievOCRACCURATE Use both the base and Cube OCR engines for best accuracy
Note: If you use the base OCR engine (ievOCRFAST) you will only require the *.trained data support file, e.g. eng.traineddata for processing of an English language document. Use of ievOCRCUBE and ievOCRACCURATE require you to also enclude the *.cube.* files. e.g. eng.cube.word-freq, eng.cube.size, etc. !!} TIEVisionOCREngine = ( ievOCRFAST = 0, // don't use cube, fastest engine ievOCRCUBE = 1, // use cube only, better accuracy, but slower ievOCRACCURATE = 2 // use base and cube engine, best accuracy ); {!! TIEVisionTermCriteriaType Declaration } type TIEVisionTermCriteriaType = int32_t; const ievITER = 1; const ievNUMBER = 1; const ievEPS = 2; {!!} {!! TIEVisionMulSpectrumsFlags Declaration } type TIEVisionMulSpectrumsFlags = int32_t; const ievMUL_ROWS = 4; const ievMUL_CONJ = 8; {!!} {!! TIEVisionHaarDetectObjectsFlags Declaration } type TIEVisionHaarDetectObjectsFlags = int32_t; const ievNONE = 0; const ievDO_CANNY_PRUNING = 1; const ievSCALE_IMAGE = 2; const ievFIND_BIGGEST_OBJECT = 4; const ievDO_ROUGH_SEARCH = 8; {!!} {!! TIEVisionStitchingStatus Declaration } type TIEVisionStitchingStatus = ( ievSSOK = 0, ievSSERR_NEED_MORE_IMGS = 1, ievSSERR_HOMOGRAPHY_EST_FAIL = 2, ievSSERR_CAMERA_PARAMS_ADJUST_FAIL = 3 ); {!!} {!! TIEVisionThresholdType Declaration } type TIEVisionThresholdType = int32_t; const ievTHRESH_BINARY = 0; const ievTHRESH_BINARY_INV = 1; const ievTHRESH_TRUNC = 2; const ievTHRESH_TOZERO = 3; const ievTHRESH_TOZERO_INV = 4; const ievTHRESH_OTSU = 8; // must be combined with other values const ievTHRESH_TRIANGLE = 16; // must be combined with other values {!!} {!! TIEVisionAdaptiveMethod Declaration } type TIEVisionAdaptiveMethod = ( ievADAPTIVE_THRESH_MEAN_C = 0, ievADAPTIVE_THRESH_GAUSSIAN_C = 1 ); {!!} {!! TIEVisionStructuringElementShape Declaration } TIEVisionStructuringElementShape = ( ievMORPH_RECT = 0, ievMORPH_CROSS = 1, ievMORPH_ELLIPSE = 2 ); {!!} {$WARNINGS ON} type /////////////////////////////////////////////////// // structures {!! TIEVisionRect Declaration } TIEVisionRect = packed record x: int32_t; y: int32_t; width: int32_t; height: int32_t; end; {!!} {!! PIEVisionRect Declaration PIEVisionRect = ^; !!} PIEVisionRect = ^TIEVisionRect; {!! TIEVisionSize Declaration } TIEVisionSize = packed record width: int32_t; height: int32_t; end; {!!} {!! TIEVisionSize2f Declaration } TIEVisionSize2f = packed record width: single; height: single; end; {!!} {!! TIEVisionPoint Declaration } TIEVisionPoint = packed record x: int32_t; y: int32_t; end; {!!} {!! TIEVisionPoint2f Declaration } TIEVisionPoint2f = packed record x: single; y: single; end; {!!} {!! TIEVisionScalar Declaration } TIEVisionScalar = packed record val: array [0..3] of double; end; {!!} {!! TIEVisionScalarInt32 Declaration } TIEVisionScalarInt32 = packed record val: array [0..3] of int32_t; end; {!!} {!! TIEVisionFloatPair Declaration } TIEVisionFloatPair = packed record first: single; second: single; end; {!!} {!! TIEVisionTermCriteria Declaration TIEVisionTermCriteria = packed record ctype: ; maxIter: int32_t; epsilon: double; end; !!} TIEVisionTermCriteria = packed record ctype: TIEVisionTermCriteriaType; maxIter: int32_t; epsilon: double; end; {!! TIEVisionBox2D Declaration } TIEVisionBox2D = packed record centerX, centerY: single; width, height: single; angle: single; end; {!!} {!! TIEVisionRotatedRect Declaration TIEVisionRotatedRect = packed record center: ; // mass center of the rectangle size: ; // size angle: single; // rotation angle in degrees end; !!} TIEVisionRotatedRect = packed record center: TIEVisionPoint2f; // mass center of the rectangle size: TIEVisionSize2f; // size angle: single; // rotation angle in degrees end; {!! TIEVisionRGB8 Declaration } TIEVisionRGB8 = packed record r: uint8_t; g: uint8_t; b: uint8_t; end; {!!} {!! PIEVisionRGB8 Declaration PIEVisionRGB8 = ^; !!} PIEVisionRGB8 = ^TIEVisionRGB8; {!! TIEVisionRGB16 Declaration } TIEVisionRGB16 = packed record r: uint16_t; g: uint16_t; b: uint16_t; end; {!!} {!! PIEVisionRGB16 Declaration PIEVisionRGB16 = ^; !!} PIEVisionRGB16 = ^TIEVisionRGB16; {!! TIEVisionBGR8 Declaration } TIEVisionBGR8 = packed record b: uint8_t; g: uint8_t; r: uint8_t; end; {!!} {!! PIEVisionBGR8 Declaration PIEVisionBGR8 = ^; !!} PIEVisionBGR8 = ^TIEVisionBGR8; {!! TIEVisionBGR16 Declaration } TIEVisionBGR16 = packed record b: uint16_t; g: uint16_t; r: uint16_t; end; {!!} {!! PIEVisionBGR16 Declaration PIEVisionBGR16 = ^; !!} PIEVisionBGR16 = ^TIEVisionBGR16; {!! TIEVisionOCRBox Declaration TIEVisionOCRBox = packed record text: uint32_t; cost: single; rect: ; end; !!} TIEVisionOCRBox = packed record text: uint32_t; cost: single; rect: TIEVisionRect; end; {!! PIEVisionOCRBox Declaration PIEVisionOCRBox = ^; !!} PIEVisionOCRBox = ^TIEVisionOCRBox; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionBase Declaration TIEVisionBase = interface(IInterface) Description This is the base interface for each IEVision object. It handles reference counting and automatic disposing. !!} // must be stdcall TIEVisionBase = interface(IInterface) ['{1DECDC99-E370-4E33-B5E5-EB7F84AAFAE2}'] procedure dispose(); stdcall; function getRefCount(): int32_t; stdcall; procedure internal_destructor; cdecl; // don't use! end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionString Declaration TIEVisionString = interface() Description An object that exposes this interface can store an ANSI string. Methods and Properties !!} TIEVisionString = interface(TIEVisionBase) {!! TIEVisionString.length Declaration function length(): int32_t; safecall; Description Returns the string length. !!} function length(wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionString.operatorASSIGN Declaration procedure operatorASSIGN(src: ); safecall; Description Replaces current string with the content of source string. Parameter Description src The source string.
Example string1.operatorASSIGN(string2); // equiv. to "string1 := string2" !!} procedure operatorASSIGN(src: TIEVisionString; wantExceptions: bool32 = false); safecall; {!! TIEVisionString.operatorEQUAL Declaration function operatorEQUAL(src:
): bool32; safecall; Description Compares current string with the content of source string. Parameter Description src The source string.
Example string1.operatorEQUAL(string2); // equiv. to "string1 = string2" !!} function operatorEQUAL(src: TIEVisionString; wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionString.at Declaration function at(pos: int32_t): AnsiChar; safecall; Description Returns the character at specified position. Parameter Description pos Character index (0=first character).
Example c = string1.at(0); // equiv. to "c := string1[0]" !!} function at(pos: int32_t; wantExceptions: bool32 = false): AnsiChar; safecall; {!! TIEVisionString.append Declaration procedure append(src:
); overload; safecall; procedure append(src: PAnsiChar); overload; safecall; Description Appends a string or ANSI string. Parameter Description src String to append.
Example string1.append(string2); // equiv. to string1 := string1 + string2; string1.append('hello'); // equiv. to string1 := string1 + 'hello'; !!} procedure append(src: TIEVisionString; wantExceptions: bool32 = false); overload; safecall; procedure append(src: PAnsiChar; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionString.c_str Declaration function c_str(): PAnsiChar; safecall; Description Returns a zero terminated string. Example ShowMessage( AnsiString(string1.c_str()) ); !!} function c_str(wantExceptions: bool32 = false): PAnsiChar; safecall; {!! TIEVisionString.saveToFile Declaration procedure saveToFile(filename: PAnsiChar); safecall; Description Saves string content to a file. Parameter Description filename The output filename with path.
Example string1.saveToFile('output.txt'); !!} procedure saveToFile(filename: PAnsiChar; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionWString Declaration TIEVisionWString = interface(
) Description An object that exposes this interface can store a wide string. Methods and Properties !!} TIEVisionWString = interface(TIEVisionBase) {!! TIEVisionWString.length Declaration function length(): int32_t; safecall; Description Returns the string length. !!} function length(wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionWString.operatorASSIGN Declaration procedure operatorASSIGN(src: ); safecall; Description Replaces the current string with a source string. Parameter Description src The source string.
Example string1.operatorASSIGN(string2); // equiv. to "string1 := string2" !!} procedure operatorASSIGN(src: TIEVisionWString; wantExceptions: bool32 = false); safecall; {!! TIEVisionWString.operatorEQUAL Declaration function operatorEQUAL(src:
): bool32; safecall; Description Compares the current string with a source string. Parameter Description src The source string.
Example string1.operatorEQUAL(string2); // equiv. to "string1 = string2" !!} function operatorEQUAL(src: TIEVisionWString; wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionWString.at Declaration function at(pos: int32_t): WideChar; safecall; Description Returns the character at a specified position. Parameter Description pos Character index (0=first character).
Example c = string1.at(0); // equiv. to "c := string1[0]" !!} function at(pos: int32_t; wantExceptions: bool32 = false): WideChar; safecall; {!! TIEVisionWString.append Declaration procedure append(src:
); overload; safecall; procedure append(src: PWideChar); overload; safecall; Description Appends a string or wide string. Parameter Description src String to append.
Example string1.append(string2); // equiv. to string1 := string1 + string2; string1.append('hello'); // equiv. to string1 := string1 + 'hello'; !!} procedure append(src: TIEVisionWString; wantExceptions: bool32 = false); overload; safecall; procedure append(src: PWideChar; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionWString.c_str Declaration function c_str(): PWideChar; safecall; Description Returns a zero terminated string. Example ShowMessage( WideString(string1.c_str()) ); !!} function c_str(wantExceptions: bool32 = false): PWideChar; safecall; {!! TIEVisionWString.saveToFile Declaration procedure saveToFile(filename: PAnsiChar); safecall; Description Saves string content to a file as UTF-16 (little endian). Parameter Description filename The output filename with path.
Example string1.saveToFile('output.txt'); !!} procedure saveToFile(filename: PAnsiChar; wantExceptions: bool32 = false); safecall; {!! TIEVisionWString.convertFromUTF8 Declaration procedure convertFromUTF8(src: PAnsiChar); safecall; Description Converts UTF8 zero terminated string to UTF16. Parameter Description src Source UTF8 string.
!!} procedure convertFromUTF8(src: PAnsiChar; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionBaseVector Declaration TIEVisionBaseVector = interface(
) Description An object that exposes this interface can store a generic vector. This is the base class for , , etc... See Also - - - - - - - - - Methods and Properties !!} TIEVisionBaseVector = interface(TIEVisionBase) {!! TIEVisionBaseVector.size Declaration function size(): int32_t; safecall; Description Represents the number of items in the vector. !!} function size(wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionBaseVector.operatorASSIGN Declaration procedure operatorASSIGN(src: ); safecall; Description Replaces current vector with the source vector. Parameter Description src The source vector.
!!} procedure operatorASSIGN(src: TIEVisionBaseVector; wantExceptions: bool32 = false); safecall; {!! TIEVisionBaseVector.max_size Declaration function max_size(): uint32_t; safecall; Description Returns the maximum number of items that this vector can contain (checks free memory). !!} function max_size(wantExceptions: bool32 = false): uint32_t; safecall; {!! TIEVisionBaseVector.resize Declaration procedure resize(sz: uint32_t); safecall; Description Resizes the vector to the specified size. Parameter Description sz The new vector size.
!!} procedure resize(sz: uint32_t; wantExceptions: bool32 = false); safecall; {!! TIEVisionBaseVector.capacity Declaration function capacity(): uint32_t; safecall; Description Returns the size of allocated storage for the container. !!} function capacity(wantExceptions: bool32 = false): uint32_t; safecall; {!! TIEVisionBaseVector.empty Declaration function empty(): bool32; safecall; Description Returns true if the vector is empty. !!} function empty(wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionBaseVector.reserve Declaration procedure reserve(n: uint32_t); safecall; Description Reserves a minimum length of storage for this vector, allocating space if necessary. Parameter Description n The minimum length of storage to be allocated for the vector.
!!} procedure reserve(n: uint32_t; wantExceptions: bool32 = false); safecall; {!! TIEVisionBaseVector.pop_back Declaration procedure pop_back(); safecall; Description Removes the last element. !!} procedure pop_back(wantExceptions: bool32 = false); safecall; {!! TIEVisionBaseVector.erase Declaration function erase(position: uint32_t): uint32_t; overload; safecall; function erase(first: uint32_t; last: uint32_t): uint32_t; overload; safecall; Description Removes a specified item or a range of items. Returns the first element remaining beyond any elements removed. Parameter Description position The item index to remove. first Begin of range to erase. last End of range (not included) to erase.
Example // removes item 0 (first item) vector1.erase(0); // removes item 0 up to 3 (included) vector1.erase(0, 4); !!} function erase(position: uint32_t; wantExceptions: bool32 = false): uint32_t; overload; safecall; function erase(first: uint32_t; last: uint32_t; wantExceptions: bool32 = false): uint32_t; overload; safecall; {!! TIEVisionBaseVector.swap Declaration procedure swap(vec:
); safecall; Description Swaps the content of this vector with the specified one. Parameter Description vec Other vector to swap.
!!} procedure swap(vec: TIEVisionBaseVector; wantExceptions: bool32 = false); safecall; {!! TIEVisionBaseVector.clear Declaration procedure clear(); safecall; Description Removes all elements. !!} procedure clear(wantExceptions: bool32 = false); safecall; {!! TIEVisionBaseVector.sort Declaration procedure sort(order:
= ievASCENDING); safecall; Description Sorts elements of the vector. Parameter Description order Sorting order.
Example vector1.sort(ievASCENDING); !!} procedure sort(order: TIEVisionSortOrder = ievASCENDING; wantExceptions: bool32 = false); safecall; {!! TIEVisionBaseVector.data Declaration function data(): pointer; safecall; Description Returns the raw pointer to the vector. !!} function data(wantExceptions: bool32 = false): pointer; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionVectorString Declaration TIEVisionVectorString = interface(
) Description An object that exposes this interface can store a vector of strings (). Methods and Properties !!} TIEVisionVectorString = interface(TIEVisionBaseVector) {!! TIEVisionVectorString.getString Declaration function getString(pos: int32_t): ; safecall; Description Returns the string at specified index. Parameter Description pos Index of string to return (0=first string).
!!} function getString(pos: int32_t; wantExceptions: bool32 = false): TIEVisionString; safecall; {!! TIEVisionVectorString.getCString Declaration function getCString(pos: int32_t): PAnsiChar; safecall; Description Returns an ANSI zero terminated string. Parameter Description pos Index of string to return (0=first string).
Example ShowMessage(AnsiString(vector1.getCString(0))); !!} function getCString(pos: int32_t; wantExceptions: bool32 = false): PAnsiChar; safecall; {!! TIEVisionVectorString.push_back Declaration procedure push_back(str:
); overload; safecall; procedure push_back(str: PAnsiChar); overload; safecall; Description Appends a string object or an ANSI string. Parameter Description str String to append.
Example vector1.push_back("hello"); !!} procedure push_back(str: TIEVisionString; wantExceptions: bool32 = false); overload; safecall; procedure push_back(str: PAnsiChar; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionVectorString.setString Declaration procedure setString(pos: int32_t; value:
); overload; safecall; procedure setString(pos: int32_t; value: PAnsiChar); overload; safecall; Description Replaces/Sets an item with the specified string object or ANSI stirng. Parameter Description pos Item index to set. value String object or ANSI string.
Example i := vector1.push_back('before'); vector1.setString(i, 'replaced'); !!} procedure setString(pos: int32_t; value: TIEVisionString; wantExceptions: bool32 = false); overload; safecall; procedure setString(pos: int32_t; value: PAnsiChar; wantExceptions: bool32 = false); overload; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionVectorInt32 Declaration TIEVisionVectorInt32 = interface(
) Description An object that exposes this interface can store a vector of integers (32 bit). Methods and Properties !!} TIEVisionVectorInt32 = interface(TIEVisionBaseVector) {!! TIEVisionVectorInt32.getInt32 Declaration function getInt32(pos: int32_t): int32_t; safecall; Description Returns the specified item. Parameter Description pos Item index (0 = first item).
!!} function getInt32(pos: int32_t; wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionVectorInt32.push_back Declaration procedure push_back(value: int32_t); safecall; Description Appends a new integer. Parameter Description value Integer to add.
!!} procedure push_back(value: int32_t; wantExceptions: bool32 = false); safecall; {!! TIEVisionVectorInt32.setInt32 Declaration procedure setInt32(pos: int32_t; value: int32_t); safecall; Description Sets the item value. Parameter Description pos Item index to set. value Integer value.
Example intvector.setInt32(0, 123); // like: intvector[0] := 123 !!} procedure setInt32(pos: int32_t; value: int32_t; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionVectorByte Declaration TIEVisionVectorByte = interface(
) Description An object that exposes this interface can store a vector of bytes (unsigned 8 bit). Methods and Properties !!} TIEVisionVectorByte = interface(TIEVisionBaseVector) {!! TIEVisionVectorByte.getUInt8 Declaration function getUInt8(pos: int32_t): uint8_t; safecall; Description Returns value of the specified item. Parameter Description pos Item index (0 = first item).
!!} function getUInt8(pos: int32_t; wantExceptions: bool32 = false): uint8_t; safecall; {!! TIEVisionVectorByte.push_back Declaration procedure push_back(value: uint8_t); safecall; Description Appends a new byte. Parameter Description value Byte value to add.
!!} procedure push_back(value: uint8_t; wantExceptions: bool32 = false); safecall; {!! TIEVisionVectorByte.setUInt8 Declaration procedure setUInt8(pos: int32_t; value: uint8_t); safecall; Description Parameter Description pos Item index to set. value Value to set.
!!} procedure setUInt8(pos: int32_t; value: uint8_t; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionVectorFloatPair Declaration TIEVisionVectorFloatPair = interface(
) Description An object that exposes this interface can store a vector of float pairs (two 32 bit floats, ). Methods and Properties !!} TIEVisionVectorFloatPair = interface(TIEVisionBaseVector) {!! TIEVisionVectorFloatPair.getFloatPair Declaration function getFloatPair(pos: int32_t): ; safecall; Description Returns the float pair at the specified index. Parameter Description pos Item index to retrieve.
!!} function getFloatPair(pos: int32_t; wantExceptions: bool32 = false): TIEVisionFloatPair; safecall; {!! TIEVisionVectorFloatPair.push_back Declaration procedure push_back(value:
); safecall; Description Appends a new float pair value. Parameter Description value Float pair to add.
Example vector1.push_back( IEVisionFloatPair(1.2, 1.3) ); !!} procedure push_back(value: TIEVisionFloatPair; wantExceptions: bool32 = false); safecall; {!! TIEVisionVectorFloatPair.setFloatPair Declaration procedure setFloatPair(pos: int32_t; value:
); safecall; Description Sets a new value for the specified item. Parameter Description pos Item index to set (0 = first item). value Item value.
Example vector1.setFloatPair(0, IEVisionFloatPair(1.2, 1.3) ); !!} procedure setFloatPair(pos: int32_t; value: TIEVisionFloatPair; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionVectorScalarInt32 Declaration TIEVisionVectorScalarInt32 = interface(
) Description An object that exposes this interface can store a vector of four integers (four 32 bit integers, ). Methods and Properties !!} TIEVisionVectorScalarInt32 = interface(TIEVisionBaseVector) {!! TIEVisionVectorScalarInt32.getScalarInt32 Declaration function getScalarInt32(pos: int32_t; wantExceptions: bool32 = false): ; safecall; Description Returns the four integers scalar at the specified index. Parameter Description pos Item index to retrieve.
!!} function getScalarInt32(pos: int32_t; wantExceptions: bool32 = false): TIEVisionScalarInt32; safecall; {!! TIEVisionVectorScalarInt32.push_back Declaration procedure push_back(value:
); safecall; Description Appends a new value. Parameter Description value Four integers scalar to add.
!!} procedure push_back(value: TIEVisionScalarInt32; wantExceptions: bool32 = false); safecall; {!! TIEVisionVectorScalarInt32.setScalarInt32 Declaration procedure setScalarInt32(pos: int32_t; value:
); safecall; Description Sets a new value for the specified item. Parameter Description pos Item index to set (0 = first item). value Item value.
!!} procedure setScalarInt32(pos: int32_t; value: TIEVisionScalarInt32; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionVectorPoint Declaration TIEVisionVectorPoint = interface(
) Description An object that exposes this interface can store a vector of points (). Methods and Properties !!} TIEVisionVectorPoint = interface(TIEVisionBaseVector) {!! TIEVisionVectorPoint.getPoint Declaration function getPoint(pos: int32_t): ; safecall; Description Returns the point at specified position. Parameter Description pos Item index.
!!} function getPoint(pos: int32_t; wantExceptions: bool32 = false): TIEVisionPoint; safecall; {!! TIEVisionVectorPoint.push_back Declaration procedure push_back(value:
); safecall; Description Appends a new point to the vector. Parameter Description value Point to add.
Example vector1.push_back( IEVisionPoint(10, 20) ); !!} procedure push_back(value: TIEVisionPoint; wantExceptions: bool32 = false); safecall; {!! TIEVisionVectorPoint.setPoint Declaration procedure setPoint(pos: int32_t; value:
); safecall; Description Replaces/Sets an item value. Parameter Description pos Item index. value Value of the item.
Example vector1.setPoint(0, IEVisionPoint(10, 20)); !!} procedure setPoint(pos: int32_t; value: TIEVisionPoint; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionVectorRect Declaration TIEVisionVectorRect = interface(
) Description An object that exposes this interface can store a vector of rectangles (). Methods and Properties !!} TIEVisionVectorRect = interface(TIEVisionBaseVector) {!! TIEVisionVectorRect.getRect Declaration function getRect(pos: int32_t): ; safecall; Description Returns the specified item. Parameter Description pos Item index (0 = first item).
!!} function getRect(pos: int32_t; wantExceptions: bool32 = false): TIEVisionRect; safecall; {!! TIEVisionVectorRect.push_back Declaration procedure push_back(value:
); safecall; Description Appends a new item. Parameter Description value The rectangle to append.
Example vector1.push_back(IEVisionRect(0, 0, 200, 200)); !!} procedure push_back(value: TIEVisionRect; wantExceptions: bool32 = false); safecall; {!! TIEVisionVectorRect.setRect Declaration procedure setRect(pos: int32_t; value:
); safecall; Description Replaces/Sets an item value. Parameter Description pos Item index (0 = first item). value Value to set.
Example vector1.setRect(IEVisionRect(0, 0, 200, 200)); !!} procedure setRect(pos: int32_t; value: TIEVisionRect; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionVectorDouble Declaration TIEVisionVectorDouble = interface(
) Description An object that exposes this interface can store a vector of doubles (64 bit floating point). Methods and Properties !!} TIEVisionVectorDouble = interface(TIEVisionBaseVector) {!! TIEVisionVectorDouble.getDouble Declaration function getDouble(pos: int32_t): double; safecall; Description Returns the specified item. Parameter Description pos Item index.
!!} function getDouble(pos: int32_t; wantExceptions: bool32 = false): double; safecall; {!! TIEVisionVectorDouble.push_back Declaration procedure push_back(value: double); safecall; Description Appends a new item. Parameter Description value Value to add.
!!} procedure push_back(value: double; wantExceptions: bool32 = false); safecall; {!! TIEVisionVectorDouble.setDouble Declaration procedure setDouble(pos: int32_t; value: double); safecall; Description Replaces/Sets a value at specified position. Parameter Description pos Item index. value Value to set.
!!} procedure setDouble(pos: int32_t; value: double; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionVectorOCRBox Declaration TIEVisionVectorOCRBox = interface(
) Description An object that exposes this interface can store a vector of OCR boxes (). Methods and Properties !!} TIEVisionVectorOCRBox = interface(TIEVisionBaseVector) {!! TIEVisionVectorOCRBox.getOCRBox Declaration function getOCRBox(pos: int32_t): ; safecall; Description Returns the specified item. Parameter Description pos Item index.
!!} function getOCRBox(pos: int32_t; wantExceptions: bool32 = false): TIEVisionOCRBox; safecall; {!! TIEVisionVectorOCRBox.push_back Declaration procedure push_back(value:
); safecall; Description Appends a new item. Parameter Description value Item to append.
!!} procedure push_back(value: TIEVisionOCRBox; wantExceptions: bool32 = false); safecall; {!! TIEVisionVectorOCRBox.setOCRBox Declaration procedure setOCRBox(pos: int32_t; value:
); safecall; Description Replaces/Sets the specified item. Parameter Description pos Item index. value Value to set.
!!} procedure setOCRBox(pos: int32_t; value: TIEVisionOCRBox; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionOCRWordBox Declaration TIEVisionOCRWordBox = interface(
) Description An object that exposes this interface can store an ocr word box (a box that contains a word). Methods and Properties !!} TIEVisionOCRWordBox = interface(TIEVisionBase) {!! TIEVisionOCRWordBox.getText Declaration function getText(): ; safecall; Description Returns the text associated to this box. !!} function getText(wantExceptions: bool32 = false): TIEVisionWString; safecall; {!! TIEVisionOCRWordBox.getBox Declaration function getBox(): ; safecall; Description Returns the bounding rectangle of this box. !!} function getBox(wantExceptions: bool32 = false): TIEVisionRect; safecall; {!! TIEVisionOCRWordBox.getConfidence Declaration function getConfidence(): single; safecall; Description Returns confidence (as percentage) of this word. !!} function getConfidence(wantExceptions: bool32 = false): single; safecall; {!! TIEVisionOCRWordBox.isBold Declaration function isBold(): bool32; safecall; Description Returns true if current word has Bold attribute. !!} function isBold(wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionOCRWordBox.isItalic Declaration function isItalic(): bool32; safecall; Description Returns true if current word has Italic attribute. !!} function isItalic(wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionOCRWordBox.isUnderlined Declaration function isUnderlined(): bool32; safecall; Description Returns true if current word has Underlined attribute. !!} function isUnderlined(wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionOCRWordBox.isMonospace Declaration function isMonospace(): bool32; safecall; Description Returns true if current word is monospaced. !!} function isMonospace(wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionOCRWordBox.isSerif Declaration function isSerif(): bool32; safecall; Description Returns true if current word is Serif. !!} function isSerif(wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionOCRWordBox.isSmallCaps Declaration function isSmallCaps(): bool32; safecall; Description Returns true if current word is smallcaps. !!} function isSmallCaps(wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionOCRWordBox.getPointSize Declaration function getPointSize(): int32_t; safecall; Description Returns point size in printers points (1/72 inch). !!} function getPointSize(wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionOCRWordBox.getLanguage Declaration function getLanguage(): ; safecall; Description Returns the language code (ie 'eng') used to recognize this word. !!} function getLanguage(wantExceptions: bool32 = false): TIEVisionString; safecall; {!! TIEVisionOCRWordBox.getScriptDirection Declaration function getScriptDirection(): ; safecall; Description Return the overall directionality of this word. !!} function getScriptDirection(wantExceptions: bool32 = false): TIEVisionOCRScriptDirection; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// TIEVisionImage = interface; // forward declaration //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionVectorImageRef Declaration TIEVisionVectorImageRef = interface() Description An object that exposes this interface can store a vector of image references (). Methods and Properties !!} TIEVisionVectorImageRef = interface(TIEVisionBaseVector) {!! TIEVisionVectorImageRef.getImage Declaration function getImage(pos: int32_t): ; safecall; Description Returns the image reference at specified index. Parameter Description pos Image index.
!!} function getImage(pos: int32_t; wantExceptions: bool32 = false): TIEVisionImage; safecall; {!! TIEVisionVectorImageRef.push_back Declaration procedure push_back(value:
); safecall; Description Appends a new image reference. Parameter Description value Image reference to set.
Example imagelist.push_back( image1 ); !!} procedure push_back(value: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionVectorImageRef.setImage Declaration procedure setImage(pos: int32_t; value:
); safecall; Description Replaces/Set the image reference. Parameter Description pos Image index. value Image reference to set.
Example imagelist.setImage( image1 ); !!} procedure setImage(pos: int32_t; value: TIEVisionImage; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionVectorObjRef Declaration TIEVisionVectorObjRef = interface(
) Description An object that exposes this interface can store a vector of object references (inherited from ). Methods and Properties !!} TIEVisionVectorObjRef = interface(TIEVisionBaseVector) {!! TIEVisionVectorObjRef.getObj Declaration function getObj(pos: int32_t): ; safecall; Description Returns the object at specified index. Parameter Description pos Object index.
!!} function getObj(pos: int32_t; wantExceptions: bool32 = false): TIEVisionBase; safecall; {!! TIEVisionVectorObjRef.push_back Declaration procedure push_back(value:
); safecall; Description Appends a new object reference. Parameter Description value Object reference to add.
!!} procedure push_back(value: TIEVisionBase; wantExceptions: bool32 = false); safecall; {!! TIEVisionVectorObjRef.setObj Declaration procedure setObj(pos: int32_t; value:
); safecall; Description Replaces/Sets an object reference. Parameter Description pos Item index. value Object reference to set.
!!} procedure setObj(pos: int32_t; value: TIEVisionBase; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionStream Declaration TIEVisionStream = interface(
) Description This is the base interface for all objects with streaming features. See Also - - - - Methods and Properties !!} TIEVisionStream = interface(TIEVisionBase) {!! TIEVisionStream.seek Declaration procedure seek(offset: int64; whence: ); safecall; Description Moves stream to the specified position. Parameter Description offset Absolute or relative offset. whence Where the offset starts.
Example stream1.seek(0, ievSET); // reset position to zero !!} procedure seek(offset: int64; whence: TIEVisionSeekOffset; wantExceptions: bool32 = false); safecall; {!! TIEVisionStream.tell Declaration function tell(): int64; safecall; Description Returns the current stream position. !!} function tell(wantExceptions: bool32 = false): int64; safecall; {!! TIEVisionStream.silent_read Declaration function silent_read(ptr: pointer; size: int64): int64; safecall; Description Reads buffer from stream without raising exceptions on failure. Parameter Description ptr Pointer to destination buffer. size Number of bytes to read.
!!} function silent_read(ptr: pointer; size: int64; wantExceptions: bool32 = false): int64; safecall; {!! TIEVisionStream.silent_write Declaration function silent_write(ptr: pointer; size: int64): int64; safecall; Description Writes buffer to stream without raising exceptions on failure. Parameter Description ptr Point to source buffer. size Number of bytes to write.
!!} function silent_write(ptr: pointer; size: int64; wantExceptions: bool32 = false): int64; safecall; {!! TIEVisionStream.silent_getc Declaration function silent_getc(): int32_t; safecall; Description Reads a char (8 bit) from stream. !!} function silent_getc(wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionStream.eof Declaration function eof(): bool32; safecall; Description Tests whether the file position is at the end of a file. !!} function eof(wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionStream.saveToFile Declaration procedure saveToFile(filename: PAnsiChar); overload; safecall; procedure saveToFile(filename: PWideChar); overload; safecall; Description Saves the stream to the specified file. Parameter Description filename Destination path and filename.
Example stream1.saveToFile('output.dat'); !!} procedure saveToFile(filename: PAnsiChar; wantExceptions: bool32 = false); overload; safecall; procedure saveToFile(filename: PWideChar; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionStream.loadFromFile Declaration procedure loadFromFile(filename: PAnsiChar); overload; safecall; procedure loadFromFile(filename: PWideChar); overload; safecall; Description Loads the stream from the specified file. Parameter Description filename Source path and filename.
Example stream1.loadFromFile('input.dat'); !!} procedure loadFromFile(filename: PAnsiChar; wantExceptions: bool32 = false); overload; safecall; procedure loadFromFile(filename: PWideChar; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionStream.read Declaration procedure read(ptr: pointer; size: int64); safecall; Description Reads buffer from stream. Parameter Description ptr Pointer to destination buffer. size Number of bytes to read.
!!} procedure read(ptr: pointer; size: int64; wantExceptions: bool32 = false); safecall; {!! TIEVisionStream.write Declaration procedure write(ptr: pointer; size: int64); safecall; Description Writes buffer to stream. Parameter Description ptr Pointer to source buffer. XXX Number of bytes to write.
!!} procedure write(ptr: pointer; size: int64; wantExceptions: bool32 = false); safecall; // for internal use procedure iostream; cdecl; {!! TIEVisionStream.size Declaration function size(): int64; safecall; Description Returns the stream size. !!} function size(wantExceptions: bool32 = false): int64; safecall; // for internal use procedure convertToCPlusPlus(outputStream: TIEVisionStream; className: PAnsiChar; compressed: bool32; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionFileStream Declaration TIEVisionFileStream = interface(
) Description This is the base interface for all objects with file streaming features. This interface allows you to open/create files and access them using a streaming interface. See Also - - - - Methods and Properties !!} TIEVisionFileStream = interface(TIEVisionStream) {!! TIEVisionFileStream.close Declaration procedure close(); safecall; Description Closes the file. !!} procedure close(wantExceptions: bool32 = false); safecall; {!! TIEVisionFileStream.open Declaration procedure open(filename: PAnsiChar; mode: ); overload; safecall; procedure open(filename: PWideChar; mode: ); overload; safecall; Description Opens/Creates a file. Parameter Description filename Path and name of the file to open. mode Opening mode.
Example // opens 'input.jpg' in read only mode filestream := IEVisionLib.createFileStream(); filestream.open('input.jpg', ievREAD); // creates 'output.jpg' filestream := IEVisionLib.createFileStream(); filestream.open('output.jpg', ievCREATE); !!} procedure open(filename: PAnsiChar; mode: TIEVisionFileStreamMode; wantExceptions: bool32 = false); overload; safecall; procedure open(filename: PWideChar; mode: TIEVisionFileStreamMode; wantExceptions: bool32 = false); overload; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionTempFileStream Declaration TIEVisionTempFileStream = interface(
) Description This is the base interface for all objects with temporary file streaming features. This interface allows you to create a temporary file that is removed when the class is disposed. The file name is chosen automatically. See Also - - - - Methods and Properties !!} TIEVisionTempFileStream = interface(TIEVisionFileStream) {!! TIEVisionTempFileStream.getFilename Declaration function getFilename(): PAnsiChar; safecall; Description Returns the automatically chosen file name. !!} function getFilename(wantExceptions: bool32 = false): PAnsiChar; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionMemoryStream Declaration TIEVisionMemoryStream = interface() Description This is the base interface for all objects with memory streaming features. This interface allows you to create a memory stream. See Also - - - - Methods and Properties !!} TIEVisionMemoryStream = interface(TIEVisionStream) {!! TIEVisionMemoryStream.clear Declaration procedure clear(); safecall; Description Empties the memory stream. !!} procedure clear(wantExceptions: bool32 = false); safecall; {!! TIEVisionMemoryStream.reserve Declaration procedure reserve(count: int32_t); safecall; Description Allocates the specified number of bytes. The actual size of the stream doesn't change. Parameter Description count Number of bytes to allocate.
!!} procedure reserve(count: int32_t; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionExistingMemoryStream Declaration TIEVisionExistingMemoryStream = interface(
) Description This is the base interface for all objects with existing memory streaming features. This interface allows you to create a memory stream from existing stream. See Also - - - - Methods and Properties !!} TIEVisionExistingMemoryStream = interface(TIEVisionStream) {!! TIEVisionExistingMemoryStream.reset Declaration procedure reset(existingBuffer: pointer; existingBufferSize: int32_t); safecall; Description Sets a new buffer for the memory stream. Parameter Description existingBuffer Memory buffer pointer. existingBufferSize Memory buffer size in bytes.
!!} procedure reset(existingBuffer: pointer; existingBufferSize: int32_t; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionTempFileName Declaration TIEVisionTempFileName = interface(
) Description This interface allows you to create temporary file name. The file name is chosen automatically. See Also - - Methods and Properties !!} TIEVisionTempFileName = interface(TIEVisionBase) {!! TIEVisionTempFileName.c_str Declaration function c_str(): PAnsiChar; safecall; Description Returns the automatically chosen file name. !!} function c_str(wantExceptions: bool32 = false): PAnsiChar; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionTempDirName Declaration TIEVisionTempDirName = interface() Description This interface allows you to create temporary directory name. The directory name is chosen automatically. See Also - - Methods and Properties !!} TIEVisionTempDirName = interface(TIEVisionBase) {!! TIEVisionTempDirName.c_str Declaration function c_str(): PAnsiChar; safecall; Description Returns the automatically chosen file name. !!} function c_str(wantExceptions: bool32 = false): PAnsiChar; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionPropertyTree Declaration TIEVisionPropertyTree = interface() Description This interface allows you to create a property tree. A property tree contains several types of data (doubles, ints, other sub property trees, etc...) associating a key for each value. Keys are structured as paths (ie. "image.size.width") separated by periods. Methods and Properties !!} TIEVisionPropertyTree = interface(TIEVisionBase) {!! TIEVisionPropertyTree.size Declaration function size(): int32_t; safecall; Description Returns the number of properties !!} function size(wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionPropertyTree.clear Declaration procedure clear(); safecall; Description Removes all properties. !!} procedure clear(wantExceptions: bool32 = false); safecall; {!! TIEVisionPropertyTree.save Declaration procedure save(stream: ; format: = ievXML); overload; safecall; procedure save(filename: PAnsiChar; format: = ievXML); overload; safecall; Description Saves the entire property tree to file or stream, using the specified format. See Also - Parameter Description stream Stream to write. format Format of the output. filename Filename to write.
!!} procedure save(stream: TIEVisionStream; format: TIEVisionPropertyTreeFormat = ievXML; wantExceptions: bool32 = false); overload; safecall; procedure save(filename: PAnsiChar; format: TIEVisionPropertyTreeFormat = ievXML; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionPropertyTree.load Declaration procedure load(stream:
; format: = ievXML); overload; safecall; procedure load(filename: PAnsiChar; format: = ievXML); overload; safecall; Description Loads a property tree from file or stream, using the specified format. See Also - Parameter Description stream Stream to read. format Format of the input. filename Filename to read.
!!} procedure load(stream: TIEVisionStream; format: TIEVisionPropertyTreeFormat = ievXML; wantExceptions: bool32 = false); overload; safecall; procedure load(filename: PAnsiChar; format: TIEVisionPropertyTreeFormat = ievXML; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionPropertyTree.operatorEQUAL Declaration function operatorEQUAL(rhs:
): bool32; safecall; Description Compares this property tree with the specified one. Parameter Description rhs The other property tree to compare.
!!} function operatorEQUAL(rhs: TIEVisionPropertyTree; wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionPropertyTree.operatorASSIGN Declaration procedure operatorASSIGN(rhs: TIEVisionPropertyTree); safecall; Description Clones the content of specified parameter. Parameter Description rhs Property tree to clone.
!!} procedure operatorASSIGN(rhs: TIEVisionPropertyTree; wantExceptions: bool32 = false); safecall; {!! TIEVisionPropertyTree.swap Declaration procedure swap(rhs:
); safecall; Description Swaps this property tree with the specified one. Parameter Description ros The other property tree to swap.
!!} procedure swap(rhs: TIEVisionPropertyTree; wantExceptions: bool32 = false); safecall; {!! TIEVisionPropertyTree.exists Declaration function exists(keypath: PAnsiChar): bool32; safecall; Description Returns true if the key exists. A key path is a list of words separated by periods (ie: "image.size.width"). Parameter Description keypath Path of the key to find.
Example if propertytree.exists('image.size.width') then .... !!} function exists(keypath: PAnsiChar; wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionPropertyTree.erase Declaration procedure erase(keypath: PAnsiChar); safecall; Description Removes the specified key. A key path is a list of words separated by periods (ie: "image.size.width"). Parameter Description keypath Path of the key to erase.
Example propertytree.erase('image.size.width'); !!} procedure erase(keypath: PAnsiChar; wantExceptions: bool32 = false); safecall; {!! TIEVisionPropertyTree.sort Declaration procedure sort(); safecall; Description Sorts all keys of the property tree. !!} procedure sort(wantExceptions: bool32 = false); safecall; {!! TIEVisionPropertyTree.getPropertyTree Declaration function getPropertyTree(keypath: PAnsiChar):
; safecall; Description Retrieves value of the specified key. The value must be of interface type. A key path is a list of words separated by periods (ie: "image.size.width"). Parameter Description keypath Path of the key to retrieve.
Example propertytree2 := propertytree1.getPropertyTree('image.properties'); !!} function getPropertyTree(keypath: PAnsiChar; wantExceptions: bool32 = false): TIEVisionPropertyTree; safecall; {!! TIEVisionPropertyTree.putPropertyTree Declaration procedure putPropertyTree(keypath: PAnsiChar; propertyTree:
); safecall; Description Puts a property tree into this property tree, using the specified key path. A key path is a list of words separated by periods (ie: "image.size.width"). Parameter Description keypath Path of the key to put. propertyTree Value to put.
!!} procedure putPropertyTree(keypath: PAnsiChar; propertyTree: TIEVisionPropertyTree; wantExceptions: bool32 = false); safecall; {!! TIEVisionPropertyTree.putString Declaration procedure putString(keypath: PAnsiChar; value: PAnsiChar); overload; safecall; procedure putString(keypath: PAnsiChar; value:
); overload; safecall; Description Puts an ANSI string or string object into this property tree, using the specified key path. A key path is a list of words separated by periods (ie: "image.size.width"). Parameter Description keypath Path of the key to put. value Value to put.
Example propertytree1.putString('image.size.width', 640); propertytree1.putString('image.size.height', 480); !!} procedure putString(keypath: PAnsiChar; value: PAnsiChar; wantExceptions: bool32 = false); overload; safecall; procedure putString(keypath: PAnsiChar; value: TIEVisionString; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionPropertyTree.getString Declaration function getString(keypath: PAnsiChar):
; safecall; Description Retrieves value of the specified key. The value must be of interface type. A key path is a list of words separated by periods (ie: "image.property.caption"). Parameter Description keypath Path of the key to get.
Example ShowMessage( AnsiString( propertytree1.getString('image.property.caption').c_str() ) ); !!} function getString(keypath: PAnsiChar; wantExceptions: bool32 = false): TIEVisionString; safecall; {!! TIEVisionPropertyTree.putInt32 Declaration procedure putInt32(keypath: PAnsiChar; value: int32_t); safecall; Description Puts an integer (32 bit) into this property tree, using the specified key path. A key path is a list of words separated by periods (ie: "image.size.width"). Parameter Description keypath Path of the key to put. value Value to put.
Example propertytree1.putInt32('image.size.width', 640); !!} procedure putInt32(keypath: PAnsiChar; value: int32_t; wantExceptions: bool32 = false); safecall; {!! TIEVisionPropertyTree.getInt32 Declaration function getInt32(keypath: PAnsiChar): int32_t; safecall; Description Retrieves value of the specified key. The value must be an integer (32 bit). A key path is a list of words separated by periods (ie: "image.size.width"). Parameter Description keypath Path of the key to get.
Example width := propertytree1.getInt32('image.size.width'); !!} function getInt32(keypath: PAnsiChar; wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionPropertyTree.putDouble Declaration procedure putDouble(keypath: PAnsiChar; value: double); safecall; Description Puts a double (64 bit floating point) into this property tree, using the specified key path. A key path is a list of words separated by periods (ie: "image.property.EXIF_FNumber"). Parameter Description keypath Path of the key to put. value Value to put.
Example propertytree.putDouble('image.property.EXIF_FNumber', 2.8); !!} procedure putDouble(keypath: PAnsiChar; value: double; wantExceptions: bool32 = false); safecall; {!! TIEVisionPropertyTree.getDouble Declaration function getDouble(keypath: PAnsiChar): double; safecall; Description Retrieves value of the specified key. The value must be a double (64 bit floating point). A key path is a list of words separated by periods (ie: "image.property.EXIF.FNumber"). Parameter Description keypath Path of the key to get.
Example width := propertytree1.getDouble('image.property.EXIF.FNumber'); !!} function getDouble(keypath: PAnsiChar; wantExceptions: bool32 = false): double; safecall; {!! TIEVisionPropertyTree.putRect Declaration procedure putRect(keypath: PAnsiChar; const rect:
); safecall; Description Puts a rectangle () into this property tree, using the specified key path. A key path is a list of words separated by periods (ie: "image.ROI"). Parameter Description keypath Path of the key to put. value Value to put.
Example propertytree.putRect('image.ROI', IEVisionRect(10, 10, 200, 200)); !!} procedure putRect(keypath: PAnsiChar; const rect: TIEVisionRect; wantExceptions: bool32 = false); safecall; {!! TIEVisionPropertyTree.getRect Declaration function getRect(keypath: PAnsiChar):
; safecall; Description Retrieves value of the specified key. The value must be a interface. A key path is a list of words separated by periods (ie: "image.ROI"). Parameter Description keypath Path of the key to get.
Example rect := propertytree1.getRect('image.ROI'); !!} function getRect(keypath: PAnsiChar; wantExceptions: bool32 = false): TIEVisionRect; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionImage Declaration TIEVisionImage = interface(
) Description This interface allows you to create raster images or matrices. It is possible to perform basic input/output operations and several image processing tasks. It is possible also to interface TIEVisionImage to ImageEn , sharing the same content. Example // creates empty image image := IEVisionLib.createImage(); // creates an image from "input.jpg", resize to 100x100 and save as "output.jpg" image := IEVisionLib.createImage('input.jpg'); image.resize(100, 100); // default interpolation = linear image.save('output.jpg'); // creates an image of 1000x1000x24 bit image := IEVisionLib.createImage(1000, 1000, ievUINT8, 3); // creates an image from ImageEn (sharing the content) ImageEnView1.IEBitmap.Origin := ieboTOPLEFT; image := IEVisionLib.createImage(ImageEnView1.IEBitmap.Width, ImageEnView1.IEBitmap.Height, ievUINT8, 3, ImageEnView1.IEBitmap.Rowlen, ImageEnView1.IEBitmap.ScanLine[0]); // Same as previous code image := ImageEnView1.IEBitmap.GetIEVisionImage(); Methods and Properties See Also - !!} TIEVisionImage = interface(TIEVisionBase) {!! TIEVisionImage.create Declaration procedure create(width: int32_t; height: int32_t; channelFormat: ; channels: int32_t); safecall; Description Allocates (if necessary) an image with the specified parameters. Parameter Description width Image width. height Image height. channelFormat Type of channels (8 bit, 8 bit unsigned, 16 bit, etc...). channels Number of channels (1 = gray scale, 3 = color).
Example // create empty image image := IEVisionLib.createImage(); // allocate 1000x1000 RGB image image.create(1000, 1000, ievUINT8, 3); !!} procedure create(width: int32_t; height: int32_t; channelFormat: TIEVisionChannelFormat; channels: int32_t; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.swap Declaration procedure swap(secondImage:
); safecall; Description Swaps the content of specified image and this image. Parameter Description secondImage The other image to swap.
Example // swap content of image1 and image2 image1.swap(image2); !!} procedure swap(secondImage: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.operatorASSIGN Declaration procedure operatorASSIGN(src:
); safecall; Description Clones the source image replacing the old content. Parameter Description src Source image to clone.
See Also -
Example // copies the entire content of image1 to image2 image2.operatorASSIGN(image1); !!} procedure operatorASSIGN(src: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.share Declaration procedure share(src: ); safecall; Description Shares the content of source image with this image, replacing the old content. Parameter Description src Image to share.
See Also -
Example // sares the entire content of image1 with image2 image2.share(image1); !!} procedure share(src: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.getWidth Declaration function getWidth(): int32_t; safecall; Description Returns current image width. See Also - !!} function getWidth(wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionImage.getHeight Declaration function getHeight(): int32_t; safecall; Description Returns current image height. See Also - !!} function getHeight(wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionImage.getChannels Declaration function getChannels(): int32_t; safecall; Description Returns the number of channels of current image. When 1 the image is gray scale. When >=3 the image is colored image (ie RGB). See Also - !!} function getChannels(wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionImage.getChannelFormat Declaration function getChannelFormat(): ; safecall; Description Returns the type of channels. See Also - !!} function getChannelFormat(wantExceptions: bool32 = false): TIEVisionChannelFormat; safecall; {!! TIEVisionImage.getRowLen Declaration function getRowLen(): int32_t; safecall; Description Returns the length, in bytes, of a single row. !!} function getRowLen(wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionImage.isEmpty Declaration function isEmpty(): bool32; safecall; Description Returns true if the object doesn't contain an image. !!} function isEmpty(wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionImage.getScanline Declaration function getScanline(row: int32_t): pointer; safecall; Description Returns a pointer to the specified row. Parameter Description row Row index to retrieve.
!!} function getScanline(row: int32_t; wantExceptions: bool32 = false): pointer; safecall; {!! TIEVisionImage.pixel_uint8 Declaration function pixel_uint8(row: int32_t; col: int32_t): uint8_p; safecall; Description Returns the pixel value at the specified position. Channel format must be 8 bit unsigned, single channel. Parameter Description row Vertial position. col Horizontal position.
Example // read value of pixel at 10, 10 value := image1.pixel_uint8(10, 10)^; !!} function pixel_uint8(row: int32_t; col: int32_t; wantExceptions: bool32 = false): uint8_p; safecall; {!! TIEVisionImage.pixel_uint16 Declaration function pixel_uint16(row: int32_t; col: int32_t): uint16_p; safecall; Description Returns the pixel value at the specified position. Channel format must be 16 bit unsigned, single channel. Parameter Description row Vertial position. col Horizontal position.
Example // read value of pixel at 10, 10 value := image1.pixel_uint16(10, 10)^; !!} function pixel_uint16(row: int32_t; col: int32_t; wantExceptions: bool32 = false): uint16_p; safecall; {!! TIEVisionImage.pixel_float32 Declaration function pixel_float32(row: int32_t; col: int32_t): float_p; safecall; Description Returns the pixel value at the specified position. Channel format must be 32 bit floating point, single channel. Parameter Description row Vertial position. col Horizontal position.
!!} function pixel_float32(row: int32_t; col: int32_t; wantExceptions: bool32 = false): float_p; safecall; {!! TIEVisionImage.pixel_float64 Declaration function pixel_float64(row: int32_t; col: int32_t): double_p; safecall; Description Returns the pixel value at the specified position. Channel format must be 64 bit floating point, single channel. Parameter Description row Vertial position. col Horizontal position.
!!} function pixel_float64(row: int32_t; col: int32_t; wantExceptions: bool32 = false): double_p; safecall; {!! TIEVisionImage.pixel_RGB8 Declaration function pixel_RGB8(row: int32_t; col: int32_t):
; safecall; Description Returns the pixel value at the specified position. Channel format must be 8 bit unsigned, three channels (diposed as R-G-B). Parameter Description row Vertial position. col Horizontal position.
!!} function pixel_RGB8(row: int32_t; col: int32_t; wantExceptions: bool32 = false): PIEVisionRGB8; safecall; {!! TIEVisionImage.pixel_BGR8 Declaration function pixel_BGR8(row: int32_t; col: int32_t):
; safecall; Description Returns the pixel value at the specified position. Channel format must be 8 bit unsigned, three channels (diposed as B-G-R). Parameter Description row Vertial position. col Horizontal position.
!!} function pixel_BGR8(row: int32_t; col: int32_t; wantExceptions: bool32 = false): PIEVisionBGR8; safecall; {!! TIEVisionImage.getRect Declaration function getRect(rect: TIEVisionRect):
; safecall; Description Creates a new TIEVisionImage object that contains the specified region. No copy is performed, only the actual area is shared among the objects. Parameter Description rect Region to share.
Example ROI_image := image1.getRect(IEVisionRect(10, 10, 200, 200)); !!} function getRect(rect: TIEVisionRect; wantExceptions: bool32 = false): TIEVisionImage; safecall; {!! TIEVisionImage.getColumn Declaration function getColumn(col: int32_t):
; safecall; Description Creates a new TIEVisionImage object that contains the specified column. No copy is performed, only the actual area is shared among the objects. Parameter Description col Column to share.
Example ROI_image := image1.getColumn(5); !!} function getColumn(col: int32_t; wantExceptions: bool32 = false): TIEVisionImage; safecall; {!! TIEVisionImage.getColumns Declaration function getColumns(startCol: int32_t; endCol: int32_t):
; safecall; Description Creates a new TIEVisionImage object that contains the specified range of columns. No copy is performed, only the actual area is shared among the objects. Parameter Description startCol First column to share. endCol Last column (not included) to share.
Example ROI_image := image1.getColumns(10, 100); !!} function getColumns(startCol: int32_t; endCol: int32_t; wantExceptions: bool32 = false): TIEVisionImage; safecall; {!! TIEVisionImage.getRow Declaration function getRow(row: int32_t):
; safecall; Description Creates a new TIEVisionImage object that contains the specified single row. No copy is performed, only the actual area is shared among the objects. Parameter Description row Row to share.
Example ROI_image := image1.getRow(25); !!} function getRow(row: int32_t; wantExceptions: bool32 = false): TIEVisionImage; safecall; {!! TIEVisionImage.getRows Declaration function getRows(startRow: int32_t; endRow: int32_t):
; safecall; Description Creates a new TIEVisionImage object that contains the specified range of rows. No copy is performed, only the actual area is shared among the objects. Parameter Description startRow First row to share. endRow Last row (not included) to share.
Example ROI_image := image1.getRows(10, 100); !!} function getRows(startRow: int32_t; endRow: int32_t; wantExceptions: bool32): TIEVisionImage; safecall; {!! TIEVisionImage.getDiagonal Declaration function getDiagonal(diag: int32_t):
; safecall; Description Creates a new TIEVisionImage object that contains the specified diagonal. No copy is performed, only the actual area is shared among the objects. Parameter Description diag Index of the diagonal, with the following values: d=0 is the main diagonal, d>0 is a diagonal from the lower half. For example, d=1 means the diagonal is set imme- diately below the main one. d<0 is a diagonal from the upper half. For example, d=1 means the diagonal is set imme- diately above the main one.
!!} function getDiagonal(diag: int32_t; wantExceptions: bool32 = false): TIEVisionImage; safecall; {!! TIEVisionImage.getAlphaMask Declaration function getAlphaMask():
; safecall; Description Returns current alpha mask. See Also - Example image1.createAlphaMask(); alpha := image1.getAlphaMask(); !!} function getAlphaMask(wantExceptions: bool32 = false): TIEVisionImage; safecall; {!! TIEVisionImage.createAlphaMask Declaration procedure createAlphaMask(); safecall; Description Creates the alpha mask. See Also - !!} procedure createAlphaMask(wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.hasAlphaMask Declaration function hasAlphaMask(): bool32; safecall; Description Returns true if the object doesn't contain an alpha mask. !!} function hasAlphaMask(wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionImage.save Declaration procedure save(filename: PAnsiChar); overload; safecall; procedure save(filename: PAnsiChar; fileType: ); overload; safecall; Description Saves current image to the specified file. Parameter Description filename Filename of output file. fileType File format of the file.
Example // save to output.jpg, as jpeg image1.save('output.jpg'); // save to output.dat, as jpeg image1.save('output.dat', ievJPEG); !!} procedure save(filename: PAnsiChar; wantExceptions: bool32 = false); overload; safecall; procedure save(filename: PAnsiChar; fileType: TIEVisionFileFormat; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.getMetadata Declaration function getMetadata():
; safecall; Description Returns a property tree with all meta properties of the image. !!} function getMetadata(wantExceptions: bool32 = false): TIEVisionPropertyTree; safecall; {!! TIEVisionImage.resize Declaration function resize(dst: ; interpolation: = ievLINEAR): ; overload; safecall; function resize(newWidth: int32_t; newHeight: int32_t; interpolation: = ievLINEAR): ; overload; safecall; Description Resizes (resamples) current image to the specified size, using an interpolation filter. First overload stores the resized image in the specified destination object. Uses destination size as resize parameters. Source image remains untouched. Returns the destination object. Second overload resizes the image inplace, returning itself. Parameter Description dst Container for the resized image. interpolation Interpolation filter. newWidth New image width. If less than 0, this is autocalculated. newHeight New image height. If less than 0, this is autocalculated.
Example // resizes image1 to 1000x1000, using CUBIC interpolation image1.resize(1000, 1000, ievCUBIC); // resizes image1 to the size of image2 (1000x1000) image2.create(1000, 1000, ievUINT8, 3); image1.resize(image2, ievCUBIC); !!} function resize(dst: TIEVisionImage; interpolation: TIEVisionInterpolation = ievLINEAR; wantExceptions: bool32 = false): TIEVisionImage; overload; safecall; function resize(newWidth: int32_t; newHeight: int32_t; interpolation: TIEVisionInterpolation = ievLINEAR; wantExceptions: bool32 = false): TIEVisionImage; overload; safecall; {!! TIEVisionImage.convertColor Declaration function convertColor(dst: TIEVisionImage; code:
): ; overload; safecall; function convertColor(code: ): ; overload; safecall; Description Converts from a color space to another color space. First overload stores the resulting image into specified destination. Returns the destination object. Second overload stores the resulting image inplace. Returns itself. Channels format and channels count are set automatically. Parameter Description dst Container for the destination image. code Specifies source and destination color space.
Example // Converts BGR image to gray scale image.convertColor(ievBGR2GRAY); !!} function convertColor(dst: TIEVisionImage; code: TIEVisionCvtColorCode; wantExceptions: bool32 = false): TIEVisionImage; overload; safecall; function convertColor(code: TIEVisionCvtColorCode; wantExceptions: bool32 = false): TIEVisionImage; overload; safecall; {!! TIEVisionImage.flip Declaration function flip(dst:
; flipMode: ): ; overload; safecall; function flip(flipMode: ): ; overload; safecall; Description Flips current image. First overload stores the resulting image into specified destination. Returns the destination object. Second overload stores the resulting image inplace. Returns itself. Parameter Description dst Container for the destination image. flipMode Specifies the axis (X, Y or XY).
Example // horizontal flip image1.flip(ievX_AXIS); !!} function flip(dst: TIEVisionImage; flipMode: TIEVisionFlipMode; wantExceptions: bool32 = false): TIEVisionImage; overload; safecall; function flip(flipMode: TIEVisionFlipMode; wantExceptions: bool32 = false): TIEVisionImage; overload; safecall; {!! TIEVisionImage.equalizeHistogram Declaration procedure equalizeHistogram(dst:
); overload; safecall; procedure equalizeHistogram(); overload; safecall; Description Equalizes the histogram. First overload places the result into destination object. Second overload stores the resulting image inplace. Parameter Description dst Container for the destination image.
Example image1.equalizeHistogram(); !!} procedure equalizeHistogram(dst: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure equalizeHistogram(wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.makeBorder Declaration procedure makeBorder(dst:
; top, bottom, left, right: int32_t; borderType: ; value: ); overload; safecall; procedure makeBorder(top, bottom, left, right: int32_t; borderType: ; value: ); overload; safecall; Description Forms a border around the image. First overload places the result into destination object. Second overload stores the resulting image inplace. Resulting image size will be width = old_width + left + right, height = old_height + top + bottom. Parameter Description dst Container for the destination image. top Specifies how many pixels on the top to add. bottom Specifies how many pixels on the bottom to add. left Specifies how many pixels on the left to add. right Specifies how many pixels on the right to add. borderType Border type. value Border value if borderType is ievBORDER_CONSTANT.
!!} procedure makeBorder(dst: TIEVisionImage; top, bottom, left, right: int32_t; borderType: TIEVisionBorderType; value: TIEVisionScalar; wantExceptions: bool32 = false); overload; safecall; procedure makeBorder(top, bottom, left, right: int32_t; borderType: TIEVisionBorderType; value: TIEVisionScalar; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.smooth Declaration procedure smooth(dst:
; smoothType: = ievGAUSSIAN; param1: int32_t = 3; param2: int32_t = 0; param3: double = 0.0; param4: double = 0.0); overload; safecall; procedure smooth(smoothType: = ievGAUSSIAN; param1: int32_t = 3; param2: int32_t = 0; param3: double = 0.0; param4: double = 0.0); overload; safecall; Description Smooths the image. First overload places the result into destination object. Second overload stores the resulting image inplace. Parameter Description dst Container for the destination image. smoothType Type of the smoothing. param1 Parameter 1. Depends by smoothType. param2 Parameter 2. Depends by smoothType. param3 Parameter 3. Depends by smoothType. param4 Parameter 4. Depends by smoothType.
smoothType can be: Parameter Description ievBLUR_NO_SCALE Linear convolution with param1 x param2 box kernel (all 1's). To smooth different pixels with different-size box kernels, you can use the integral image that is computed using . ievBLUR Linear convolution with param1 x param2 box kernel (all 1's) with subsequent scaling by 1 / (param1 * param2). ievGAUSSIAN Linear convolution with a param1 x param2 Gaussian kernel. ievMEDIAN Median filter with a param1 x param1 square aperture. ievBILATERAL Bilateral filter with a param1 x param1 square aperture, color sigma= param3 and spatial sigma= param4. If param1=0, the aperture square side is set to round(param4*1.5)*2+1.
!!} procedure smooth(dst: TIEVisionImage; smoothType: TIEVisionSmoothType = ievGAUSSIAN; param1: int32_t = 3; param2: int32_t = 0; param3: double = 0.0; param4: double = 0.0; wantExceptions: bool32 = false); overload; safecall; procedure smooth(smoothType: TIEVisionSmoothType = ievGAUSSIAN; param1: int32_t = 3; param2: int32_t = 0; param3: double = 0.0; param4: double = 0.0; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.filter2D Declaration procedure filter2D(dst: ; kernel: ; anchor: ); overload; safecall; procedure filter2D(kernel: ; anchor: ); overload; safecall; Description Convolves an image with the kernel. First overload places the result into destination object. Second overload stores the resulting image inplace. Parameter Description dst Container for the destination image. kernel Convolution kernel (or rather a correlation kernel), a single-channel floating point matrix. To apply different kernels to different channels, split the image into separate color planes using and process them individually. anchor Anchor of the kernel that indicates the relative position of a filtered point within the kernel. The anchor should lie within the kernel. The special default value (-1, -1) means that the anchor is at the kernel center.
!!} procedure filter2D(dst: TIEVisionImage; kernel: TIEVisionImage; anchor: TIEVisionPoint; wantExceptions: bool32 = false); overload; safecall; procedure filter2D(kernel: TIEVisionImage; anchor: TIEVisionPoint; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.integral Declaration procedure integral(sum: ); overload; safecall; procedure integral(sum: ; sqsum: ; tilted_sum: ); overload; safecall; Description Calculates the integral of an image. Parameter Description sum Integral image as (W + 1) x (H + 1) , 32-bit integer or floating-point (32f or 64f). sqsum Integral image for squared pixel values. It is (W + 1) x (H + 1), double-precision floating-point (64f) image (matrix). tilted_sum Integral for the image rotated by 45 degrees. It is (W + 1) x (H + 1) image (matrix) with the same data type as sum.
!!} procedure integral(sum: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure integral(sum: TIEVisionImage; sqsum: TIEVisionImage; tilted_sum: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.pyrDown Declaration procedure pyrDown(dst:
); overload; safecall; procedure pyrDown(); overload; safecall; Description Smoothes an image and downsamples it. First overload places the result into destination object. Second overload stores the resulting image inplace. Size of the destination image is computed as new_width = (width+1)/2, new_height = (height+1)/2). Parameter Description dst Container for the destination image.
!!} procedure pyrDown(dst: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure pyrDown(wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.pyrUp Declaration procedure pyrUp(dst:
); overload; safecall; procedure pyrUp(); overload; safecall; Description Upsamples an image and then smoothes it. First overload places the result into destination object. Second overload stores the resulting image inplace. Size of the destination image is computed as new_width = width*2, new_height = height*2 Parameter Description dst Container for the destination image.
!!} procedure pyrUp(dst: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure pyrUp(wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.splitPlanes Declaration procedure splitPlanes(plane0:
); overload; safecall; procedure splitPlanes(plane0: ; plane1: ); overload; safecall; procedure splitPlanes(plane0: ; plane1: ; plane2: ); overload; safecall; procedure splitPlanes(plane0: ; plane1: ; plane2: ; plane3: ); overload; safecall; Description Divides a multi-channel image (matrix) into several single-channel images. Parameter Description plane0 Container for plane 0. plane1 Container for plane 1. plane2 Container for plane 2. plane3 Container for plane 3.
Example blue := IEVisionLib.createImage(); green := IEVisionLib.createImage(); red := IEVisionLib.createImage(); image1.splitPlanes(blue, green, red); !!} procedure splitPlanes(plane0: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure splitPlanes(plane0: TIEVisionImage; plane1: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure splitPlanes(plane0: TIEVisionImage; plane1: TIEVisionImage; plane2: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure splitPlanes(plane0: TIEVisionImage; plane1: TIEVisionImage; plane2: TIEVisionImage; plane3: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.minMax Declaration procedure minMax(out minVal: double; out maxVal: double); overload; safecall; procedure minMax(out minVal: double; out maxVal: double; out minLoc:
; out maxLoc: ); overload; safecall; procedure minMax(out minVal: double; out maxVal: double; out minLoc: ; out maxLoc: ; mask: ); overload; safecall; Description Finds the global minimum and maximum in a whole image or sub-image. Parameter Description minVal Output for minimum value. maxVal Output for maximum value. minLoc Minimum value location. maxLoc Maximum value location.
!!} procedure minMax(out minVal: double; out maxVal: double; wantExceptions: bool32 = false); overload; safecall; procedure minMax(out minVal: double; out maxVal: double; out minLoc: TIEVisionPoint; out maxLoc: TIEVisionPoint; wantExceptions: bool32 = false); overload; safecall; procedure minMax(out minVal: double; out maxVal: double; out minLoc: TIEVisionPoint; out maxLoc: TIEVisionPoint; mask: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.camShift Declaration procedure camShift(var window:
; criteria: ; out area: double; out box: ); overload; safecall; function camShift(var window: ; criteria: ): ; overload; safecall; Description Finds an object center, size, and orientation. First overload outputs area as double and bounding box as . Second overload returns a record. Parameter Description window Initial search window. criteria Search stop criteria. area Area of found box. box Found box.
Demos Demos\IEVision\TrackObjects\TrackObjects.dpr Demos\IEVision\TrackObjects_LowLevel\TrackObjects_LowLevel.dpr !!} procedure camShift(var window: TIEVisionRect; criteria: TIEVisionTermCriteria; out area: double; out box: TIEVisionBox2D; wantExceptions: bool32 = false); overload; safecall; function camShift(var window: TIEVisionRect; criteria: TIEVisionTermCriteria; wantExceptions: bool32 = false): TIEVisionRotatedRect; overload; safecall; {!! TIEVisionImage.inRange Declaration procedure inRange(lower:
; upper: ; dest: ); overload; safecall; procedure inRange(lower: ; upper: ; dest: ); overload; safecall; Description Checks if image pixels lie between the specified values. First overload gets a range of two scalar values. Second overload gets an matrix (image) of lower and upper values. Parameter Description lower Lower value or matrix of values. upper Upper value or matrix of value. dest Container used to store results. Contains 255 if related pixel is inside the range.
!!} procedure inRange(lower: TIEVisionScalar; upper: TIEVisionScalar; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure inRange(lower: TIEVisionImage; upper: TIEVisionImage; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.convertScale Declaration function convertScale(dest:
; scale: double = 1.0; shift: double = 0.0): ; overload; safecall; function convertScale(channelFormat: ; scale: double = 1.0; shift: double = 0.0): ; overload; safecall; Description Converts an image to another datatype with optional scaling. First overload stores the resulting image into destination object. It returns the destination image. Second overload stores the resulting image inplace. It returns itself. Parameter Description dest Container used to store results. scale Scale factor (1.0 = no scale). shift Delta added to the scaled values. channelFormat Used to change the channel format.
!!} function convertScale(dest: TIEVisionImage; scale: double = 1.0; shift: double = 0.0; wantExceptions: bool32 = false): TIEVisionImage; overload; safecall; function convertScale(channelFormat: TIEVisionChannelFormat; scale: double = 1.0; shift: double = 0.0; wantExceptions: bool32 = false): TIEVisionImage; overload; safecall; {!! TIEVisionImage.countNonZero Declaration function countNonZero(): int32_t; safecall; Description Counts non-zero image pixels. !!} function countNonZero(wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionImage.isAllWhite Declaration function isAllWhite(): bool32; safecall; Description Returns true if the image contains all whites (255 values). !!} function isAllWhite(wantExceptions: bool32): bool32; safecall; {!! TIEVisionImage.addWeighted Declaration procedure addWeighted(alpha: double; rhs:
; beta: double; gamma: double; dest: ); overload; safecall; Description Computes the weighted sum of two images, executing: dest = this*alpha + rhs*beta + gamma Parameter Description alpha Weight for the first image pixels. rhs Second source image of the same size and channel number. beta Weight for the second image pixels. gamma Scalar added to each sum. dest Container for the resulting image.
!!} procedure addWeighted(alpha: double; rhs: TIEVisionImage; beta: double; gamma: double; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.avg Declaration function avg(mask:
): ; overload; safecall; function avg(): ; overload; safecall; Description Calculates an average (mean) of image pixels. Parameter Description mask Operation mask (processes only pixels with mask > 0).
!!} function avg(mask: TIEVisionImage; wantExceptions: bool32 = false): TIEVisionScalar; overload; safecall; function avg(wantExceptions: bool32 = false): TIEVisionScalar; overload; safecall; {!! TIEVisionImage.avgSdv Declaration procedure avgSdv(out mean:
; out stdDev: ; mask: ); overload; safecall; procedure avgSdv(out mean: ; out stdDev: ); overload; safecall; Description Calculates a mean and standard deviation of image pixels. Parameter Description mean Outputs calculated mean. stdDev Output calculated standard deviation. mask Operation mask (processes only pixels with mask > 0).
!!} procedure avgSdv(out mean: TIEVisionScalar; out stdDev: TIEVisionScalar; mask: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure avgSdv(out mean: TIEVisionScalar; out stdDev: TIEVisionScalar; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.cmp Declaration procedure cmp(rhs:
; dest: ; cmpOp: ); overload; safecall; procedure cmp(rhs: double; dest: ; cmpOp: ); overload; safecall; Description Performs the per-element comparison of two images or an image and scalar value. Parameter Description rhs Right-side image to compare. dest Container for the results. cmpOp Compare operation.
!!} procedure cmp(rhs: TIEVisionImage; dest: TIEVisionImage; cmpOp: TIEVisionCmpOp; wantExceptions: bool32 = false); overload; safecall; procedure cmp(rhs: double; dest: TIEVisionImage; cmpOp: TIEVisionCmpOp; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.copy Declaration procedure copy(dest:
; mask: ); overload; safecall; procedure copy(dest: ); overload; safecall; procedure copy(const srcRect: ; dest: ); overload; safecall; function copy(const srcRect: ): ; overload; safecall; procedure copy(const srcRect: ; const dstRect: ; dest: ); overload; safecall; procedure copy(const srcRect: ; destPtr: pointer; rowLen: int32_t); overload; safecall; Description Copies current image to the specified destination. Parameter Description dest XXX mask XXX srcRect XXX dstRect XXX destPtr XXX rowLen XXX
Example // overload nr.1: copies image1 to destination, using specified mask (only pixels with mask > 0) destination := IEVisionLib.createImage(); image1.copy(destination, mask); // overload nr.2: copies image1 to destination destination := IEVisionLib.createImage(); image1.copy(destination); // overload nr.3: copies specified rectangle of image1 to destination destination := IEVisionLib.createImage(); image1.copy(IEVisionRect(10, 10, 200, 200), destination); // overload nr.4: creates a new image from the specified rectangle destination := image1.copy(IEVisionRect(10, 10, 200, 200)); // overload nr.5: copies specified rectangle of image1 to specified rectangle of destination destination := IEVisionLib.createImage(); image1.copy(IEVisionRect(10, 10, 200, 200), IEVisionRect(50, 50, 200, 200), destination); // overload nr.6: copies specified rectangle to destination buffer image1.copy(IEVisionRect(10, 10, 200, 200), destPointer, destRowLen); !!} procedure copy(dest: TIEVisionImage; mask: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure copy(dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure copy(const srcRect: TIEVisionRect; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; function copy(const srcRect: TIEVisionRect; wantExceptions: bool32 = false): TIEVisionImage; overload; safecall; procedure copy(const srcRect: TIEVisionRect; const dstRect: TIEVisionRect; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure copy(const srcRect: TIEVisionRect; destPtr: pointer; rowLen: int32_t; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.copyFrom Declaration procedure copyFrom(srcChannelFormat:
; srcChannels: int32_t; srcRowLen: int32_t; srcData: pointer); safecall; Description Copies image from memory buffer. Parameter Description srcChannelFormat Source image channel format. srcChannels Source image number of channels. srcRowLen Source image row length. srcData Source image buffer.
Example // copies RGB image from ImageEnView1 (TImageEnView) image1 := IEVisionLib.createImage(); image1.copyFrom(ievUINT8, 3, ImageEnView1.IEBitmap.RowLen, ImageEnView1.IEBitmap.Scanline[ImageEnView1.IEBitmap.Height-1]); image1.flip(ievY_AXIS); !!} procedure copyFrom(srcChannelFormat: TIEVisionChannelFormat; srcChannels: int32_t; srcRowLen: int32_t; srcData: pointer; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.setZero Declaration procedure setZero(); safecall; Description Sets all pixels to zero. !!} procedure setZero(wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.DCT Declaration procedure DCT(dest:
; flags: ); safecall; Description Performs a forward or inverse discrete Cosine transform of the image. Parameter Description dest Container for the resulting image. flags Transformation flags.
!!} procedure DCT(dest: TIEVisionImage; flags: TIEVisionDCTFlags; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.DFT Declaration procedure DFT(dest:
; flags: ; nonZeroRows: int32_t = 0); safecall; Description Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point image. Parameter Description dest Container for the resulting image. flags Transformation flags. nonZeroRows When the parameter is not zero, the function assumes that only the first nonzeroRows rows of the input image (ievDFT_INVERSE is not set) or only the first nonzeroRows of the output image (ievDFT_INVERSE is set) contain non-zeros.
!!} procedure DFT(dest: TIEVisionImage; flags: TIEVisionDFTFlags; nonZeroRows: int32_t = 0; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.determinant Declaration function determinant(): double; safecall; Description Returns the determinant of a square floating-point image (matrix). !!} function determinant(wantExceptions: bool32 = false): double; safecall; {!! TIEVisionImage.dotProduct Declaration function dotProduct(rhs:
): double; safecall; Description Calculates the dot product in Euclidian metrics. Parameter Description rhs Right-hand side image.
!!} function dotProduct(rhs: TIEVisionImage; wantExceptions: bool32 = false): double; safecall; {!! TIEVisionImage.eigenVV Declaration procedure eigenVV(evects:
; evals: ); safecall; Description Computes eigenvalues and eigenvectors of a symmetric image (matrix). Parameter Description evects Output container for the eigen vectors. evals Output container for the eigen values.
!!} procedure eigenVV(evects: TIEVisionImage; evals: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.invert Declaration function invert(dest:
; invertMethod: ): double; safecall; Description Finds the inverse or pseudo-inverse of an image (matrix). Parameter Description dest Container for the resulting image. invertMethod Inversion method.
!!} function invert(dest: TIEVisionImage; invertMethod: TIEVisionInvertMethod; wantExceptions: bool32 = false): double; safecall; {!! TIEVisionImage.LUT Declaration procedure LUT(dest:
; lut: ); safecall; Description Performs a look-up table transform of an image. Source must be an image of 8-bit pixels. Parameter Description dest Container for the resulting image. lut Look-up table of 256 elements. In case of multi-channel source image, the table should either have a single channel (in this case the same table is used for all channels) or the same number of channels as in the source image.
!!} procedure LUT(dest: TIEVisionImage; lut: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.max Declaration procedure max(source1:
; source2: ); overload; safecall; procedure max(source1: ; source2: double); overload; safecall; Description Calculates per-element maximum of two image or an image and a scalar. Parameter Description source1 First source image. source2 Second source image or scalar value.
!!} procedure max(source1: TIEVisionImage; source2: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure max(source1: TIEVisionImage; source2: double; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.merge Declaration procedure merge(channel1:
; channel2: ; channel3: ); overload; safecall; procedure merge(channel1: ; channel2: ; channel3: ; channel4: ); overload; safecall; Description Merges specified channels and places the result in this object. Parameter Description channel1 Channel 1. channel2 Channel 2. channel3 Channel 3. channel4 Channel 4.
Example image1.merge(channel_Blue, channel_Green, channel_Red); !!} procedure merge(channel1: TIEVisionImage; channel2: TIEVisionImage; channel3: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure merge(channel1: TIEVisionImage; channel2: TIEVisionImage; channel3: TIEVisionImage; channel4: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.min Declaration procedure min(source1:
; source2: ); overload; safecall; procedure min(source1: ; source2: double); overload; safecall; Description Calculates per-element minimum of two image or an image and a scalar. Parameter Description source1 First source image. source2 Second source image or scalar value.
!!} procedure min(source1: TIEVisionImage; source2: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure min(source1: TIEVisionImage; source2: double; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.mulSpectrums Declaration procedure mulSpectrums(rhs:
; dest: ; flags: ); safecall; Description Performs the per-element multiplication of two Fourier spectrums. Parameter Description rhs Right-hand side image. dest Container for the resulting image. flags Operation flags.
!!} procedure mulSpectrums(rhs: TIEVisionImage; dest: TIEVisionImage; flags: TIEVisionMulSpectrumsFlags; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.mulTransposed Declaration procedure mulTransposed(dest:
; order: bool32; delta: ; scale: double = 1.0); overload; safecall; procedure mulTransposed(dest: ; order: bool32; scale: double = 1.0); overload; safecall; Description Calculates the product of an image (matrix) and its transposition. Parameter Description dest Container for the resulting image. order If true performs: st = scale(src - delta)T (src - delta), otherwise performs: dst = scale(src - delta)(src - delta)T delta Optional delta matrix subtracted from src before the multiplication. scale Optional scale factor for the matrix product.
!!} procedure mulTransposed(dest: TIEVisionImage; order: bool32; delta: TIEVisionImage; scale: double = 1.0; wantExceptions: bool32 = false); overload; safecall; procedure mulTransposed(dest: TIEVisionImage; order: bool32; scale: double = 1.0; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.norm Declaration function norm(): double; overload; safecall; function norm(mask:
): double; overload; safecall; Description Calculates an absolute image norm, an absolute difference norm, or a relative difference norm. Parameter Description mask Operation mask.
!!} function norm(wantExceptions: bool32 = false): double; overload; safecall; function norm(mask: TIEVisionImage; wantExceptions: bool32 = false): double; overload; safecall; {!! TIEVisionImage.opNot Declaration procedure opNot(dest:
); safecall; Description Inverts every bit of an image. Parameter Description dest Container for the resulting image.
!!} procedure opNot(dest: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.perspectiveTransform Declaration procedure perspectiveTransform(dest:
; matrix: ); safecall; Description Performs the perspective image (matrix) transformation of vectors. Parameter Description dest Container for the resulting image. matrix 3x3 or 4x4 floating-point transformation matrix.
!!} procedure perspectiveTransform(dest: TIEVisionImage; matrix: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.reduce Declaration procedure reduce(dest:
; dim: int32_t = -1; op: = ievREDUCE_SUM); safecall; Description Reduces an image (matrix) to a vector. Parameter Description dest Container for the resulting image. dim Dimension index along which the matrix is reduced. 0 means that the matrix is reduced to a single row. 1 means that the matrix is reduced to a single column. op Reduction operation.
!!} procedure reduce(dest: TIEVisionImage; dim: int32_t = -1; op: TIEVisionReduceOp = ievREDUCE_SUM; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.repeatImage Declaration procedure repeatImage(ny, nx: int32_t; dest:
); safecall; Description Fills the destination image with repeated copies of the source image. Parameter Description ny Flag to specify how many times the source is repeated along the vertical axis. nx Flag to specify how many times the source is repeated along the horizontal axis. dest Container for resuling image.
!!} procedure repeatImage(ny, nx: int32_t; dest: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.scaleAdd Declaration procedure scaleAdd(scale: double; rhs:
; dest: ); safecall; Description Calculates the sum of a scaled image and another image. Parameter Description scale Scale factor for left-hand side image (this). rhs Right-hand side image. dest Container for resulting image.
!!} procedure scaleAdd(scale: double; rhs: TIEVisionImage; dest: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.setValue Declaration procedure setValue(value:
; mask: ); overload; safecall; procedure setValue(value: ); overload; safecall; Description Sets all or some of the image pixels to the specified value. Parameter Description value Scalar value to set. mask Operation mask (set only when > 0).
Example // fills with BGR = (200, 100, 0) image1.setValue(IEVisionScalar(200, 100, 0)); !!} procedure setValue(value: TIEVisionScalar; mask: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure setValue(value: TIEVisionScalar; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.setIdentity Declaration procedure setIdentity(); safecall; Description Initializes a scaled identity image (matrix). !!} procedure setIdentity(wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.transpose Declaration procedure transpose(); safecall; Description Transposes an image (matrix). !!} procedure transpose(wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.findContours Declaration function findContours(mode:
; method: ; offset: ): ; safecall; Description Finds contours. Image must be ievUINT8, 1 channel. Result will be a vector of vector of points (TIEVisionVectorObjRef will contain TIEVision VectorPoint objects). Parameter Description mode Contour retrieval mode. method Contour approximation method. offset Optional offset by which every contour point is shifted.
!!} function findContours(mode: TIEVisionContourRetrMode; method: TIEVisionContourApproxMethod; offset: TIEVisionPoint; wantExceptions: bool32 = false): TIEVisionVectorObjRef; safecall; {!! TIEVisionImage.inpaint Declaration procedure inpaint(mask:
; range: double; method: = ievINPAINT_NS); overload; safecall; procedure inpaint(brushWidth: int32_t; brushHeight: int32_t; const subimageRect: ; range: double; method: = ievINPAINT_NS); overload; safecall; Description Restores the selected region in an image using the region neighborhood. First overload needs a mask to identify the area to be inpainted. Second overload builds automatically the mask using specified brush size. Parameter Description mask Inpainting mask, 8-bit 1-channel image. Non-zero pixels indicate the area that needs to be inpainted. range Radius of a circlular neighborhood of each point inpainted that is considered by the algorithm. method Inpainting method brushWidth Width of area to inpaint. brushHeight Height of area to inpaint. subimageRect Rectangle of area of interest (which includes the area to inpaint).
Demo Demos\IEVision\Inpaint_Brush\Inpaint_Brush.dpr Demos\IEVision\Inpaint_Selection\Inpaint_Selection.dpr !!} procedure inpaint(mask: TIEVisionImage; range: double; method: TIEVisionInpaintMethod = ievINPAINT_NS; wantExceptions: bool32 = false); overload; safecall; procedure inpaint(brushWidth: int32_t; brushHeight: int32_t; const subimageRect: TIEVisionRect; range: double; method: TIEVisionInpaintMethod = ievINPAINT_NS; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.floodFill Declaration procedure floodFill(outMask: TIEVisionImage; startingPoint: TIEVisionPoint; loDiff: TIEVisionScalar; upDiff: TIEVisionScalar; connectivity: int32_t = 4; fixedRange: bool32 = false; wantExceptions: bool32 = false); safecall; Description Fills specified mask with a connected pixels. Connected pixels will have 255 value in the mask, 0 otherwise. Parameter Description outMask Output gray scale mask. startingPoint Starting pixel of source image. loDiff Maximal lower brightness/color difference. upDiff Maximal upper brightness/color difference. connectivity Determines which neighbors of a pixel are considered. fixedRange If True only the difference between the current pixel and starting pixel is considered.
Example // makes transparent all connected pixels starting from x = 10, y = 10 var mask: TIEVisionImage; ImageEnView1.LegacyBitmap := false; ImageEnView1.IO.LoadFromFile('test.jpg'); mask := IEVisionLib.createImage(); ImageEnView1.IEBitmap.GetIEVisionImage().floodFill(mask, IEVisionPoint(10, 10), IEVisionScalar(4, 4, 4), IEVisionScalar(4, 4, 4)); mask.opNot(mask); ImageEnView1.IEBitmap.AlphaChannel.AssignIEVisionImage(mask); imageEnview1.Update(); !!} procedure floodFill(outMask: TIEVisionImage; startingPoint: TIEVisionPoint; loDiff: TIEVisionScalar; upDiff: TIEVisionScalar; connectivity: int32_t = 4; fixedRange: bool32 = false; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.canny Declaration procedure canny(threshold1: double; threshold2: double; apertureSize: int32_t = 3; L2gradient: bool32 = false; wantExceptions: bool32 = false); overload; safecall; procedure canny(outImage: TIEVisionImage; threshold1: double; threshold2: double; apertureSize: int32_t = 3; L2gradient: bool32 = false; wantExceptions: bool32 = false); overload; safecall; Description Finds edges in an image using the Canny algorithm. Note: Pixel format of input image must be ie8g. Parameter Description outImage Destination image. Must be 8 bit gray scale (ie8g) and must have the same size of input image. threshold1 First threshold for the hysteresis procedure. threshold2 Second threshold for the hysteresis procedure. apertureSize Aperture size for the Sobel operator. L2gradient A flag, indicating whether a more accurate L2 normalization should be used to calculate the image gradient magnitude.
Example ImageEnView.LegacyBitmap := false; ImageEnView.IO.LoadFromFile('input.jpg'); ImageEnView.IEBitmap.PixelFormat := ie8g; ImageEnView.IEBitmap.GetIEVisionImage().canny(50, 200, 3); ImageEnView.Update(); !!} procedure canny(threshold1: double; threshold2: double; apertureSize: int32_t = 3; L2gradient: bool32 = false; wantExceptions: bool32 = false); overload; safecall; procedure canny(outImage: TIEVisionImage; threshold1: double; threshold2: double; apertureSize: int32_t = 3; L2gradient: bool32 = false; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.blur Declaration procedure blur(ksize:
; anchor: ; borderType: = ievBORDER_REFLECT_101; wantExceptions: bool32 = false); overload; safecall; procedure blur(outImage: ; ksize: ; anchor: ; borderType: = ievBORDER_REFLECT_101; wantExceptions: bool32 = false); overload; safecall; Description Blurs an image using the normalized box filter. Parameter Description outImage Destination image. Must be 8 bit gray scale (ie8g) and must have the same size of input image. ksize Blurring kernel size. anchor Anchor point. Value IEVisionPoint(-1, -1) means that the anchor is at the kernel center. borderType border mode used to extrapolate pixels outside of the image.
Example ImageEnView.LegacyBitmap := false; ImageEnView.IO.LoadFromFile('input.jpg'); ImageEnView.IEBitmap.GetIEVisionImage().blur(IEVisionSize(6, 6), IEVisionPoint(-1, -1)); ImageEnView.Update(); !!} procedure blur(ksize: TIEVisionSize; anchor: TIEVisionPoint; borderType: TIEVisionBorderType = ievBORDER_REFLECT_101; wantExceptions: bool32 = false); overload; safecall; procedure blur(outImage: TIEVisionImage; ksize: TIEVisionSize; anchor: TIEVisionPoint; borderType: TIEVisionBorderType = ievBORDER_REFLECT_101; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.houghLines Declaration function houghLines(rho: double; theta: double; threshold: int32_t; srn: double = 0; stn: double = 0; wantExceptions: bool32 = false):
; safecall; Description Finds lines in a binary image using the standard Hough transform. Returns a vector of lines. Each line is represented by a two-element vector, the distance from the coordinate origin and the distance from the coordinate origin). Note: Pixel format of input image must be ie8g. Parameter Description rho Distance resolution of the accumulator in pixels. theta Angle resolution of the accumulator in radians. threshold Accumulator threshold parameter. Only those lines are returned that get enough votes. srn For the multi-scale Hough transform, it is a divisor for the distance resolution rho. stn For the multi-scale Hough transform, it is a divisor for the distance resolution theta.
Demo Demos\IEVision\LinesDetect\LinesDetect.dpr Example ImageEnView.LegacyBitmap := false; ImageEnView.IO.LoadFromFile('input.jpg'); ImageEnView.IEBitmap.PixelFormat := ie8g; ImageEnView.IEBitmap.GetIEVisionImage().blur(IEVisionSize(3, 3), IEVisionPoint(-1, -1)); ImageEnView.IEBitmap.GetIEVisionImage().canny(50, 200, 3); lines := ImageEnView.IEBitmap.GetIEVisionImage().houghLines(1, PI / 180, 200); !!} function houghLines(rho: double; theta: double; threshold: int32_t; srn: double = 0; stn: double = 0; wantExceptions: bool32 = false): TIEVisionVectorFloatPair; safecall; {!! TIEVisionImage.houghLinesP Declaration function houghLinesP(rho: double; theta: double; threshold: int32_t; minLineLength: double = 0; maxLineGap: double = 0; wantExceptions: bool32 = false):
; safecall; Description Finds line segments in a binary image using the probabilistic Hough transform. Returns a vector of line segments. Each line is represented by a 4-element vector (x1, y1, x2, y2), where (x1, y1) and (x2, y2) are the ending points of each detected line segment. Note: Pixel format of input image must be ie8g. Parameter Description rho Distance resolution of the accumulator in pixels. theta Angle resolution of the accumulator in radians. threshold Accumulator threshold parameter. Only those lines are returned that get enough votes. minLineLength Minimum line length. Line segments shorter than that are rejected. maxLineGap Maximum allowed gap between points on the same line to link them.
Example var lines: TIEVisionVectorScalarInt32; i: integer; begin ImageEnView.LegacyBitmap := false; ImageEnView.IO.LoadFromFile('input.jpg'); ImageEnView.IEBitmap.PixelFormat := ie8g; ImageEnView.IEBitmap.GetIEVisionImage().blur(IEVisionSize(3, 3), IEVisionPoint(-1, -1)); ImageEnView.IEBitmap.GetIEVisionImage().canny(50, 200, 3); lines := ImageEnView.IEBitmap.GetIEVisionImage().houghLinesP(1, PI / 180, 200, 100, 10); // draw results ImageEnView.IEBitmap.PixelFormat := ie24RGB; ImageEnView.IEBitmap.Origin := ieboBOTTOMLEFT; for i := 0 to lines.size() - 1 do begin with lines.getScalarInt32(i) do begin with ImageEnView.IEBitmap.Canvas do begin Pen.Color := clRed; MoveTo(val[0], val[1]); LineTo(val[2], val[3]); end; end; end; ImageEnView.Update(); end; !!} function houghLinesP(rho: double; theta: double; threshold: int32_t; minLineLength: double; maxLineGap: double; wantExceptions: bool32 = false): TIEVisionVectorScalarInt32; safecall; {!! TIEVisionImage.fastNlMeansDenoisingColored Declaration procedure fastNlMeansDenoisingColored(h: single = 3; hColor: single = 3; templateWindowSize: int32_t = 7; searchWindowSize: int32_t = 21; wantExceptions: bool32 = false); overload; safecall; procedure fastNlMeansDenoisingColored(outImage:
; h: single = 3; hColor: single = 3; templateWindowSize: int32_t = 7; searchWindowSize: int32_t = 21; wantExceptions: bool32 = false); overload; safecall; Description Perform image denoising using Non-local Means Denoising algorithm with several computational optimizations. Noise is expected to be a gaussian white noise. Note: Pixel format of input image must be ie24RGB. Parameter Description outImage ie24RGB image for output h Filter strength for image luminance. Larger h values perfectly remove noise but also remove image details, smaller h values preserve details but also noise hColor The same as h but for image color. For most images a value of 10 will be enough to remove colored noise and not distort colors templateWindowSize Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 searchWindowSize Size in pixels of the window that is used to compute weighted average for a given pixel. Should be odd. This value affects performance linearly, i.e. a larger value for searchWindowsSize will mean a longer denoising time. Recommended value 21
Demo Demos\IEVision\Denoising\Denoising.dpr Example begin ImageEnView.LegacyBitmap := false; ImageEnView.IO.LoadFromFile('input.jpg'); ImageEnView.IEBitmap.GetIEVisionImage().fastNlMeansDenoisingColored( 10, 10 ); ImageEnView.Update(); end; !!} procedure fastNlMeansDenoisingColored(h: single = 3; hColor: single = 3; templateWindowSize: int32_t = 7; searchWindowSize: int32_t = 21; wantExceptions: bool32 = false); overload; safecall; procedure fastNlMeansDenoisingColored(outImage: TIEVisionImage; h: single = 3; hColor: single = 3; templateWindowSize: int32_t = 7; searchWindowSize: int32_t = 21; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionImage.threshold Declaration procedure threshold(thresh: double; maxval: double; threshType:
; wantExceptions: bool32 = false); safecall; Description Applies a fixed-level threshold to each pixel element. Note: Pixel format of input image must be ie8g. Parameter Description thresh Threshold value. maxval Maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding types. threshType Thresholding type.
Example begin ImageEnView.LegacyBitmap := false; ImageEnView.IO.LoadFromFile('input.jpg'); ImageEnView.IEBitmap.PixelFormat := ie8g; ImageEnView.IEBitmap.GetIEVisionImage().threshold(0, 255, ievTHRESH_BINARY or ievTHRESH_OTSU); ImageEnView.Update(); end; !!} procedure threshold(thresh: double; maxval: double; threshType: TIEVisionThresholdType; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.adaptiveThreshold Declaration procedure adaptiveThreshold(maxValue: double; adaptiveMethod:
= ievADAPTIVE_THRESH_MEAN_C; thresholdType: = ievTHRESH_BINARY; blockSize: int32_t = 3; C: double = 5; wantExceptions: bool32 = false); safecall; Description Applies an adaptive threshold. Note: Pixel format of input image must be ie8g. Parameter Description maxValue Non-zero value assigned to the pixels for which the condition is satisfied. adaptiveMethod Adaptive thresholding algorithm to use. thresholdType Thresholding type. blockSize Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on. C Constant subtracted from the mean or weighted mean.
Example begin ImageEnView.LegacyBitmap := false; ImageEnView.IO.LoadFromFile('input.jpg'); ImageEnView.IEBitmap.PixelFormat := ie8g; ImageEnView.IEBitmap.GetIEVisionImage().adaptiveThreshold(255); ImageEnView.Update(); end; !!} procedure adaptiveThreshold(maxValue: double; adaptiveMethod: TIEVisionAdaptiveMethod = ievADAPTIVE_THRESH_MEAN_C; thresholdType: TIEVisionThresholdType = ievTHRESH_BINARY; blockSize: int32_t = 3; C: double = 5; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.erode Declaration procedure erode(erosionType:
; erosionSize: uint32_t; wantExceptions: bool32 = false); safecall; Description Erosion is a method of Morphological Image Processing: https://en.wikipedia.org/wiki/Erosion_%28morphology%29 Parameter Description erosionType Structuring element shape. erosionSize Size of structuring element.
!!} procedure erode(erosionType: TIEVisionStructuringElementShape; erosionSize: uint32_t; wantExceptions: bool32 = false); safecall; {!! TIEVisionImage.dilate Declaration procedure dilate(dilationType:
; dilationSize: uint32_t; wantExceptions: bool32 = false); safecall; Description Dilation is a method of Morphological Image Processing: https://en.wikipedia.org/wiki/Dilation_%28morphology%29 Parameter Description dilationType Structuring element shape. dilationSize Size of structuring element.
!!} procedure dilate(dilationType: TIEVisionStructuringElementShape; dilationSize: uint32_t; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionHistogram Declaration TIEVisionHistogram = interface(
) Description This interface allows you to handle an histogram. Methods and Properties !!} TIEVisionHistogram = interface(TIEVisionBase) {!! TIEVisionHistogram.getValue Declaration function getValue(index0: int32_t): single; overload; safecall; function getValue(index0: int32_t; index1: int32_t): single; overload; safecall; function getValue(index0: int32_t; index1: int32_t; index2: int32_t): single; overload; safecall; Description Returns an item of the histogram. Parameter Description index0 Index of dimension 0. index1 Index of dimension 1. index2 Index of dimension 2.
!!} function getValue(index0: int32_t; wantExceptions: bool32 = false): single; overload; safecall; function getValue(index0: int32_t; index1: int32_t; wantExceptions: bool32 = false): single; overload; safecall; function getValue(index0: int32_t; index1: int32_t; index2: int32_t; wantExceptions: bool32 = false): single; overload; safecall; {!! TIEVisionHistogram.size Declaration function size(index: int32_t): int32_t; safecall; Description Returns the size of specified dimension. !!} function size(index: int32_t; wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionHistogram.clear Declaration procedure clear(); safecall; Description Clears the histogram. !!} procedure clear(wantExceptions: bool32 = false); safecall; {!! TIEVisionHistogram.swap Declaration procedure swap(secondHist:
); safecall; Description Exchanges the content of two histograms. Parameter Description secondHist Other object to exchange.
!!} procedure swap(secondHist: TIEVisionHistogram; wantExceptions: bool32 = false); safecall; {!! TIEVisionHistogram.operatorASSIGN Declaration procedure operatorASSIGN(src:
); safecall; Description Replaces current content with the content of specified object. Parameter Description src Object to assign to.
!!} procedure operatorASSIGN(src: TIEVisionHistogram; wantExceptions: bool32 = false); safecall; {!! TIEVisionHistogram.normalize Declaration procedure normalize(factor: double); safecall; Description Normalizes the histogram. Parameter Description factor Normalization factor.
!!} procedure normalize(factor: double; wantExceptions: bool32 = false); safecall; {!! TIEVisionHistogram.calc Declaration procedure calc(image:
; accumulate: bool32 = false); overload; safecall; procedure calc(image: ; accumulate: bool32; mask: ); overload; safecall; Description Populates histogram with the content of the specified image. Parameter Description image Source image. accumulate If it is set, the histogram is not cleared in the beginning when it is allocated. mask Operational mask.
!!} procedure calc(image: TIEVisionImage; accumulate: bool32 = false; wantExceptions: bool32 = false); overload; safecall; procedure calc(image: TIEVisionImage; accumulate: bool32; mask: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionHistogram.calcBackProject Declaration procedure calcBackProject(image:
; backProject: TIEVisionImage); safecall; Description Calculates the back projection of a histogram. Parameter Description image Source image. backProject Destination image.
!!} procedure calcBackProject(image: TIEVisionImage; backProject: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionHistogram.minMax Declaration procedure minMax(out vmin: single; out vmax: single); safecall; Description Returns minimum and maximum histogram values. Parameter Description vmin Minimum value. vmax Maximum value.
!!} procedure minMax(out vmin: single; out vmax: single; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionCascadeClassifier Declaration TIEVisionCascadeClassifier = interface(
) Description This interface allows you to handle a cascade classifier. Methods and Properties !!} TIEVisionCascadeClassifier = interface(TIEVisionBase) {!! TIEVisionCascadeClassifier.load Declaration procedure load(stream: ); overload; safecall; procedure load(filename: PAnsiChar); overload; safecall; Description Loads a cascade classifier from file or stream. It is possible also to load an internal detector using the following consts: Const Classifier IEVC_EYE ":EYE" IEVC_EYE_TREE_EYE_GLASSES ":EYETREEEYEGLASSES" IEVC_FRONTAL_FACE_ALT ":FRONTALFACEALT" IEVC_FRONTAL_FACE_ALT_2 ":FRONTALFACEALT2" IEVC_FRONTAL_FACE_ALT_TREE ":FRONTALFACEALTTREE" IEVC_FRONTAL_FACE_DEFAULT ":FRONTALFACEDEFAULT" IEVC_FULL_BODY ":FULLBODY" IEVC_LOWER_BODY ":LOWERBODY" IEVC_PROFILE_FACE ":PROFILEFACE" IEVC_UPPER_BODY ":UPPERBODY" IEVC_LEFT_EYE_2_SPLITS ":LEFTEYE2SPLITS" IEVC_RIGHT_EYE_2_SPLITS ":RIGHTEYE2SPLITS" IEVC_LBP_FRONTAL_FACE ":LBPFRONTALFACE" IEVC_CASCADE_SMILE ":CASCADESMILE" IEVC_FRONTAL_CAT_FACE ":FRONTALCATFACE" IEVC_FRONTAL_CAT_FACE_EXT ":FRONTALCATFACEEXTENDED" IEVC_LICENSE_PLATE_RUS ":LICENSEPLATERUS" IEVC_RUSSIAN_PLATE_NUMBER ":RUSSIANPLATENUMBER"
Parameter Description stream Input stream. filename Input filename or internal detector string.
Demos Demos\IEVision\FaceDetection\FaceDetection.dpr Demos\IEVision\FaceDetection_LowLevel\FaceDetection_LowLevel.dpr Demos\IEVision\GetFaces\GetFaces.dpr Demos\IEVision\TrackObjects\TrackObjects.dpr Demos\IEVision\TrackObjects_LowLevel\TrackObjects_LowLevel.dpr !!} procedure load(stream: TIEVisionStream; wantExceptions: bool32 = false); overload; safecall; procedure load(filename: PAnsiChar; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionCascadeClassifier.detectObjects Declaration function detectObjects(image:
; scaleFactor: double; minNeighbors: int32_t; flags: ; minSize: ; maxSize: ): ; safecall; Description Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. Parameter Description image Image where to find the objects. scaleFactor Parameter specifying how much the image size is reduced at each image scale. minNeighbors Parameter specifying how many neighbors each candiate rectangle should have to retain it. flags Detection flags. minSize Minimum possible object size. Objects smaller than that are ignored. maxSize Maximum possible object size. Objects larger than that are ignored.
Demos Demos\IEVision\FaceDetection\FaceDetection.dpr Demos\IEVision\FaceDetection_LowLevel\FaceDetection_LowLevel.dpr Demos\IEVision\GetFaces\GetFaces.dpr Demos\IEVision\TrackObjects\TrackObjects.dpr Demos\IEVision\TrackObjects_LowLevel\TrackObjects_LowLevel.dpr !!} function detectObjects(image: TIEVisionImage; scaleFactor: double; minNeighbors: int32_t; flags: TIEVisionHaarDetectObjectsFlags; minSize: TIEVisionSize; maxSize: TIEVisionSize; wantExceptions: bool32 = false): TIEVisionVectorRect; safecall; {!! TIEVisionCascadeClassifier.empty Declaration function empty(): bool32; safecall; Description Returns true if the cascade classifier is empty (it isn't loaded). !!} function empty(wantExceptions: bool32 = false): bool32; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionImageList Declaration TIEVisionImageList = interface(
) Description This interface allows you to handle a list of images. This is a base interface that is inherited by , and . Methods and Properties !!} TIEVisionImageList = interface(TIEVisionBase) {!! TIEVisionImageList.insert Declaration function insert(position: int32_t; image: ): int32_t; overload; safecall; function insert(position: int32_t; filename: PAnsiChar): int32_t; overload; safecall; Description Inserts an image into the specified index. Parameter Description position Destination index. image Image to insert. filename Filename of the image to load and insert.
!!} function insert(position: int32_t; image: TIEVisionImage; wantExceptions: bool32 = false): int32_t; overload; safecall; function insert(position: int32_t; filename: PAnsiChar; wantExceptions: bool32 = false): int32_t; overload; safecall; {!! TIEVisionImageList.remove Declaration procedure remove(position: int32_t); safecall; Description Removes the image at specified index. Parameter Description position Index of image to remove.
!!} procedure remove(position: int32_t; wantExceptions: bool32 = false); safecall; {!! TIEVisionImageList.clear Declaration procedure clear(); safecall; Description Removes all images in the list. !!} procedure clear(wantExceptions: bool32 = false); safecall; {!! TIEVisionImageList.getImage Declaration function getImage(position: int32_t):
; safecall; Description Returns the image at specified index. Parameter Description position Index of image to retrieve.
!!} function getImage(position: int32_t; wantExceptions: bool32 = false): TIEVisionImage; safecall; {!! TIEVisionImageList.size Declaration function size(): int32_t; safecall; Description Returns number of images in the list. !!} function size(wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionImageList.setImage Declaration procedure setImage(position: int32_t; image:
); safecall; Description Replaces image at the index with the specified one. Parameter Description position Index of image to replace. image Image to set.
!!} procedure setImage(position: int32_t; image: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionImageList.pushBack Declaration function pushBack(image:
): int32_t; overload; safecall; function pushBack(filename: PAnsiChar): int32_t; overload; safecall; Description Appends the specified image to the end of list. Parameter Description image Image to set. filename Filename of the image to set.
!!} function pushBack(image: TIEVisionImage; wantExceptions: bool32 = false): int32_t; overload; safecall; function pushBack(filename: PAnsiChar; wantExceptions: bool32 = false): int32_t; overload; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionMemoryImageList Declaration TIEVisionMemoryImageList = interface(
) Description This interface allows you to handle a list of images stored in memory. !!} TIEVisionMemoryImageList = interface(TIEVisionImageList) end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionMemorySharedImageList Declaration TIEVisionMemorySharedImageList = interface() Description This interface allows you to handle a list of images stored in memory as shared object (the content is shared with the source images). !!} TIEVisionMemorySharedImageList = interface(TIEVisionImageList) end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionTempFileImageList Declaration TIEVisionTempFileImageList = interface() Description This interface allows you to handle a list of images stored on disk and removed when the object is destroyed. Methods and Properties !!} TIEVisionTempFileImageList = interface(TIEVisionImageList) {!! TIEVisionTempFileImageList.insertExistingFile Declaration function insertExistingFile(position: int32_t; filename: PAnsiChar; deleteOnDestroy: bool32 = true): int32_t; safecall; Description Inserts an existing file to the list. Parameter Description position Inserting position. filename Filename of existing file. deleteOnDestroy Flag to delete the file on destroy.
!!} function insertExistingFile(position: int32_t; filename: PAnsiChar; deleteOnDestroy: bool32 = true; wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionTempFileImageList.pushBackExistingFile Declaration function pushBackExistingFile(filename: PAnsiChar; deleteOnDestroy: bool32 = true): int32_t; safecall; Description Appends an existing file to the list. Parameter Description Filename of existing file. XXX deleteOnDestroy Flag to delete the file on destroy.
!!} function pushBackExistingFile(filename: PAnsiChar; deleteOnDestroy: bool32 = true; wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionTempFileImageList.getFilename Declaration function getFilename(position: int32_t): PAnsiChar; safecall; Description Returns the filename assigned to the specified image index. Parameter Description position Index of the image filename to retrieve.
!!} function getFilename(position: int32_t; wantExceptions: bool32 = false): PAnsiChar; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionHaarTraining Declaration TIEVisionHaarTraining = interface(
) Description This interface allows you to create training samples and learn an Haar cascade classifier to recognize new objects. Methods and Properties !!} TIEVisionHaarTraining = interface(TIEVisionBase) {!! TIEVisionHaarTraining.createTrainingSamples Declaration procedure createTrainingSamples(dstSamplesFilename: PAnsiChar; sampleImage: ; backgroundImageList: ; samplesCount: int32_t; bgColor: int32_t; bgThreshold: int32_t = 80; invert: = ievNOINVERT; maxIntensityDeviation: int32_t = 40; maxXAngle: double = 1.1; maxYAngle: double = 1.1; maxZAngle: double = 0.5; width: int32_t = 24; height: int32_t = 24); overload; safecall; procedure createTrainingSamples(dstSamplesFilename: PAnsiChar; srcImageList: ; width: int32_t = 24; height: int32_t = 24); overload; safecall; Description Creates a file with a set of training sample images. First overload gets a single positive image and a list of backgrounds (negative samples) and mixes them to build the training samples file. Second overload gets a list of images specifying a set of positive rectangles for each image and builds the training samples file. Each image in srcImageList must contain bounding box of the objects to train, under the "HaarTraining.Objects" tree. The path is, for example: "HaarTraining.Objects.Marisa" contains a Rect object. "HaarTraining.Objects.Bill" contains a Rect object. Parameter Description dstSamplesFilename The resulting training samples file. sampleImage A single positive image. backgroundImageList A set of negative images. samplesCount Number of samples to generate. bgColor Background color. bgThreshold Background threshold. invert Randomly invert images. maxIntensityDeviation Maximum intensity deviation. maxXAngle Random rotation maximum X angle. maxYAngle Random rotation maximum Y angle. maxZAngle Random rotation maximum Z angle. width Sample width. height Sample height. srcImageList A set of images containing rectangles with positive samples.
See Also -
!!} procedure createTrainingSamples(dstSamplesFilename: PAnsiChar; sampleImage: TIEVisionImage; backgroundImageList: TIEVisionImageList; samplesCount: int32_t; bgColor: int32_t; bgThreshold: int32_t = 80; invert: TIEVisionHaarInvert = ievNOINVERT; maxIntensityDeviation: int32_t = 40; maxXAngle: double = 1.1; maxYAngle: double = 1.1; maxZAngle: double = 0.5; width: int32_t = 24; height: int32_t = 24; wantExceptions: bool32 = false); overload; safecall; procedure createTrainingSamples(dstSamplesFilename: PAnsiChar; srcImageList: TIEVisionImageList; width: int32_t = 24; height: int32_t = 24; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionHaarTraining.trainCascadeClassifier Declaration procedure trainCascadeClassifier(dstFilename: PAnsiChar; srcSamplesFilename: PAnsiChar; backgroundImageList: ; treeCascade: bool32 = true; stagesCount: int32_t = 14; numPrecalculated: int32_t = 200; splitsCount: int32_t = 1; minHitRate: double = 0.995; maxFalseAlarm: double = 0.5; weightFraction: double = 0.95; haarMode: = ievBASIC; verticalSymmetry: bool32 = false; equalWeights: bool32 = true; width: int32_t = 24; height: int32_t = 24; boostType: = ievGENTLE_ADABOOST; stumpError: = ievMISCLASSIFICATION_ERROR; maxTreeSplits: int32_t = 0; minPos: int32_t = 500); safecall; Description Trains an Haar cascade classifier with the specified training samples file (generated with ) and saves the classifier to file. Parameter Description dstFilename Filename to store trained Haar Classifier. srcSamplesFilename Training samples file. backgroundImageList A set of negative samples. treeCascade Undocumented. stagesCount Undocumented. numPrecalculated Undocumented. splitsCount Undocumented. minHitRate Undocumented. maxFalseAlarm Undocumented. weightFraction Undocumented. haarMode Undocumented. verticalSymmetry Undocumented. equalWeights Undocumented. width Undocumented. height Undocumented. boostType Undocumented. stumpError Undocumented. maxTreeSplits Undocumented. minPos Undocumented.
!!} procedure trainCascadeClassifier(dstFilename: PAnsiChar; srcSamplesFilename: PAnsiChar; backgroundImageList: TIEVisionImageList; treeCascade: bool32 = true; stagesCount: int32_t = 14; numPrecalculated: int32_t = 200; splitsCount: int32_t = 1; minHitRate: double = 0.995; maxFalseAlarm: double = 0.5; weightFraction: double = 0.95; haarMode: TIEVisionHaarMode = ievBASIC; verticalSymmetry: bool32 = false; equalWeights: bool32 = true; width: int32_t = 24; height: int32_t = 24; boostType: TIEVisionHaarBoostType = ievGENTLE_ADABOOST; stumpError: TIEVisionHaarStumpError = ievMISCLASSIFICATION_ERROR; maxTreeSplits: int32_t = 0; minPos: int32_t = 500; wantExceptions: bool32 = false); safecall; {!! TIEVisionHaarTraining.createCascadeClassifier Declaration function createCascadeClassifier(sampleImage:
; backgroundImageList: ; samplesCount: int32_t; treeCascade: bool32 = true; bgColor: int32_t = 0; bgThreshold: int32_t = 80; invert: = ievNOINVERT; maxIntensityDeviation: int32_t = 40; maxXAngle: double = 1.1; maxYAngle: double = 1.1; maxZAngle: double = 0.5; width: int32_t = 24; height: int32_t = 24; stagesCount: int32_t = 14; numPrecalculated: int32_t = 200; splitsCount: int32_t = 1; minHitRate: double = 0.995; maxFalseAlarm: double = 0.5; weightFraction: double = 0.95; haarMode: = ievBASIC; verticalSymmetry: bool32 = false; equalWeights: bool32 = true; boostType: = ievGENTLE_ADABOOST; stumpError: = ievMISCLASSIFICATION_ERROR; maxTreeSplits: int32_t = 0; minPos: int32_t = 500): ; safecall; Description Trains an Haar cascade classifier with the specified sample (positive) image and background samples (negative) and returns a Cascade classifier object ready to reconize the trained object. Parameter Description sampleImage One positive sample image. backgroundImageList A list of negative sample images. samplesCount Number of samples to generate. treeCascade Undocumented. bgColor Undocumented. bgThreshold Undocumented. invert Undocumented. maxIntensityDeviation Undocumented. maxXAngle Undocumented. maxYAngle Undocumented. maxZAngle Undocumented. width Undocumented. height Undocumented. stagesCount Undocumented. numPrecalculated Undocumented. splitsCount Undocumented. minHitRate Undocumented. maxFalseAlarm Undocumented. weightFraction Undocumented. haarMode Undocumented. verticalSymmetry Undocumented. equalWeights Undocumented. boostType Undocumented. stumpError Undocumented. maxTreeSplits Undocumented. minPos Undocumented.
!!} function createCascadeClassifier(sampleImage: TIEVisionImage; backgroundImageList: TIEVisionImageList; samplesCount: int32_t; treeCascade: bool32 = true; bgColor: int32_t = 0; bgThreshold: int32_t = 80; invert: TIEVisionHaarInvert = ievNOINVERT; maxIntensityDeviation: int32_t = 40; maxXAngle: double = 1.1; maxYAngle: double = 1.1; maxZAngle: double = 0.5; width: int32_t = 24; height: int32_t = 24; stagesCount: int32_t = 14; numPrecalculated: int32_t = 200; splitsCount: int32_t = 1; minHitRate: double = 0.995; maxFalseAlarm: double = 0.5; weightFraction: double = 0.95; haarMode: TIEVisionHaarMode = ievBASIC; verticalSymmetry: bool32 = false; equalWeights: bool32 = true; boostType: TIEVisionHaarBoostType = ievGENTLE_ADABOOST; stumpError: TIEVisionHaarStumpError = ievMISCLASSIFICATION_ERROR; maxTreeSplits: int32_t = 0; minPos: int32_t = 500; wantExceptions: bool32 = false): TIEVisionCascadeClassifier; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionInputOutput Declaration TIEVisionInputOutput = interface(
) Description This interface contains a set of helper input/output functions. Methods and Properties !!} TIEVisionInputOutput = interface(TIEVisionBase) {!! TIEVisionInputOutput.zcompress Declaration procedure zcompress(inputStream: ; outputStream: ; compressionLevel: int32_t = -1); safecall; Description Compresses an input stream to output stream using zlib. Parameter Description inputStream Input stream to compress. outputStream Output stream (compressed). compressionLevel Optional compression level. See below:
Compression levels: Parameter Description -1 Default compression. 0 No compression. 1 Best speed. 2..8 Compromises between speed and compression. 9 Best compression.
See Also -
!!} procedure zcompress(inputStream: TIEVisionStream; outputStream: TIEVisionStream; compressionLevel: int32_t = -1; wantExceptions: bool32 = false); safecall; {!! TIEVisionInputOutput.zdecompress Declaration procedure zdecompress(inputStream: ; outputStream: ); safecall; Description Decompresses a zlib stream. Parameter Description inputStream Input stream to decompress. outputStream Resulting decompressed stream.
See Also -
!!} procedure zdecompress(inputStream: TIEVisionStream; outputStream: TIEVisionStream; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionOptimizerFunction Declaration TIEVisionOptimizerFunction = function(userData: pointer; variables: ): double; stdcall; Description Callback used in optimization function. The optimization algorithm will try to minimize this function. Parameter Description userData User data (maybe a pointer to an application object). variables Variables of the function to minimize.
See Also -
Demo Demos\IEVision\TrackObjects_LowLevel\TrackObjects_LowLevel.dpr !!} TIEVisionOptimizerFunction = function(userData: pointer; variables: TIEVisionVectorDouble): double; stdcall; // must be stdcall //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionMath Declaration TIEVisionMath = interface() Description This interface contains a set of mathematical and logical operations with images and matrices. Methods and Properties !!} TIEVisionMath = interface(TIEVisionBase) {!! TIEVisionMath.optimizeWith_NelderMeadSimplexMethod Declaration function optimizeWith_NelderMeadSimplexMethod(func: ; funcUserData: pointer; solutions: ; out optimalValue: double; length: double = 1.0; timeout: int32_t = 1000; eps: double = 1.0e-20): bool32; safecall; Description Optimizes (minimizes) the specified function using Nelder Mead Simplex method. Returns true on success. Parameter Description func Function to optimize (minimize). funcUserData A user pointer sent to function to optimize. solutions Initial veriables and output minimizing variables. optimalValue Optimal value. length Initial length of the simplex. timeout Maximum number of iterations. eps Small real number to test convergence.
Demos Demos\IEVision\FaceDetection\FaceDetection.dpr Demos\IEVision\FaceDetection_LowLevel\FaceDetection_LowLevel.dpr Demos\IEVision\GetFaces\GetFaces.dpr Demos\IEVision\TrackObjects\TrackObjects.dpr Demos\IEVision\TrackObjects_LowLevel\TrackObjects_LowLevel.dpr Example // finds values (x0=vars[0] and x1=vars[1]) that minimze (x0-1)*(x0-1) + (x1-6)*(x1-6) function optFunc(userData: pointer; vars: TIEVisionVectorDouble): double; stdcall; var x0, x1: double; begin x0 := vars.getDouble(0); x1 := vars.getDouble(1); result := (x0-1)*(x0-1) + (x1-6)*(x1-6); end; .... // vector of input and output variables vec := IEVisionLib.createVectorDouble(); // initial values vec.push_back(-1.2); vec.push_back(1.0); // find minimizing values if not IEVisionLib.createMath().optimizeWith_NelderMeadSimplexMethod(@optFunc, nil, vec, optValue, 1.0, 1000, 1e-20) then begin x0 := vec.getDouble(0); // should be "1" x1 := vec.getDouble(1); // should be "6" // ...and optValue shoud be "0" end; .... !!} function optimizeWith_NelderMeadSimplexMethod(func: TIEVisionOptimizerFunction; funcUserData: pointer; solutions: TIEVisionVectorDouble; out optimalValue: double; length: double = 1.0; timeout: int32_t = 1000; eps: double = 1.0e-20; wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionMath.calcCovarMatrix Declaration procedure calcCovarMatrix(images:
; covMat: ; avg: ; flags: ); safecall; Description Calculates covariant matrix of specified images (matrices). Parameter Description images A list of images of the same size. covMat Output covariant matrix. avg Average of all input matrices. flags Oprational flags.
!!} procedure calcCovarMatrix(images: TIEVisionVectorImageRef; covMat: TIEVisionImage; avg: TIEVisionImage; flags: TIEVisionCovarFlags; wantExceptions: bool32 = false); safecall; {!! TIEVisionMath.cartToPolar Declaration procedure cartToPolar(x:
; y: ; magnitude: ; angle: ; angleInDegrees: bool32 = false); safecall; Description Calculates the magnitude and angle of 2D vectors. Parameter Description x Array of x-coordinates. This must be a single-precision or double-precision floating-point array. y Array of y-coordinates that must have the same size and same type as x. magnitude Destination array of magnitudes of the same size and type as x . angle Destination array of angles that has the same size and type as x. The angles are measured in radians (from 0 to 2*Pi) or in degrees (0 to 360 degrees). angleInDegrees Flag indicating whether the angles are measured in radians, which is the default mode, or in degrees.
!!} procedure cartToPolar(x: TIEVisionImage; y: TIEVisionImage; magnitude: TIEVisionImage; angle: TIEVisionImage; angleInDegrees: bool32 = false; wantExceptions: bool32 = false); safecall; {!! TIEVisionMath.genericMultiply Declaration procedure genericMultiply(src1:
; src2: ; alpha: double; src3: ; beta: double; dest: ; flags: = ievGEMM_NONE); safecall; Description Performs generalized matrix multiplication. Parameter Description src1 First multiplied input matrix that should have 32 bit floating point (1 channel), 64 bit floating point (1 channel) , 32 bit floating point (2 channels), or 64 bit floating point (2 channels) type. src2 Second multiplied input matrix of the same type as src1 . alpha Weight of the matrix product. src3 Third optional delta matrix added to the matrix product. It should have the same type as src1 and src2. beta Weight of src3. dest Destination matrix. It has the proper size and the same type as input matrices. flags Operation flag.
!!} procedure genericMultiply(src1: TIEVisionImage; src2: TIEVisionImage; alpha: double; src3: TIEVisionImage; beta: double; dest: TIEVisionImage; flags: TIEVisionGEMMFlags = ievGEMM_NONE; wantExceptions: bool32 = false); safecall; {!! TIEVisionMath.mahalonobisDistance Declaration function mahalonobisDistance(vec1:
; vec2: ; invCovMatrix: ): double; safecall; Description Calculates the Mahalanobis distance between two vectors. Parameter Description vec1 First 1D source vector. vec2 Second 1D source vector. invCovMatrix Inverse covariance matrix.
!!} function mahalonobisDistance(vec1: TIEVisionImage; vec2: TIEVisionImage; invCovMatrix: TIEVisionImage; wantExceptions: bool32 = false): double; safecall; {!! TIEVisionMath.solve Declaration function solve(source1:
; source2: ; dest: ; method: ): int32_t; safecall; Description Solves one or more linear systems or least-squares problems. Parameter Description source1 Input matrix on the left-hand side of the system. source2 Input matrix on the right-hand side of the system. dest Output solution. method Solution (matrix inversion) method.
!!} function solve(source1: TIEVisionImage; source2: TIEVisionImage; dest: TIEVisionImage; method: TIEVisionSolveMethod; wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionMath.solveCubic Declaration procedure solveCubic(coeffs:
; roots: ); safecall; Description Finds the real roots of a cubic equation. Parameter Description coeffs Equation coefficients, an array of 3 or 4 elements. roots Destination array of real roots that has 1 or 3 elements.
!!} procedure solveCubic(coeffs: TIEVisionImage; roots: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionMath.sub Declaration procedure sub(lhs:
; rhs: ; dest: ; mask: ); overload; safecall; procedure sub(lhs: ; rhs: ; dest: ); overload; safecall; procedure sub(lhs: ; rhs: ; dest: ; mask: ); overload; safecall; procedure sub(lhs: ; rhs: ; dest: ); overload; safecall; procedure sub(lhs: ; rhs: ; dest: ; mask: ); overload; safecall; procedure sub(lhs: ; rhs: ; dest: ); overload; safecall; Description Subtracts left-hand side image (matrix) or scalar to the right-hand side image (matrix) or scalar and puts resulting image (matrix) in the specified destination. Parameter Description lhs Left-hand side image or scalar. rhs Right-hand side image or scalar. dest Container for the resulting image (or matrix). mask Optional operation mask.
!!} procedure sub(lhs: TIEVisionImage; rhs: TIEVisionImage; dest: TIEVisionImage; mask: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure sub(lhs: TIEVisionImage; rhs: TIEVisionImage; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure sub(lhs: TIEVisionScalar; rhs: TIEVisionImage; dest: TIEVisionImage; mask: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure sub(lhs: TIEVisionScalar; rhs: TIEVisionImage; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure sub(lhs: TIEVisionImage; rhs: TIEVisionScalar; dest: TIEVisionImage; mask: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure sub(lhs: TIEVisionImage; rhs: TIEVisionScalar; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionMath.add Declaration procedure add(lhs:
; rhs: ; dest: ; mask: ); overload; safecall; procedure add(lhs: ; rhs: ; dest: ); overload; safecall; procedure add(lhs: ; rhs: ; dest: ; mask: ); overload; safecall; procedure add(lhs: ; rhs: ; dest: ); overload; safecall; Description Adds left-hand side iamge (matrix) or scalar to the right-hand side image (matrix) or scalar and puts resulting image (matrix) in the specified destination. Parameter Description lhs Left-hand side image or scalar. rhs Right-hand side image or scalar. dest Container for the resulting image (or matrix). mask Optional operation mask.
!!} procedure add(lhs: TIEVisionImage; rhs: TIEVisionImage; dest: TIEVisionImage; mask: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure add(lhs: TIEVisionImage; rhs: TIEVisionImage; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure add(lhs: TIEVisionImage; rhs: TIEVisionScalar; dest: TIEVisionImage; mask: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure add(lhs: TIEVisionImage; rhs: TIEVisionScalar; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionMath.absDiff Declaration procedure absDiff(lhs:
; rhs: ; dest: ); overload; safecall; procedure absDiff(lhs: ; rhs: ; dest: ); overload; safecall; Description Calculates absolute difference of left-hand side image (matrix) and right-hand side image (matrix) or scalar and puts resulting image (matrix) in the specified destination. Parameter Description lhs Left-hand side image (matrix). rhs Right-hand side image (matrix) or scalar. dest Container for the resulting image (or matrix).
!!} procedure absDiff(lhs: TIEVisionImage; rhs: TIEVisionImage; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure absDiff(lhs: TIEVisionImage; rhs: TIEVisionScalar; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionMath.opAnd Declaration procedure opAnd(lhs:
; rhs: ; dest: ); overload; safecall; procedure opAnd(lhs: ; rhs: ; dest: ; mask: ); overload; safecall; procedure opAnd(lhs: ; rhs: ; dest: ; mask: ); overload; safecall; procedure opAnd(lhs: ; rhs: ; dest: ); overload; safecall; Description Performs bitwise and of left-hand side image (matrix) and right-hand side image (matrix) or scalar and puts resulting image (matrix) in the specified destination. Parameter Description lhs Left-hand side image (matrix). rhs Right-hand side image or scalar (matrix). dest Container for the resulting image (or matrix). mask Operation mask.
!!} procedure opAnd(lhs: TIEVisionImage; rhs: TIEVisionImage; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure opAnd(lhs: TIEVisionImage; rhs: TIEVisionImage; dest: TIEVisionImage; mask: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure opAnd(lhs: TIEVisionImage; rhs: TIEVisionScalar; dest: TIEVisionImage; mask: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure opAnd(lhs: TIEVisionImage; rhs: TIEVisionScalar; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionMath.opDiv Declaration procedure opDiv(lhs:
; rhs: ; dest: ; scale: double = 1.0); safecall; Description Divides left-hand side image (matrix) with right-side image (matrix) and puts resulting image (matrix) in the specified destination. Parameter Description lhs Left-hand side image (matrix). rhs Right-hand side image (matrix). dest Container for the resulting image (or matrix). scale Optional scalar multiplier.
!!} procedure opDiv(lhs: TIEVisionImage; rhs: TIEVisionImage; dest: TIEVisionImage; scale: double = 1.0; wantExceptions: bool32 = false); safecall; {!! TIEVisionMath.exp Declaration procedure exp(src:
; dest: ); safecall; Description Calculates the exponent of every image element. Parameter Description src Source image (matrix). dest Container for the resulting image (matrix).
!!} procedure exp(src: TIEVisionImage; dest: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionMath.log Declaration procedure log(src:
; dest: ); safecall; Description Calculates the natural logarithm of every image element. Parameter Description src Source image (matrix). dest Container for the resulting image (matrix).
!!} procedure log(src: TIEVisionImage; dest: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionMath.mul Declaration procedure mul(lhs:
; rhs: ; dest: ; scale: double = 1.0); safecall; Description Calculates the per-element scaled product of two images. Parameter Description lhs Left-hand side image (matrix). rhs Right-hand side image (matrix). dest Container for the resulting image (matrix). scale Optional scalar multiplier.
!!} procedure mul(lhs: TIEVisionImage; rhs: TIEVisionImage; dest: TIEVisionImage; scale: double = 1.0; wantExceptions: bool32 = false); safecall; {!! TIEVisionMath.opOr Declaration procedure opOr(lhs:
; rhs: ; dest: ; mask: ); overload; safecall; procedure opOr(lhs: ; rhs: ; dest: ); overload; safecall; procedure opOr(lhs: ; rhs: ; dest: ; mask: ); overload; safecall; procedure opOr(lhs: ; rhs: ; dest: ); overload; safecall; Description Calculates the per-element bit-wise disjunction of two images or an image and a scalar. Parameter Description lhs Left-hand side image (matrix). rhs Right-hand side image (matrix). dest Container for the resulting image (matrix). mask Optional operation mask.
!!} procedure opOr(lhs: TIEVisionImage; rhs: TIEVisionImage; dest: TIEVisionImage; mask: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure opOr(lhs: TIEVisionImage; rhs: TIEVisionImage; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure opOr(lhs: TIEVisionImage; rhs: TIEVisionScalar; dest: TIEVisionImage; mask: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure opOr(lhs: TIEVisionImage; rhs: TIEVisionScalar; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionMath.pow Declaration procedure pow(src:
; dest: ; power: double); safecall; Description Raises every image element to a power. Parameter Description src Source image (matrix). dest Container for the resulting image (matrix). power Exponent of power.
!!} procedure pow(src: TIEVisionImage; dest: TIEVisionImage; power: double; wantExceptions: bool32 = false); safecall; {!! TIEVisionMath.trace Declaration function trace(src:
): ; safecall; Description Returns the trace of a matrix. Parameter Description src Source image.
!!} function trace(src: TIEVisionImage; wantExceptions: bool32 = false): TIEVisionScalar; safecall; {!! TIEVisionMath.transform Declaration procedure transform(src:
; dest: ; transfMatrix: ); overload; safecall; Description Performs the matrix transformation of every image element. Parameter Description src Source image (matrix). dest Container for the resulting image (matrix). transfMatrix Transformation 2x2 or 2x3 floating-point matrix.
!!} procedure transform(src: TIEVisionImage; dest: TIEVisionImage; transfMatrix: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionMath.transpose Declaration procedure transpose(src:
; dest: ); safecall; Description Transposes a matrix. Parameter Description src Source image (matrix). dest Container for the resulting image (matrix).
!!} procedure transpose(src: TIEVisionImage; dest: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionMath.opXor Declaration procedure opXor(lhs:
; rhs: ; dest: ; mask: ); overload; safecall; procedure opXor(lhs: ; rhs: ; dest: ); overload; safecall; procedure opXor(lhs: ; rhs: ; dest: ; mask: ); overload; safecall; procedure opXor(lhs: ; rhs: ; dest: ); overload; safecall; Description Calculates the per-element bit-wise "exclusive or" operation on two images (matrix) or an image (matrix) and a scalar. Parameter Description lhs Left-hand side image (matrix). rhs Right-hand side image (matrix). dest Container for the resulting image (matrix). mask Operation mask.
!!} procedure opXor(lhs: TIEVisionImage; rhs: TIEVisionImage; dest: TIEVisionImage; mask: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure opXor(lhs: TIEVisionImage; rhs: TIEVisionImage; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure opXor(lhs: TIEVisionImage; rhs: TIEVisionScalar; dest: TIEVisionImage; mask: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; procedure opXor(lhs: TIEVisionImage; rhs: TIEVisionScalar; dest: TIEVisionImage; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionMath.boundingRect Declaration function boundingRect(points:
): ; safecall; Description Calculates the up-right bounding rectangle of a point set. Parameter Description points Point set.
!!} function boundingRect(points: TIEVisionVectorPoint; wantExceptions: bool32 = false): TIEVisionRect; safecall; {!! TIEVisionMath.contourArea Declaration function contourArea(points:
): double; safecall; Description Calculates a contour area. Parameter Description points Contour vertices.
!!} function contourArea(points: TIEVisionVectorPoint; wantExceptions: bool32 = false): double; safecall; {!! TIEVisionMath.rectIntersect Declaration function rectIntersect(const rect1:
; const rect2: ): ; safecall; Description Returns the intersection of two rectangles. Parameter Description rect1 First rectangle. rect2 Second rectangle.
!!} function rectIntersect(const rect1: TIEVisionRect; const rect2: TIEVisionRect; wantExceptions: bool32 = false): TIEVisionRect; safecall; {!! TIEVisionMath.rectTestIntersect Declaration function rectTestIntersect(const rect1:
; const rect2: ): bool32; safecall; Description Tests if two rectangles intersect. Parameter Description rect1 First rectangle. rect2 Second rectangle.
!!} function rectTestIntersect(const rect1: TIEVisionRect; const rect2: TIEVisionRect; wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionMath.rectUnion Declaration function rectUnion(const rect1:
; const rect2: ): ; safecall; Description Returns the union of two rectangles. Parameter Description rect1 First rectangle. rect2 Second rectangle.
!!} function rectUnion(const rect1: TIEVisionRect; const rect2: TIEVisionRect; wantExceptions: bool32 = false): TIEVisionRect; safecall; {!! TIEVisionMath.rectContains Declaration function rectContains(const rect:
; const point: ): bool32; safecall; Description Tests if a point is inside a rectangle. Parameter Description rect Rectangle. point Point to test.
!!} function rectContains(const rect: TIEVisionRect; const point: TIEVisionPoint; wantExceptions: bool32 = false): bool32; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionDrawing Declaration TIEVisionDrawing = interface(
) Description This interface contains a set of drawing primitives, to paint over a objects. Methods and Properties !!} TIEVisionDrawing = interface(TIEVisionBase) {!! TIEVisionDrawing.rectangle Declaration procedure rectangle(image: ; pt1: ; pt2: ; const color: ; thickness: int32_t = 1; linetype: int32_t = 8; shift: int32_t = 0); overload; safecall; procedure rectangle(image: ; const rect: ; const color: ; thickness: int32_t = 1; linetype: int32_t = 8; shift: int32_t = 0); overload; safecall; Description Draws a rectangle. Parameter Description image Destination image. pt1 Top-left rectangle point. pt2 Bottom-right rectangle point. color Rectangle color. thickness Line width. linetype Line type. shift Thickness of lines that make up the rectangle. Negative values mean that the function has to draw a filled rectangle. rect Number of fractional bits in the point coordinates.
!!} procedure rectangle(image: TIEVisionImage; pt1: TIEVisionPoint; pt2: TIEVisionPoint; const color: TIEVisionScalar; thickness: int32_t = 1; linetype: int32_t = 8; shift: int32_t = 0; wantExceptions: bool32 = false); overload; safecall; procedure rectangle(image: TIEVisionImage; const rect: TIEVisionRect; const color: TIEVisionScalar; thickness: int32_t = 1; linetype: int32_t = 8; shift: int32_t = 0; wantExceptions: bool32 = false); overload; safecall; {!! TIEVisionDrawing.circle Declaration procedure circle(image:
; center: ; radius: int32_t; color: ; thickness: int32_t = 1; linetype: int32_t = 8; shift: int32_t = 0); safecall; Description Draw a circle. Parameter Description image Destination image. center Center of the circle. radius Radius of the circle. color Rectangle color. thickness Line width. linetype Line type. shift Thickness of lines that make up the rectangle. Negative values mean that the function has to draw a filled circle.
!!} procedure circle(image: TIEVisionImage; center: TIEVisionPoint; radius: int32_t; color: TIEVisionScalar; thickness: int32_t = 1; linetype: int32_t = 8; shift: int32_t = 0; wantExceptions: bool32 = false); safecall; {!! TIEVisionDrawing.ellipse Declaration procedure ellipse(image:
; center: ; axes: ; angle: double; startAngle: double; endAngle: double; color: ; thickness: int32_t = 1; linetype: int32_t = 8; shift: int32_t = 0); safecall; Description Draws an ellipse. Parameter Description image Destination image. center Center of the ellipse. axes Length of the ellipse axes. angle Ellipse rotation angle in degrees. startAngle Starting angle of the elliptic arc in degrees. endAngle Ending angle of the elliptic arc in degrees. color Rectangle color. thickness Line width. linetype Line type. shift Thickness of lines that make up the rectangle. Negative values mean that the function has to draw a filled ellipse.
!!} procedure ellipse(image: TIEVisionImage; center: TIEVisionPoint; axes: TIEVisionSize; angle: double; startAngle: double; endAngle: double; color: TIEVisionScalar; thickness: int32_t = 1; linetype: int32_t = 8; shift: int32_t = 0; wantExceptions: bool32 = false); safecall; {!! TIEVisionDrawing.drawContours Declaration procedure drawContours(image:
; contours: ; const color: ; contourIdx: int32_t = -1; thickness: int32_t = 1; linetype: int32_t = 8); safecall; Description Draws a contour. Parameter Description image Destination image. contours A vector of vector of points. (TIEVisionVectorObjRef must contain objects). color Rectangle color. thickness Line width. linetype Line type. shift Thickness of lines that make up the rectangle. Negative values mean that the function has to draw a filled polygon.
!!} procedure drawContours(image: TIEVisionImage; contours: TIEVisionVectorObjRef; const color: TIEVisionScalar; contourIdx: int32_t = -1; thickness: int32_t = 1; linetype: int32_t = 8; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionObjectTracker Declaration TIEVisionObjectTracker = interface() Description This interface allows you to track an objected given its initial position. Tracking is performed using Camshift algorithm. Demo Demos\IEVision\TrackObjects\TrackObjects.dpr Methods and Properties See Also - !!} TIEVisionObjectTracker = interface(TIEVisionBase) {!! TIEVisionObjectTracker.setInitialPosition Declaration procedure setInitialPosition(image: ; const window: ); safecall; Description Sets the initial object position. Parameter Description image Source image (where the object stays). window Coordinates of rectangle containing the object.
See Also -
Demo Demos\IEVision\TrackObjects\TrackObjects.dpr !!} procedure setInitialPosition(image: TIEVisionImage; const window: TIEVisionRect; wantExceptions: bool32 = false); safecall; {!! TIEVisionObjectTracker.locateNewPosition Declaration function locateNewPosition(image: ; out backProjectedImage: ): ; safecall; Description Locates the new position of the object. Before call locateNewPosition you must call . Parameter Description image Source image. backProjectedImage Image resulting of backprojection of object histogram.
See Also -
Demo Demos\IEVision\TrackObjects\TrackObjects.dpr !!} function locateNewPosition(image: TIEVisionImage; out backProjectedImage: TIEVisionImage; wantExceptions: bool32 = false): TIEVisionRotatedRect; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionObjectsFinder Declaration TIEVisionObjectsFinder = interface() Description This interface allows you to find an object or a set of different objects. It is possible to load more than one classifier (object detector). Each classifier is executed on a different thread. Demos Demos\IEVision\FaceDetection\FaceDetection.dpr Demos\IEVision\GetFaces\GetFaces.dpr Methods and Properties See Also Example var objectsFinder: TIEVisionObjectsFinder; rects: TIEVisionVectorRect; ... // load two face detectors objectsFinder := IEVisionLib.createObjectsFinder(); objectsFinder.addClassifier('face detector 1', IEVisionLib.createCascadeClassifier(IEVC_FRONTAL_FACE_ALT_TREE)); objectsFinder.addClassifier('face detector 2', IEVisionLib.createCascadeClassifier(IEVC_FRONTAL_FACE_DEFAULT)); // detect objects objectsFinder.findIn(ImageEnView1.IEBitmap.GetIEVisionImage()); // merge intersecting rectangles of all searched objects rects := objectsFinder.mergeAllRects(); // loop among rectangles for i := 0 to rects.size-1 do begin ImageEnView1.ObjPenWidth[-1] := 2; with rects.getRect(i) do begin ... do something with the rectangle coordinates and size end; end; !!} TIEVisionObjectsFinder = interface(TIEVisionBase) {!! TIEVisionObjectsFinder.addClassifier Declaration procedure addClassifier(name: PAnsiChar; classifier: ); safecall; Description Adds a new classifier (object detector) to the classifiers set. Parameter Description name Name of the classifier. This name is used only for the user convenience. classifier Actual object detector.
See Also -
- Example // load two face detectors objectsFinder := IEVisionLib.createObjectsFinder(); objectsFinder.addClassifier('face detector 1', IEVisionLib.createCascadeClassifier(IEVC_FRONTAL_FACE_ALT_TREE); objectsFinder.addClassifier('face detector 2', IEVisionLib.createCascadeClassifier(IEVC_FRONTAL_FACE_DEFAULT)); !!} procedure addClassifier(name: PAnsiChar; classifier: TIEVisionBase; wantExceptions: bool32 = false); safecall; {!! TIEVisionObjectsFinder.getClassifier Declaration function getClassifier(name: PAnsiChar): ; safecall; Description Returns the classifier added with this name. Parameter Description name Classifier name to find.
!!} function getClassifier(name: PAnsiChar; wantExceptions: bool32 = false): TIEVisionBase; safecall; {!! TIEVisionObjectsFinder.findIn Declaration procedure findIn(image:
); safecall; Description Loops among all added classifiers to find objects inside the specified image. Objects found are returned by and . Parameter Description image Image where to find the objects.
Example // detect objects objectsFinder.findIn(ImageEnView1.IEBitmap.GetIEVisionImage()); !!} procedure findIn(image: TIEVisionImage; wantExceptions: bool32 = false); safecall; {!! TIEVisionObjectsFinder.getFoundRectCount Declaration function getFoundRectCount(name: PAnsiChar): int32_t; safecall; Description Returns number of found objects for the specified object detector. Parameter Description name Object detector.
See Also -
- - - Example objectsFinder.findIn(image); foundRects := objectsFinder.getFoundRectCount('face detector 1'); !!} function getFoundRectCount(name: PAnsiChar; wantExceptions: bool32 = false): int32_t; safecall; {!! TIEVisionObjectsFinder.getFoundRect Declaration function getFoundRect(name: PAnsiChar; index: int32_t): ; safecall; Description Returns the nth object found for the specified object detector. Parameter Description name Name of object detector. index Index of found rectangle.
See Also -
- - - Example objectsFinder.findIn(image); foundRects := objectsFinder.getFoundRectCount('face detector 1'); for i := 0 to foundRects-1 do with GetFoundRect('face detector 1', i) do begin // do something with x, y and width, height end; !!} function getFoundRect(name: PAnsiChar; index: int32_t; wantExceptions: bool32 = false): TIEVisionRect; safecall; {!! TIEVisionObjectsFinder.mergeRects Declaration function mergeRects(name1: PAnsiChar; name2: PAnsiChar): ; safecall; Description Merges rectangles that intersect of the specified objects detectors. Parameter Description name1 Name of an object detector. name2 Name of an object detector.
See Also -
- - - Example // detect objects objectsFinder.findIn(image); // merge intersecting rectangles of "face1" and "face2" detectors rects := objectsFinder.mergeRects("face1", "face2"); // loop among rectangles for i := 0 to rects.size-1 do begin ImageEnView1.ObjPenWidth[-1] := 2; with rects.getRect(i) do begin ... do something with the rectangle coordinates and size end; end; !!} function mergeRects(name1: PAnsiChar; name2: PAnsiChar; wantExceptions: bool32 = false): TIEVisionVectorRect; safecall; {!! TIEVisionObjectsFinder.mergeAllRects Declaration function mergeAllRects(): ; safecall; Description Merges rectangles that intersect of all object detectors. See Also - - - - Example // detect objects objectsFinder.findIn(image); // merge intersecting rectangles rects := objectsFinder.mergeAllRects(); // loop among rectangles for i := 0 to rects.size-1 do begin ImageEnView1.ObjPenWidth[-1] := 2; with rects.getRect(i) do begin ... do something with the rectangle coordinates and size end; end; !!} function mergeAllRects(wantExceptions: bool32 = false): TIEVisionVectorRect; safecall; {!! TIEVisionObjectsFinder.removeAllClassifiers Declaration procedure removeAllClassifiers(); safecall; Description Removes all added classifiers. See Also - - !!} procedure removeAllClassifiers(wantExceptions: bool32 = false); safecall; {!! TIEVisionObjectsFinder.classifierExists Declaration function classifierExists(name: PAnsiChar): bool32; safecall; Description Tests if a classifier has been loaded. Parameter Description name Name of classifier to test presence.
!!} function classifierExists(name: PAnsiChar; wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionObjectsFinder.removeClassifier Declaration procedure removeClassifier(name: PAnsiChar); safecall; Description Removes the specified classifier. Parameter Description name Classifier to remove.
See Also -
!!} procedure removeClassifier(name: PAnsiChar; wantExceptions: bool32 = false); safecall; {!! TIEVisionObjectsFinder.setDivisor Declaration procedure setDivisor(value: int32_t); safecall; Description Sets the divisor value. A temporary image is created subsampling the source image by the divisor factor. Object detector will look for the object inside the temporary image, instead of full image. Default value is 3 (divide source image by 3). For fine (but slow) detection sets to 1. Parameter Description value Divisor value.
Example objectfinder.setDivisor(1); objectsFinder.findIn(image); !!} procedure setDivisor(value: int32_t; wantExceptions: bool32 = false); safecall; {!! TIEVisionObjectsFinder.setHaarScaleFactor Declaration procedure setHaarScaleFactor(value: double); safecall; Description Scale factor specifies how much the image size is reduced at each image scale. Default: 1.1 Note: This setting is specific to the Haar Classifier. Parameter Description value Scale factor value.
!!} procedure setHaarScaleFactor(value: double; wantExceptions: bool32 = false); safecall; {!! TIEVisionObjectsFinder.setHaarMinNeighbors Declaration procedure setHaarMinNeighbors(value: int32_t); safecall; Description Haar minimum neighbors specifies how many neighbors each candiate rectangle should have to retain it. Default: 3 Note: This setting is specific to the Haar Classifier. Parameter Description value Minimum neighbors value.
Example objectsFinder.setHaarMinNeighbors(4); objectsFinder.findIn(image); !!} procedure setHaarMinNeighbors(value: int32_t; wantExceptions: bool32 = false); safecall; {!! TIEVisionObjectsFinder.setHaarFlags Declaration procedure setHaarFlags(value:
); safecall; Description Specifies Haar classifier flags. Default: ievDO_CANNY_PRUNING Note: This setting is specific to the Haar Classifier. Parameter Description value Haar flags.
!!} procedure setHaarFlags(value: TIEVisionHaarDetectObjectsFlags; wantExceptions: bool32 = false); safecall; {!! TIEVisionObjectsFinder.setEqualizeHistogram Declaration procedure setEqualizeHistogram(value: bool32); safecall; Description If true an histogram equalization is performed before objects detection. Default: true !!} procedure setEqualizeHistogram(value: bool32; wantExceptions: bool32 = false); safecall; {!! TIEVisionObjectsFinder.setHaarMinSize Declaration procedure setHaarMinSize(size:
); safecall; Description Sets the minimum size of detected object. Default: (0, 0) !!} procedure setHaarMinSize(size: TIEVisionSize; wantExceptions: bool32 = false); safecall; {!! TIEVisionObjectsFinder.setHaarMaxSize Declaration procedure setHaarMaxSize(size: ); safecall; Description Sets the maximum size of detected object. Default: (0, 0) !!} procedure setHaarMaxSize(size: TIEVisionSize; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionOCR Declaration TIEVisionOCR = interface() Description This interface allows you to perform basic OCR (Optical Character Recognition) in English and 35 other languages. It is possible to recognize a specific image area or the whole image. For recognition it means: - gets the ANSI or Unicode text from raster image - estimates the document orientation (text angle) - gets each recognized character position (bounding box) - gets text regions (to reproduce text layout) To support OCR language specify the path of the language file when calling IEVisionLib.createOCR. Only one single instance of this object can exist in your application. Demos Demos\IEVision\OCR\OCR.dpr Demos\IEVision\OCRwithLayout\OCRwithLayout.dpr Methods and Properties See Also Example // perform OCR str := IEVisionLib.createOCR(IEOCRLanguageList[OCR_English_language].Code).recognize(ImageEnView1.IEBitmap.GetIEVisionImage(), IEVisionRect(0, 0, 0, 0)).c_str(); !!} TIEVisionOCR = interface(TIEVisionBase) {!! TIEVisionOCR.recognize Declaration function recognize(image: ; const rect: ): ; safecall; Description Performs OCR on the specified area of the image returning an ANSI string. Parameter Description image Source image. rect Rectangle of interest. Setting (0, 0, 0, 0) means "entire image".
Example 1 // perform OCR OCR := IEVisionLib.createOCR(IEOCRLanguageList[OCR_English_language].Code); str := OCR.recognize(ImageEnView1.IEBitmap.GetIEVisionImage(), IEVisionRect(0, 0, 0, 0)).c_str(); Example 2 Allow switching of language: // Set language based on selection Case LanguageRadioGroup.ItemIndex of 0 : OCR := IEVisionLib.createOCR(IEOCRLanguageList[OCR_English_language].Code); 1 : OCR := IEVisionLib.createOCR(IEOCRLanguageList[OCR_French_language].Code); 2 : OCR := IEVisionLib.createOCR(IEOCRLanguageList[OCR_German_language].Code); End; // Perform OCR str := OCR.recognize(ImageEnView1.IEBitmap.GetIEVisionImage(), IEVisionRect(0, 0, 0, 0)).c_str(); // Reset OCR object OCR := nil; !!} function recognize(image: TIEVisionImage; const rect: TIEVisionRect; wantExceptions: bool32 = false): TIEVisionWString; safecall; {!! TIEVisionOCR.clearAdaptiveInfo Declaration procedure clearAdaptiveInfo(); safecall; Description Removes adaptive information. Call this method whenever a new page or document must be processed. Example // perform OCR OCR := IEVisionLib.createOCR(IEOCRLanguageList[OCR_English_language].Code); // english language // page 0 str_page0 := OCR.recognize(image_page0, IEVisionRect(0, 0, 0, 0)); // page 1 OCR.clearAdaptiveInfo(); str_page1 := OCR.recognize(image_page1, IEVisionRect(0, 0, 0, 0)); // page 2 OCR.clearAdaptiveInfo(); str_page2 := OCR.recognize(image_page2, IEVisionRect(0, 0, 0, 0)); !!} procedure clearAdaptiveInfo(wantExceptions: bool32 = false); safecall; {!! TIEVisionOCR.isWordValid Declaration function isWordValid(word: PAnsiChar): bool32; safecall; Description Tests if the specified word is valid for currently loaded language. Parameter Description word Word to test.
!!} function isWordValid(word: PAnsiChar; wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionOCR.getBoxes Declaration function getBoxes():
; safecall; Description Returns a rectangle position and size for each recognized character. Example // Draw rectangles around recognized characters procedure TMainForm.Button2Click(Sender: TObject); var boxes: TIEVisionVectorOCRBox; i: integer; begin ImageEnView1.IEBitmap.Canvas.Pen.Color := clRed; ImageEnView1.IEBitmap.Canvas.Brush.Style := bsClear; boxes := m_OCR.getBoxes(); for i := 0 to boxes.size()-1 do with boxes.getOCRBox(i) do ImageEnView1.IEBitmap.Canvas.Rectangle(rect.x, rect.y, rect.x+rect.width, rect.y+rect.height); ImageEnView1.Update(); end; !!} function getBoxes(wantExceptions: bool32 = false): TIEVisionVectorOCRBox; safecall; {!! TIEVisionOCR.getTextAngle Declaration function getTextAngle(): single; overload; safecall; function getTextAngle(image: ): single; overload; safecall; Description Returns text angle (orientation) in radians. First overload takes last processed image as input. Second overload takes the specified image as input. Parameter Description image Source image.
See also:
Example // detect orientation angle := OCR.getTextAngle(image) * 180 / PI; ImageEnView1.IEBitmap.Origin := ieboBOTTOMLEFT; ImageEnView1.Proc.Rotate(-angle); !!} function getTextAngle(wantExceptions: bool32 = false): single; overload; safecall; function getTextAngle(image: TIEVisionImage; wantExceptions: bool32 = false): single; overload; safecall; {!! TIEVisionOCR.getRegions Declaration function getRegions(textOnly: bool32 = false): ; overload; safecall; function getRegions(image: ; textOnly: bool32 = false): ; overload; safecall; Description Detects text regions (layout). In order to get document layout applications must set to ievOCRAUTO. First overload takes last processed image as input. Second overload takes the specified image as input. Parameter Description image Source image. textOnly If true then returns only text regions.
Example OCR.setSegmentationMode(ievOCRAUTO); regions := OCR.getRegions(image); for i := 0 to regions.size()-1 do with regions.getRect(i) do begin str := m_OCR.recognize(image, IEVisionRect(x, y, width, height)); end; !!} function getRegions(textOnly: bool32 = false; wantExceptions: bool32 = false): TIEVisionVectorRect; overload; safecall; function getRegions(image: TIEVisionImage; textOnly: bool32 = false; wantExceptions: bool32 = false): TIEVisionVectorRect; overload; safecall; {!! TIEVisionOCR.setSegmentationMode Declaration procedure setSegmentationMode(value:
); safecall; Description Specifies segmentation mode. Note: setSegmentationMode requires the support file Osd.TrainedData for all languages Parameter Description value Segmentation mode to set.
Example OCR.setSegmentationMode(ievOCRAUTO); !!} procedure setSegmentationMode(value: TIEVisionOCRPageSegmentationMode; wantExceptions: bool32 = false); safecall; {!! TIEVisionOCR.getWordBoxes Declaration function getWordBoxes():
; safecall; Description Extracts words as Unicode text and their bounding boxes. Returns a list of objects. Example var boxes: TIEVisionVectorObjRef; box: TIEVisionOCRWordBox; i: integer; begin ImageEnView1.IEBitmap.Canvas.Pen.Color := clBlue; ImageEnView1.IEBitmap.Canvas.Brush.Style := bsClear; boxes := m_OCR.getWordBoxes(); for i := 0 to boxes.size() - 1 do begin box := TIEVisionOCRWordBox( boxes.getObj(i) ); with box.getBox() do ImageEnView1.IEBitmap.Canvas.Rectangle(x, y, x + width, y + height); end; ImageEnVect1.Update(); end; !!} function getWordBoxes(wantExceptions: bool32 = false): TIEVisionVectorObjRef; safecall; {!! TIEVisionOCR.getOrientation Declaration procedure getOrientation(out orientation: ; out writingDirection: ; out textlineOrder: ; out deskewAngle: single; wantExceptions: bool32 = false); safecall; Description Return detail on the orientation, rotation and text direction of the document. This can be used for non-OCR applications, such as automatically correcting the rotation of scanned documents. getOrientation should be called after or . Parameter Description orientation Character orientation, mainly used for document orientation, e.g. a page scanned upside-down would return ievOCROrientPAGE_DOWN writingDirection Writing direction textlineOrder Line direction, e.g. Right-to-left for Arabic or Hebrew, or Top-to-bottom for some Asian text deskewAngle Deskew angle in radians in the range -Pi/4 and Pi/4. The level of rotation required to correct a document scanned at an angle
Note: getOrientation requires the support file Osd.TrainedData for all languages Example // AUTOMATICALLY ROTATE CURRENT DOCUMENT IMAGE TO CORRECT ORIENTATION // Create OCR Engine m_OCR := IEVisionLib.createOCR( sOcrFilesPath, IEOCRLanguageList[ OCR_English_language ].Code, ievOCRFAST ); // Detect orientation m_OCR.setSegmentationMode( ievOCRAUTO_OSD ); angle := m_OCR.getTextAngle( ImageEnView1.IEBitmap.GetIEVisionImage() ) * 180 / PI; // Retrieve orientation details m_OCR.getOrientation( orientation, writingDirection, textlineOrder, deskewAngle ); deskewAngle := -deskewAngle * 180 / PI; if orientation = ievOCROrientPAGE_RIGHT then deskewAngle := deskewAngle - 90 else if orientation = ievOCROrientPAGE_DOWN then deskewAngle := deskewAngle - 180 else if orientation = ievOCROrientPAGE_LEFT then deskewAngle := deskewAngle - 270; if deskewAngle <> 0 then ImageEnView1.Proc.Rotate( -deskewAngle ); !!} procedure getOrientation(out orientation: TIEVisionOCROrientation; out writingDirection: TIEVisionOCRWritingDirection; out textlineOrder: TIEVisionOCRTextlineOrder; out deskewAngle: single; wantExceptions: bool32 = false); safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionPeopleDetector Declaration TIEVisionPeopleDetector = interface(
) Description This interface allows you to perform people (body) detection. Demo Demos\IEVision\GetPeople\GetPeople.dpr Methods and Properties See Also Example detector := IEVisionLib.createPeopleDetector(); found_rectangles := detector.detect(ImageEnView1.IEBitmap.GetIEVisionImage()); for i := 0 to found_rectangles.size()-1 do with found_rectangles.getRect(i) do begin ImageEnView1.IEBitmap.Canvas.Brush.Style := bsClear; ImageEnView1.IEBitmap.Canvas.Pen.Color := clRed; ImageEnView1.IEBitmap.Canvas.Rectangle(x, y, x+width, y+height); end; ImageEnView1.Update(); !!} TIEVisionPeopleDetector = interface(TIEVisionBase) {!! TIEVisionPeopleDetector.detect Declaration function detect(image: ): ; safecall; Description Finds all people's bodies in the specified image. Returns a list of rectangles for each body found. Parameter Description image Image where to search for bodies.
!!} function detect(image: TIEVisionImage; wantExceptions: bool32 = false): TIEVisionVectorRect; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionBarCodeSymbol Declaration TIEVisionBarCodeSymbol = interface(
) Description This interface represents a bar code detected symbol. Demos Demos\IEVision\Barcode\Barcode.dpr Demos\IEVision\BarCodeCam\BarCodeCam.dpr Methods and Properties Example var symbols: TIEVisionVectorObjRef; s: TIEVisionBarCodeSymbol; i: integer; begin symbols := IEVisionLib.createBarCodeScanner().scan(ImageEnView1.IEBitmap.GetIEVisionImage(), IEVisionRect(0, 0, 0, 0)); for i := 0 to symbols.size() - 1 do begin s := TIEVisionBarCodeSymbol( symbols.getObj(i) ); Memo1.Lines.Add('type = ' + s.getSymbolType().c_str()); Memo1.Lines.Add('data = ' + s.getData().c_str()); with s.getBoundingBox() do Memo1.Lines.Add('rect = ' + inttostr(x) + ' ' + inttostr(y) + ' ' + inttostr(width) + ' ' + inttostr(height)); end; end; !!} TIEVisionBarCodeSymbol = interface(TIEVisionBase) {!! TIEVisionBarCodeSymbol.getSymbolType Declaration function getSymbolType(wantExceptions: bool32 = false): ; safecall; Description Returns the bar code type. It can be one of the following strings: Bar code type string "EAN-8" "UPC-E" "ISBN-10" "UPC-A" "EAN-13" "ISBN-13" "I2/5" "CODE-39" "CODE-128" "PDF417" (still not supported) "QR-Code"
!!} function getSymbolType(wantExceptions: bool32 = false): TIEVisionWString; safecall; {!! TIEVisionBarCodeSymbol.getData Declaration function getData(wantExceptions: bool32 = false):
; safecall; Description Returns decoded bar code symbols. !!} function getData(wantExceptions: bool32 = false): TIEVisionWString; safecall; {!! TIEVisionBarCodeSymbol.getBoundingBox Declaration function getBoundingBox(wantExceptions: bool32 = false): ; safecall; Description Returns decoded bar code bounding rectangle. Bounding box could be not always available (i.e. for I2/5 bar code type). !!} function getBoundingBox(wantExceptions: bool32 = false): TIEVisionRect; safecall; {!! TIEVisionBarCodeSymbol.getXML Declaration function getXML(wantExceptions: bool32 = false): ; safecall; Description Returns decoded bar code info as XML string. !!} function getXML(wantExceptions: bool32 = false): TIEVisionWString; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionBarCodeScanner Declaration TIEVisionBarCodeScanner = interface() Description This interface allows you to read bar codes (EAN-13/UPC-A, UPC-E, EAN-8, Code 128, Code 39, Interleaved 2 of 5 and QR Code). Demos Demos\IEVision\Barcode\Barcode.dpr Demos\IEVision\BarCodeCam\BarCodeCam.dpr Methods and Properties See Also Examples var symbols: TIEVisionVectorObjRef; s: TIEVisionBarCodeSymbol; i: integer; begin symbols := IEVisionLib.createBarCodeScanner().scan(ImageEnView1.IEBitmap.GetIEVisionImage(), IEVisionRect(0, 0, 0, 0)); for i := 0 to symbols.size() - 1 do begin s := TIEVisionBarCodeSymbol( symbols.getObj(i) ); Memo1.Lines.Add('type = ' + s.getSymbolType().c_str()); Memo1.Lines.Add('data = ' + s.getData().c_str()); with s.getBoundingBox() do Memo1.Lines.Add('rect = ' + inttostr(x) + ' ' + inttostr(y) + ' ' + inttostr(width) + ' ' + inttostr(height)); end; end; // Function to read a bar code from a file function ReadBarcodeFromFile(const Filename : string): String; var IEBitmap: TIEBitmap; begin Result := ''; IEBitmap := TIEBitmap.Create; try IEBitmap.Read( Filename ); m_symbols := IEVisionLib.createBarCodeScanner().scan( IEBitmap.GetIEVisionImage(), IEVisionRect( 0, 0, 0, 0 )); if m_symbols.size() > 0 then Result := TIEVisionBarCodeSymbol( m_symbols.getObj( m_symbols.size() - 1 )).getData().c_str(); finally IEBitmap.Free; end; end; // Function to read a bar code from a bitmap function ReadBarcodeFromBitmap(aBitmap: TBitmap): String; var IEBitmap: TIEBitmap; begin IEBitmap := TIEBitmap.Create( aBitmap, Rect( 0, 0, aBitmap.Width, aBitmap.Height )); try m_symbols := IEVisionLib.createBarCodeScanner().scan( IEBitmap.GetIEVisionImage(), IEVisionRect( 0, 0, 0, 0 )); if m_symbols.size() > 0 then Result := TIEVisionBarCodeSymbol( m_symbols.getObj( m_symbols.size() - 1 )).getData().c_str(); finally IEBitmap.Free; end; end; !!} TIEVisionBarCodeScanner = interface(TIEVisionBase) {!! TIEVisionBarCodeScanner.scan Declaration function scan(image: ; const rect: ; wantExceptions: bool32 = false): ; safecall; Description Look for a scan code inside the specified image. Only 24 bit RGB and 8 bit gray scale images are supported. Returns a list of symbols (bar codes) found as objects. Parameter Description image Image where to search for barcodes. rect Rectangle of the image where to search for. Setting (0, 0, 0, 0) means the whole image.
Example var symbols: TIEVisionVectorObjRef; s: TIEVisionBarCodeSymbol; i: integer; begin symbols := IEVisionLib.createBarCodeScanner().scan(ImageEnView1.IEBitmap.GetIEVisionImage(), IEVisionRect(0, 0, 0, 0)); for i := 0 to symbols.size() - 1 do begin s := TIEVisionBarCodeSymbol( symbols.getObj(i) ); Memo1.Lines.Add('type = ' + s.getSymbolType().c_str()); Memo1.Lines.Add('data = ' + s.getData().c_str()); with s.getBoundingBox() do Memo1.Lines.Add('rect = ' + inttostr(x) + ' ' + inttostr(y) + ' ' + inttostr(width) + ' ' + inttostr(height)); end; end; !!} function scan(image: TIEVisionImage; const rect: TIEVisionRect; wantExceptions: bool32 = false): TIEVisionVectorObjRef; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionStitcher Declaration TIEVisionStitcher = interface(
) Description Combines multiple photographic images with overlapping fields of view to produce a segmented panorama. Demo Demos\IEVision\Stitcher\Stitcher.dpr Methods and Properties Example var images: TIEVisionVectorImageRef; pano: TIEVisionImage; status: TIEVisionStitchingStatus; begin images := IEVisionLib.createVectorImageRef(); images.push_back(IEVisionLib.createImage('image1.jpg')); images.push_back(IEVisionLib.createImage('image2.jpg')); images.push_back(IEVisionLib.createImage('image3.jpg')); pano := IEVisionLib.createStitcher().stitch(images, status); if status = ievSSOK then begin ImageEnView.IEBitmap.AssignIEVisionImage(pano); ImageEnView.Update; end end; !!} TIEVisionStitcher = interface(TIEVisionBase) {!! TIEVisionStitcher.stitch Declaration function stitch(images: ; out status: ; wantExceptions: bool32 = false): ; safecall; Description Tries to stitch the given images. Parameter Description images Input images. status Status code.
Example var images: TIEVisionVectorImageRef; pano: TIEVisionImage; status: TIEVisionStitchingStatus; begin images := IEVisionLib.createVectorImageRef(); images.push_back(IEVisionLib.createImage('image1.jpg')); images.push_back(IEVisionLib.createImage('image2.jpg')); images.push_back(IEVisionLib.createImage('image3.jpg')); pano := IEVisionLib.createStitcher().stitch(images, status); if status = ievSSOK then begin ImageEnView.IEBitmap.AssignIEVisionImage(pano); ImageEnView.Update; end end; !!} function stitch(images: TIEVisionVectorImageRef; out status: TIEVisionStitchingStatus; wantExceptions: bool32 = false): TIEVisionImage; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionBackgroundSubtractor Declaration TIEVisionBackgroundSubtractor = interface(
) Description Performs background/foreground segmentation. Demo Demos\IEVision\BackgroundSubtract\BackgroundSubtract.dpr Methods and Properties !!} TIEVisionBackgroundSubtractor = interface(TIEVisionBase) {!! TIEVisionBackgroundSubtractor.selectMethodMOG2 Declaration procedure selectMethodMOG2(history: int32_t = 500; varThreshold: double = 16; detectShadows: bool32 = true; wantExceptions: bool32 = false); safecall; Description Selects Gaussian Mixture-based Background/Foreground Segmentation Algorithm. Parameter Description history Length of the history. varThreshold Threshold on the squared Mahalanobis distance between the pixel and the model to decide whether a pixel is well described by the background model. detectShadows If true, the algorithm will detect shadows and mark them.
!!} procedure selectMethodMOG2(history: int32_t = 500; varThreshold: double = 16; detectShadows: bool32 = true; wantExceptions: bool32 = false); safecall; {!! TIEVisionBackgroundSubtractor.selectMethodKNN Declaration procedure selectMethodKNN(history: int32_t = 500; dist2Threshold: double = 400.0; detectShadows: bool32 = true; wantExceptions: bool32 = false); safecall; Description Selects K-nearest neigbours - based Background/Foreground Segmentation Algorithm. Parameter Description history Length of the history. dist2Threshold Threshold on the squared distance between the pixel and the sample to decide whether a pixel is close to that sample. detectShadows If true, the algorithm will detect shadows and mark them.
!!} procedure selectMethodKNN(history: int32_t = 500; dist2Threshold: double = 400.0; detectShadows: bool32 = true; wantExceptions: bool32 = false); safecall; {!! TIEVisionBackgroundSubtractor.apply Declaration function apply(image:
; learningRate: double = -1; wantExceptions: bool32 = false): ; safecall; Description Computes a foreground mask. Returns the output foreground mask as an 8-bit binary image (ie8g). Parameter Description image Input image. learningRate The value between 0 and 1 that indicates how fast the background model is learnt.
!!} function apply(image: TIEVisionImage; learningRate: double = -1; wantExceptions: bool32 = false): TIEVisionImage; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // TIEVisionFaceRecognizer {!! TIEVisionFaceRecognizer Declaration TIEVisionFaceRecognizer = interface(TIEVisionBase) Description Performs face learning and recognition. Demo Demos\IEVision\FaceRecognizer\FaceRecognizer.dpr Methods and Properties
!!} TIEVisionFaceRecognizer = interface(TIEVisionBase) {!! TIEVisionFaceRecognizer.selectEigenFaceRecognizer Declaration procedure selectEigenFaceRecognizer(imageWidth: uint32_t = 100; imageHeight: uint32_t = 130; numComponents: int32_t = 0; wantExceptions: bool32 = false); safecall; Description Selects Eigen Face Recognizer as face recognizer algorithm. Parameter Description imageWidth Width of training and test images. All training and test images will be resampled at this width. imageHeight Height of training and test images. All traning and test images will be resampled at this height. numComponents The number of components (Eigenfaces) kept as hint.
!!} procedure selectEigenFaceRecognizer(imageWidth: uint32_t = 100; imageHeight: uint32_t = 130; numComponents: int32_t = 0; wantExceptions: bool32 = false); safecall; {!! TIEVisionFaceRecognizer.selectFisherFaceRecognizer Declaration procedure selectFisherFaceRecognizer(imageWidth: uint32_t = 100; imageHeight: uint32_t = 130; numComponents: int32_t = 0; wantExceptions: bool32 = false); safecall; Description Selects Fisher Face Recognizer as face recognizer algorithm. Parameter Description imageWidth Width of training and test images. All training and test images will be resampled at this width. imageHeight Height of training and test images. All traning and test images will be resampled at this height. numComponents The number of components (Fisherfaces) kept.
!!} procedure selectFisherFaceRecognizer(imageWidth: uint32_t = 100; imageHeight: uint32_t = 130; numComponents: int32_t = 0; wantExceptions: bool32 = false); safecall; {!! TIEVisionFaceRecognizer.selectLBPHFaceRecognizer Declaration procedure selectLBPHFaceRecognizer(radius: int32_t = 1; neighbors: int32_t = 8; grid_x: int32_t = 8; grid_y: int32_t = 8; wantExceptions: bool32 = false); safecall; Description Selects Local Binary Patterns Histograms (LBPH) Face Recognizer as face recognizer algorithm. Parameter Description radius The radius used for building the Circular Local Binary Pattern. neighbors The number of sample points to build a Circular Local Binary Pattern from. grid_x The number of cells in the horizontal direction. grid_y The number of cells in the vertical direction.
!!} procedure selectLBPHFaceRecognizer(radius: int32_t = 1; neighbors: int32_t = 8; grid_x: int32_t = 8; grid_y: int32_t = 8; wantExceptions: bool32 = false); safecall; {!! TIEVisionFaceRecognizer.addTrainImage Declaration procedure addTrainImage(image:
; imlabel: PWideChar; wantExceptions: bool32 = false); safecall; Description Adds a new training image. Images pixel format can be RGB or gray scale. Images size don't care. Applications need to call after all training images are added. Parameter Description image Input training image. imlabel Label corresponding to the image.
!!} procedure addTrainImage(image: TIEVisionImage; imlabel: PWideChar; wantExceptions: bool32 = false); safecall; {!! TIEVisionFaceRecognizer.clear Declaration procedure clear(wantExceptions: bool32 = false); safecall; Description Clears added training images, labels and recognizer state. !!} procedure clear(wantExceptions: bool32 = false); safecall; {!! TIEVisionFaceRecognizer.isTrained Declaration function isTrained(wantExceptions: bool32 = false): bool32; safecall; Description Returns true if the object is trained. !!} function isTrained(wantExceptions: bool32 = false): bool32; safecall; {!! TIEVisionFaceRecognizer.train Declaration procedure train(update: bool32 = false; wantExceptions: bool32 = false); safecall; Description Starts face recognition training. Applications need to call
before. At the end it is possible to call or . Parameter Description update If true and if supported by the algorithm this updates instead of re-train the recognizer.
!!} procedure train(update: bool32 = false; wantExceptions: bool32 = false); safecall; {!! TIEVisionFaceRecognizer.detect Declaration function detect(image: TIEVisionImage; out confidence: double; wantExceptions: bool32 = false): PWideChar; safecall; Description Detects a label and associated confidence (e.g. distance) for a given input image. Applications can call this method after
or . Parameter Description image Input test image. confidence Associated confidence (e.g. distance) for the predicted label.
!!} function detect(image: TIEVisionImage; out confidence: double; wantExceptions: bool32 = false): PWideChar; safecall; {!! TIEVisionFaceRecognizer.save Declaration procedure save(stream: IStream; wantExceptions: bool32 = false); safecall; procedure save(filename: PWideChar; wantExceptions: bool32 = false); safecall; Description Saves current face recognizer state. Parameter Description stream Output stream. filename Output file name.
Example var fs: TFileStream; ... fs := TFileStream.Create('trained.dat', fmCreate); fr.save(TStreamAdapter.Create(fs) as IStream); fs.free; !!} procedure save(stream: IStream; wantExceptions: bool32 = false); safecall; overload; procedure save(filename: PWideChar; wantExceptions: bool32 = false); safecall; overload; {!! TIEVisionFaceRecognizer.load Declaration procedure load(stream: IStream; wantExceptions: bool32 = false); safecall; procedure load(filename: PWideChar; wantExceptions: bool32 = false); safecall; overload; Description Loads face recognizer state. Parameter Description stream Input stream.
Example var fs: TFileStream; ... fs := TFileStream.Create('trained.dat', fmOpenRead); fr.load(TStreamAdapter.Create(fs) as IStream); fs.Free; !!} procedure load(stream: IStream; wantExceptions: bool32 = false); safecall; overload; procedure load(filename: PWideChar; wantExceptions: bool32 = false); safecall; overload; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! TIEVisionLibrary Declaration TIEVisionLibrary = interface(
) Description This interface allows you to create IEVision objects. Methods and Properties Example image := IEVisionLib.createImage(1000, 1000, ievUINT8, 3); !!} TIEVisionLibrary = interface(TIEVisionBase) procedure debug(wantExceptions: bool32 = false); safecall; {!! TIEVisionLibrary.createHaarTraining Declaration function createHaarTraining(): ; safecall; Description Creates a new Haar training object. !!} function createHaarTraining(wantExceptions: bool32 = false): TIEVisionHaarTraining; safecall; {!! TIEVisionLibrary.createInputOutput Declaration function createInputOutput(): ; safecall; Description Creates a new input/output object. !!} function createInputOutput(wantExceptions: bool32 = false): TIEVisionInputOutput; safecall; {!! TIEVisionLibrary.createMath Declaration function createMath(): ; safecall; Description Creates a new math object. !!} function createMath(wantExceptions: bool32 = false): TIEVisionMath; safecall; {!! TIEVisionLibrary.createDrawing Declaration function createDrawing(): ; safecall; Description Creates a new drawing object. !!} function createDrawing(wantExceptions: bool32 = false): TIEVisionDrawing; safecall; {!! TIEVisionLibrary.createImage Declaration function createImage(width: int32_t; height: int32_t; channelFormat: ; channels: int32_t): ; overload; safecall; function createImage(c: ): ; overload; safecall; function createImage(): ; overload; safecall; function createImage(width: int32_t; height: int32_t; channelFormat: ; channels: int32_t; rowlen: int32_t; data: pointer): ; overload; safecall; function createImage(filename: PAnsiChar): ; overload; safecall; Description First overload creates a new image object from specified sizes and format. Second overload creates a new image object from a copy of specified object. Third overload creates a new empty image object. Fourth overload creates a new image from the specified buffer (shares the same content). The buffer will be not released on destroy. Fifth overload creates a new image from the specified file. Currently supported file formats are: TIFF, JPEG, BMP, PNG, PXM, J2K (jpeg2000), RAS. Parameter Description width Image width. height Image height. channelFormat Channel format. channels Number of channels. c Source image to copy. rowlen Row length in bytes. data Raw data buffer. filename Filename to load.
Example // create 1000x1000 RGB image image := IEVisionLib.createImage(1000, 1000, ievUINT8, 3); // load 'input.jpg' image := IEVisionLib.createImage('input.jpeg'); // share ImageEnView1 bitmap ImageEnView1.IEBitmap.Origin := ieboTOPLEFT; image := IEVisionLib.createImage(ImageEnView1.IEBitmap.Width, ImageEnView1.IEBitmap.Height, ievUINT8, 3, ImageEnView1.IEBitmap.Rowlen, ImageEnView1.IEBitmap.ScanLine[0]); // the same result of previous code image := ImageEnView1.IEBitmap.GetIEVisionImage(); !!} function createImage(width: int32_t; height: int32_t; channelFormat: TIEVisionChannelFormat; channels: int32_t; wantExceptions: bool32 = false): TIEVisionImage; overload; safecall; function createImage(c: TIEVisionImage; wantExceptions: bool32 = false): TIEVisionImage; overload; safecall; function createImage(wantExceptions: bool32 = false): TIEVisionImage; overload; safecall; function createImage(width: int32_t; height: int32_t; channelFormat: TIEVisionChannelFormat; channels: int32_t; rowlen: int32_t; data: pointer; wantExceptions: bool32 = false): TIEVisionImage; overload; safecall; function createImage(filename: PAnsiChar; wantExceptions: bool32 = false): TIEVisionImage; overload; safecall; {!! TIEVisionLibrary.createCascadeClassifier Declaration function createCascadeClassifier():
; overload; safecall; function createCascadeClassifier(c: ): ; overload; safecall; function createCascadeClassifier(filename: PAnsiChar): ; overload; safecall; Description First overload creates a new empty cascade classifier. Second overload creates a cascade classifier from a copy of specified object. Third overload creates a cascade classifier from file or embedded classifier. Embedded classifiers have ':' prefix and can be: Const Classifier IEVC_EYE ":EYE" IEVC_EYE_TREE_EYE_GLASSES ":EYETREEEYEGLASSES" IEVC_FRONTAL_FACE_ALT ":FRONTALFACEALT" IEVC_FRONTAL_FACE_ALT_2 ":FRONTALFACEALT2" IEVC_FRONTAL_FACE_ALT_TREE ":FRONTALFACEALTTREE" IEVC_FRONTAL_FACE_DEFAULT ":FRONTALFACEDEFAULT" IEVC_FULL_BODY ":FULLBODY" IEVC_LOWER_BODY ":LOWERBODY" IEVC_PROFILE_FACE ":PROFILEFACE" IEVC_UPPER_BODY ":UPPERBODY" IEVC_LEFT_EYE_2_SPLITS ":LEFTEYE2SPLITS" IEVC_RIGHT_EYE_2_SPLITS ":RIGHTEYE2SPLITS" IEVC_LBP_FRONTAL_FACE ":LBPFRONTALFACE" IEVC_CASCADE_SMILE ":CASCADESMILE" IEVC_FRONTAL_CAT_FACE ":FRONTALCATFACE" IEVC_FRONTAL_CAT_FACE_EXT ":FRONTALCATFACEEXTENDED" IEVC_LICENSE_PLATE_RUS ":LICENSEPLATERUS" IEVC_RUSSIAN_PLATE_NUMBER ":RUSSIANPLATENUMBER"
Parameter Description c Source classifier to copy. filename Filename of classifier to load (or one of the embedded classifiers).
Example // load embedded eye detector classifier := IEVisionLib.createCascadeClassifier(IEVC_EYE); See Also -
!!} function createCascadeClassifier(wantExceptions: bool32 = false): TIEVisionCascadeClassifier; overload; safecall; function createCascadeClassifier(c: TIEVisionCascadeClassifier; wantExceptions: bool32 = false): TIEVisionCascadeClassifier; overload; safecall; function createCascadeClassifier(filename: PAnsiChar; wantExceptions: bool32 = false): TIEVisionCascadeClassifier; overload; safecall; {!! TIEVisionLibrary.createFileStream Declaration function createFileStream(filename: PAnsiChar; mode: ): ; overload; safecall; function createFileStream(filename: PWideChar; mode: ): ; overload; safecall; function createFileStream(): ; overload; safecall; Description First two overloads create a file stream using specified mode. Third overload create an unopened file stream. Parameter Description filename ANSI or Unicode file name. mode File mode.
Example // open "input.dat" as readonly file filestream := createFileStream('input.dat', ievREAD); // create "output.dat" filestream := createFileStream('output.dat', ievCREATE); // open "input.dat" as readonly file filestream := createFileStream(); filestream.open('input.dat', ievREAD); !!} function createFileStream(filename: PAnsiChar; mode: TIEVisionFileStreamMode; wantExceptions: bool32 = false): TIEVisionFileStream; overload; safecall; function createFileStream(filename: PWideChar; mode: TIEVisionFileStreamMode; wantExceptions: bool32 = false): TIEVisionFileStream; overload; safecall; function createFileStream(wantExceptions: bool32 = false): TIEVisionFileStream; overload; safecall; {!! TIEVisionLibrary.createMemoryStream Declaration function createMemoryStream():
; safecall; Description Creates a memory stream. !!} function createMemoryStream(wantExceptions: bool32 = false): TIEVisionMemoryStream; safecall; {!! TIEVisionLibrary.createExistingMemoryStream Declaration function createExistingMemoryStream(existingBuffer: pointer; existingBufferSize: int32_t): ; safecall; Description Creates a readonly memory stream from an existing buffer. Parameter Description existingBuffer Pointer to the existing buffer. existingBufferSize Size of the existing buffer.
!!} function createExistingMemoryStream(existingBuffer: pointer; existingBufferSize: int32_t; wantExceptions: bool32 = false): TIEVisionExistingMemoryStream; safecall; {!! TIEVisionLibrary.createTempFileStream Declaration function createTempFileStream(deleteOnDestroy: bool32 = true):
; overload; safecall; function createTempFileStream(filename: PAnsiChar; deleteOnDestroy: bool32 = true): ; overload; safecall; Description Creates a temporary file stream. First overload choices automatically the file name. Second overload allows you to set a custom file name. Parameter Description deleteOnDestroy If true the file will be delete on object disposing. filename Filename of temporary file.
!!} function createTempFileStream(deleteOnDestroy: bool32 = true; wantExceptions: bool32 = false): TIEVisionTempFileStream; overload; safecall; function createTempFileStream(filename: PAnsiChar; deleteOnDestroy: bool32 = true; wantExceptions: bool32 = false): TIEVisionTempFileStream; overload; safecall; {!! TIEVisionLibrary.createMemoryImageList Declaration function createMemoryImageList():
; safecall; Description Creates a memory image list. !!} function createMemoryImageList(wantExceptions: bool32 = false): TIEVisionMemoryImageList; safecall; {!! TIEVisionLibrary.createMemorySharedImageList Declaration function createMemorySharedImageList(): ; safecall; Description Creates a shared image list. !!} function createMemorySharedImageList(wantExceptions: bool32 = false): TIEVisionMemorySharedImageList; safecall; {!! TIEVisionLibrary.createTempFileImageList Declaration function createTempFileImageList(): ; safecall; Description Creates a temporary file image list. !!} function createTempFileImageList(wantExceptions: bool32 = false): TIEVisionTempFileImageList; safecall; {!! TIEVisionLibrary.createString Declaration function createString(): ; overload; safecall; function createString(src: ): ; overload; safecall; function createString(src: PAnsiChar): ; overload; safecall; Description Creates an ANSI string object. First overload creates an empty string. Second overload creates a clone of source string object. Third overload creates a string from the specified ANSI string. Parameter Description src String object or ANSI string pointer to copy.
!!} function createString(wantExceptions: bool32 = false): TIEVisionString; overload; safecall; function createString(src: TIEVisionString; wantExceptions: bool32 = false): TIEVisionString; overload; safecall; function createString(src: PAnsiChar; wantExceptions: bool32 = false): TIEVisionString; overload; safecall; {!! TIEVisionLibrary.createWString Declaration function createWString():
; overload; safecall; function createWString(src: ): ; overload; safecall; function createWString(src: PWideChar): ; overload; safecall; Description Creates a wide string object. First overload creates an empty string. Second overload creates a clone of source string object. Third overload creates a string from the specified wide string. Parameter Description src String object or wide string pointer to copy.
!!} function createWString(wantExceptions: bool32 = false): TIEVisionWString; overload; safecall; function createWString(src: TIEVisionWString; wantExceptions: bool32 = false): TIEVisionWString; overload; safecall; function createWString(src: PWideChar; wantExceptions: bool32 = false): TIEVisionWString; overload; safecall; {!! TIEVisionLibrary.createVectorString Declaration function createVectorString():
; overload; safecall; function createVectorString(src: ): ; overload; safecall; Description Creates a vector of strings. Second overload creates a clone of specified vector of strings. Parameter Description src Vector to clone.
!!} function createVectorString(wantExceptions: bool32 = false): TIEVisionVectorString; overload; safecall; function createVectorString(src: TIEVisionVectorString; wantExceptions: bool32 = false): TIEVisionVectorString; overload; safecall; {!! TIEVisionLibrary.createPropertyTree Declaration function createPropertyTree():
; overload; safecall; function createPropertyTree(src: ): ; overload; safecall; Description Creates a property tree object. Second overload creates a copy of specified property tree object. Parameter Description src Property tree to copy.
!!} function createPropertyTree(wantExceptions: bool32 = false): TIEVisionPropertyTree; overload; safecall; function createPropertyTree(src: TIEVisionPropertyTree; wantExceptions: bool32 = false): TIEVisionPropertyTree; overload; safecall; {!! TIEVisionLibrary.createTempFileName Declaration function createTempFileName(deleteOnDestroy: bool32 = true):
; overload; safecall; function createTempFileName(filename: PAnsiChar; deleteOnDestroy: bool32 = true): ; overload; safecall; Description Creates a temporary file name. Second overload allows you to specify the file name. Parameter Description deleteOnDestroy Automatically delete the file on object destroy. filename Specify filename manually.
!!} function createTempFileName(deleteOnDestroy: bool32 = true; wantExceptions: bool32 = false): TIEVisionTempFileName; overload; safecall; function createTempFileName(filename: PAnsiChar; deleteOnDestroy: bool32 = true; wantExceptions: bool32 = false): TIEVisionTempFileName; overload; safecall; {!! TIEVisionLibrary.createTempDirName Declaration function createTempDirName(deleteOnDestroy: bool32 = true):
; overload; safecall; function createTempDirName(dirname: PAnsiChar; deleteOnDestroy: bool32 = true): ; overload; safecall; Description Creates a temporary directory name. Second overload allows you to specify the directory name. Parameter Description deleteOnDestroy Automatically delete the directory on object destroy. dirname Specify dirname manually.
!!} function createTempDirName(deleteOnDestroy: bool32 = true; wantExceptions: bool32 = false): TIEVisionTempDirName; overload; safecall; function createTempDirName(dirname: PAnsiChar; deleteOnDestroy: bool32 = true; wantExceptions: bool32 = false): TIEVisionTempDirName; overload; safecall; {!! TIEVisionLibrary.createHistogram Declaration function createHistogram(sizes:
; histType: ; ranges: ; uniform: bool32 = true): ; overload; safecall; function createHistogram(bins: int32_t = 256; histType: = ievARRAY; rangeMin: single = 0.0; rangeMax: single = 255.0; uniform: bool32 = true): ; overload; safecall; Description Creates an empty histogram object. Parameter Description sizes Number of histogram sizes. histType Histogram type. ranges Vector of ranges (for each size). uniform Uniform histogram. bins Number of bins. rangeMin Range start. rangeMax Range end.
!!} function createHistogram(sizes: TIEVisionVectorInt32; histType: TIEVisionHistogramType; ranges: TIEVisionVectorFloatPair; uniform: bool32 = true; wantExceptions: bool32 = false): TIEVisionHistogram; overload; safecall; function createHistogram(bins: int32_t = 256; histType: TIEVisionHistogramType = ievARRAY; rangeMin: single = 0.0; rangeMax: single = 255.0; uniform: bool32 = true; wantExceptions: bool32 = false): TIEVisionHistogram; overload; safecall; {!! TIEVisionLibrary.createVectorInt32 Declaration function createVectorInt32():
; overload; safecall; function createVectorInt32(src: ): ; overload; safecall; Description Creates a vector of integers (signed 32 bit). Parameter Description src Vector to copy.
!!} function createVectorInt32(wantExceptions: bool32 = false): TIEVisionVectorInt32; overload; safecall; function createVectorInt32(src: TIEVisionVectorInt32; wantExceptions: bool32 = false): TIEVisionVectorInt32; overload; safecall; {!! TIEVisionLibrary.createVectorFloatPair Declaration function createVectorFloatPair():
; overload; safecall; function createVectorFloatPair(src: ): ; overload; safecall; Description Creates a vector of float pairs (two 32 bit floating point values). Parameter Description src Vector to copy.
!!} function createVectorFloatPair(wantExceptions: bool32 = false): TIEVisionVectorFloatPair; overload; safecall; function createVectorFloatPair(src: TIEVisionVectorFloatPair; wantExceptions: bool32 = false): TIEVisionVectorFloatPair; overload; safecall; {!! TIEVisionLibrary.createVectorPoint Declaration function createVectorPoint():
; overload; safecall; function createVectorPoint(src: ): ; overload; safecall; Description Creates a vector of points. Parameter Description src Vector to copy.
!!} function createVectorPoint(wantExceptions: bool32 = false): TIEVisionVectorPoint; overload; safecall; function createVectorPoint(src: TIEVisionVectorPoint; wantExceptions: bool32 = false): TIEVisionVectorPoint; overload; safecall; {!! TIEVisionLibrary.createVectorRect Declaration function createVectorRect():
; overload; safecall; function createVectorRect(src: ): ; overload; safecall; Description Creates a vector of rectangles. Parameter Description src Vector to copy.
!!} function createVectorRect(wantExceptions: bool32 = false): TIEVisionVectorRect; overload; safecall; function createVectorRect(src: TIEVisionVectorRect; wantExceptions: bool32 = false): TIEVisionVectorRect; overload; safecall; {!! TIEVisionLibrary.createVectorByte Declaration function createVectorByte():
; overload; safecall; function createVectorByte(src: ): ; overload; safecall; Description Creates a vector of bytes (8 bit unsigned). Parameter Description src Vector to copy.
!!} function createVectorByte(wantExceptions: bool32 = false): TIEVisionVectorByte; overload; safecall; function createVectorByte(src: TIEVisionVectorByte; wantExceptions: bool32 = false): TIEVisionVectorByte; overload; safecall; {!! TIEVisionLibrary.createVectorDouble Declaration function createVectorDouble():
; overload; safecall; function createVectorDouble(src: ): ; overload; safecall; Description Creates a vector of floating point values (64 bit). Parameter Description src Vector to copy.
!!} function createVectorDouble(wantExceptions: bool32 = false): TIEVisionVectorDouble; overload; safecall; function createVectorDouble(src: TIEVisionVectorDouble; wantExceptions: bool32 = false): TIEVisionVectorDouble; overload; safecall; {!! TIEVisionLibrary.createVectorImageRef Declaration function createVectorImageRef():
; overload; safecall; function createVectorImageRef(src: ): ; overload; safecall; Description Creates a vector of references. Parameter Description src Vector to copy.
!!} function createVectorImageRef(wantExceptions: bool32 = false): TIEVisionVectorImageRef; overload; safecall; function createVectorImageRef(src: TIEVisionVectorImageRef; wantExceptions: bool32 = false): TIEVisionVectorImageRef; overload; safecall; {!! TIEVisionLibrary.createObjectTracker Declaration function createObjectTracker():
; safecall; Description Creates an object tracker. !!} function createObjectTracker(wantExceptions: bool32 = false): TIEVisionObjectTracker; safecall; {!! TIEVisionLibrary.createObjectsFinder Declaration function createObjectsFinder(): ; safecall; Description Creates an object finder. !!} function createObjectsFinder(wantExceptions: bool32 = false): TIEVisionObjectsFinder; safecall; {!! TIEVisionLibrary.createOCR Declaration function createOCR(language: PAnsiChar = nil; engine: = ievOCRFAST): ; overload; safecall; function createOCR(path: PAnsiChar; language: PAnsiChar; engine: = ievOCRFAST): ; overload; safecall; function createOCR(path: PAnsiChar; languages: ; engine: = ievOCRFAST): ; overload; safecall; Description Creates an OCR object for the specified language. Many languages are available as separate files. Parameter Description language Language code of OCR recognition (ex. 'eng', 'fra'). path Path to language data files. engine OCR engine to use. languages A list of languages.
Example OCR := IEVisionLib.createOCR(IEOCRLanguageList[OCR_English_language].Code); OR sLanguage := 'fra'; // French if FileExists( IncludeTrailingPathDelimiter( ExtractFilePath( Application.ExeName )) + sLanguage + '.traineddata' ) = False then raise Exception.create( 'Language file not found' ); OCR := IEVisionLib.createOCR( sLanguage ); OR (multiple languages) var langs: TIEVisionVectorString; langs := IEVisionLib.createVectorString(); langs.push_back( IEOCRLanguageList[ OCR_English_language ].Code ); // load English langs.push_back( IEOCRLanguageList[ OCR_Italian_language ].Code ); // load Italian m_OCR := IEVisionLib.createOCR( '', langs, TIEVisionOCREngine( ComboBox1.ItemIndex )); !!} function createOCR(language: PAnsiChar = nil; engine: TIEVisionOCREngine = ievOCRFAST; wantExceptions: bool32 = false): TIEVisionOCR; overload; safecall; function createOCR(path: PAnsiChar; language: PAnsiChar; engine: TIEVisionOCREngine = ievOCRFAST; wantExceptions: bool32 = false): TIEVisionOCR; overload; safecall; function createOCR(path: PAnsiChar; languages: TIEVisionVectorString; engine: TIEVisionOCREngine = ievOCRFAST; wantExceptions: bool32 = false): TIEVisionOCR; overload; safecall; {!! TIEVisionLibrary.createPeopleDetector Declaration function createPeopleDetector(wantExceptions: bool32 = false):
; safecall; Description Creates a People Detector object. Example objectsFinder := IEVisionLib.createObjectsFinder(); objectsFinder.addClassifier('People Detector', IEVisionLib.createPeopleDetector()); !!} function createPeopleDetector(wantExceptions: bool32 = false): TIEVisionPeopleDetector; safecall; {!! TIEVisionLibrary.createBarCodeScanner Declaration function createBarCodeScanner(wantExceptions: bool32 = false): ; safecall; Description Creates a bar code scanner object. Example var symbols: TIEVisionVectorObjRef; s: TIEVisionBarCodeSymbol; i: integer; begin symbols := IEVisionLib.createBarCodeScanner().scan(ImageEnView1.IEBitmap.GetIEVisionImage(), IEVisionRect(0, 0, 0, 0)); for i := 0 to symbols.size() - 1 do begin s := TIEVisionBarCodeSymbol( symbols.getObj(i) ); Memo1.Lines.Add('type = ' + s.getSymbolType().c_str()); Memo1.Lines.Add('data = ' + s.getData().c_str()); with s.getBoundingBox() do Memo1.Lines.Add('rect = ' + inttostr(x) + ' ' + inttostr(y) + ' ' + inttostr(width) + ' ' + inttostr(height)); end; end; !!} function createBarCodeScanner(wantExceptions: bool32 = false): TIEVisionBarCodeScanner; safecall; {!! TIEVisionLibrary.getLibraryInfo Declaration function getLibraryInfo(info: ; wantExceptions: bool32 = false): ; safecall; Description Returns some library infos (version, platform, etc). Example ShowMessage( Format('%s %s %s bit (filename: "%s", is trial: %s)', [ IEVisionLib().getLibraryInfo(ievLIBNAME).c_str(), IEVisionLib().getLibraryInfo(ievLIBVERSION).c_str(), IEVisionLib().getLibraryInfo(ievLIBPLATFORM).c_str(), IEVisionLib().getLibraryInfo(ievLIBFILENAME).c_str(), IEVisionLib().getLibraryInfo(ievISTRIAL).c_str()]) ); !!} function getLibraryInfo(info: TIEVisionLibraryInfo; wantExceptions: bool32 = false): TIEVisionString; safecall; {!! TIEVisionLibrary.createStitcher Declaration function createStitcher(tryUseGPU: bool32 = false; wantExceptions: bool32 = false): ; safecall; Description Creates a stitcher object. !!} function createStitcher(tryUseGPU: bool32 = false; wantExceptions: bool32 = false): TIEVisionStitcher; safecall; {!! TIEVisionLibrary.createBackgroundSubtractor Declaration function createBackgroundSubtractor(wantExceptions: bool32 = false): ; safecall; Description Creates a background subtractor object. !!} function createBackgroundSubtractor(wantExceptions: bool32 = false): TIEVisionBackgroundSubtractor; safecall; {!! TIEVisionLibrary.createFaceRecognizer Declaration function createFaceRecognizer(wantExceptions: bool32 = false): ; safecall; Description Creates a face recognizer object. !!} function createFaceRecognizer(wantExceptions: bool32 = false): TIEVisionFaceRecognizer; safecall; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// procedure IEInitialize_ievision(const sDLLPath: WideString = ''; reinitialize: boolean = true); procedure IEFinalize_ievision(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! IEVisionAvailable Declaration function IEVisionAvailable(): boolean; Description Checks if the ievision.dll is available. When it returns true you can use any IEVision function and class. Example if not IEVisionAvailable() then begin ShowMessage('This application requires ievision.dll plugin. Please download it from www.imageen.com'); Application.Terminate; exit; end; !!} function IEVisionAvailable(): boolean; {!! IEVisionSize Declaration function IEVisionSize(width, height: int32_t): ; Description Returns a record initialized with specified parameters. Parameter Description width Width height Height
!!} function IEVisionSize(width, height: int32_t): TIEVisionSize; {!! IEVisionRect Declaration function IEVisionRect(x, y, width, height: int32_t):
; Description Returns a record initialized with specified parameters. Parameter Description x Top-left horizontal coordinate. y Top-left vertical coordinate. width Width. height Height.
!!} function IEVisionRect(x, y, width, height: int32_t): TIEVisionRect; {!! IEVisionRectToTRect Declaration function IEVisionRectToTRect(Rect:
): TRect; Description Converts TIEVisionRect to VCL TRect record. !!} function IEVisionRectToTRect(Rect: TIEVisionRect): TRect; {!! IEVisionPoint Declaration function IEVisionPoint(x, y: int32_t): ; Description Returns a record initialized with specified parameters. Parameter Description x Top-left horizontal coordinate. y Top-left vertical coordinate.
!!} function IEVisionPoint(x, y: int32_t): TIEVisionPoint; {!! IEVisionScalar Declaration function IEVisionScalar(val0: double; val1: double = 0.0; val2: double = 0.0; val3: double = 0.0):
; Description Returns a record initialized with specified parameters. This structure can be also used to specify BGR colors: IEVisionScalar(0, 0, 255) = full red. Parameter Description val0 First scalar value. val1 Second scalar value. val2 Third scalar value. val3 Fourth scalar value.
!!} function IEVisionScalar(val0: double; val1: double = 0.0; val2: double = 0.0; val3: double = 0.0): TIEVisionScalar; {!! IEVisionFloatPair Declaration function IEVisionFloatPair(first: double; second: double):
; Description Returns a record initialized with specified parameters. Parameter Description first First floating point value. second Second floating point value.
!!} function IEVisionFloatPair(first: double; second: double): TIEVisionFloatPair; {!! IEVisionTermCriteria Declaration function IEVisionTermCriteria(ctype:
; maxIter: int32_t; epsilon: double): ; Description Returns a record initialized with specified parameters. Parameter Description ctype Type of the termination criteria. maxIter Maximum number of iterations. epsilon Required accuracy.
!!} function IEVisionTermCriteria(ctype: TIEVisionTermCriteriaType; maxIter: int32_t; epsilon: double): TIEVisionTermCriteria; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// function IEVisionLanguageCodeToName(const sLangCode : string) : string; function IEVisionLanguageNameToCode(const sLangName : string) : string; function IEVisionGetLanguagesInFolder(ssDest : TStrings; const sFolder : string; bDisplayName : Boolean = False) : Boolean; {!! TIEOCRLanguages Declaration } type TIEOCRLanguages = ( OCR_Ancient_Greek_Language, OCR_German_Fraktur_Language, OCR_English_Language, OCR_Ukrainian_Language, OCR_Turkish_Language, OCR_Thai_Language, OCR_Tagalog_Language, OCR_Telugu_Language, OCR_Tamil_Language, OCR_Swedish_Language, OCR_Swahili_Language, OCR_Serbian_Latin_Language, OCR_Albanian_Language, OCR_Spanish_Old_Language, OCR_Spanish_Language, OCR_Slovenian_Language, OCR_Slovakian_Language, OCR_Romanian_Language, OCR_Portuguese_Language, OCR_Polish_Language, OCR_Norwegian_Language, OCR_Dutch_Language, OCR_Malay_Language, OCR_Maltese_Language, OCR_Macedonian_Language, OCR_Malayalam_Language, OCR_Lithuanian_Language, OCR_Latvian_Language, OCR_Korean_Language, OCR_Kannada_Language, OCR_Italian_Old_Language, OCR_Italian_Language, OCR_Icelandic_Language, OCR_Indonesian_Language, OCR_Cherokee_Language, OCR_Hungarian_Language, OCR_Croatian_Language, OCR_Hindi_Language, OCR_Hebrew_Language, OCR_Galician_Language, OCR_Middle_French_1400_1600_Language, OCR_Frankish_Language, OCR_French_Language, OCR_Finnish_Language, OCR_Basque_Language, OCR_Estonian_Language, OCR_Esperanto_Language, OCR_Middle_English_1100_1500_Language, OCR_Greek_Language, OCR_German_Language, OCR_Danish_Language, OCR_Czech_Language, OCR_Catalan_Language, OCR_Bulgarian_Language, OCR_Bengali_Language, OCR_Belarusian_Language, OCR_Azerbaijani_Language, OCR_Arabic_Language, OCR_Afrikaans_Language, OCR_Japanese_Language, OCR_Chinese_Simplified_Language, OCR_Chinese_Traditional_Language, OCR_Russian_Language, OCR_Vietnamese_Language, OCR_MICR_Code, OCR_Amharic_Language, OCR_Assamese_Language, OCR_Azerbaijani_Cyrillic_Language, OCR_Tibetan_Language, OCR_Bosnian_Language, OCR_Cebuano_Language, OCR_Welsh_Language, OCR_Danish_Fraktur_Language, OCR_Dzongkha_Language, OCR_Equations_Language, OCR_Persian_Language, OCR_Irish_Language, OCR_Gujarati_Language, OCR_Haitian_Language, OCR_Inuktitut_Language, OCR_Javanese_Language, OCR_Georgian_Language, OCR_Georgian_Old_Language, OCR_Kazakh_Language, OCR_Khmer_Language, OCR_Kyrgyz_Language, OCR_Kurdish_Language, OCR_Lao_Language, OCR_Latin_Language, OCR_Marathi_Language, OCR_Burmese_Language, OCR_Nepali_Language, OCR_Oriya_Language, OCR_Punjabi_Language, OCR_Pashto_Language, OCR_Sanskrit_Language, OCR_Sinhala_Language, OCR_Slovakian_Fraktur_Language, OCR_Serbian_Language, OCR_Syriac_Language, OCR_Tajik_Language, OCR_Tigrinya_Language, OCR_Uyghur_Language, OCR_Urdu_Language, OCR_Uzbek_Language, OCR_Uzbek_Cyrillic_Language, OCR_Yiddish_Language ); {!!} {!! TIEVisionLanguages Declaration } type TIEVisionLanguages = record Code : PAnsiChar; DisplayName : string; end; const IEOCRLanguageList: array[TIEOCRLanguages] of TIEVisionLanguages = ( (Code: 'grc'; DisplayName: 'Ancient Greek'), (Code: 'deu_frak'; DisplayName: 'German (Fraktur)'), (Code: 'eng'; DisplayName: 'English'), (Code: 'ukr'; DisplayName: 'Ukrainian'), (Code: 'tur'; DisplayName: 'Turkish'), (Code: 'tha'; DisplayName: 'Thai'), (Code: 'tgl'; DisplayName: 'Tagalog'), (Code: 'tel'; DisplayName: 'Telugu'), (Code: 'tam'; DisplayName: 'Tamil'), (Code: 'swe'; DisplayName: 'Swedish'), (Code: 'swa'; DisplayName: 'Swahili'), (Code: 'srp_latn'; DisplayName: 'Serbian (Latin)'), (Code: 'sqi'; DisplayName: 'Albanian'), (Code: 'spa_old'; DisplayName: 'Spanish (Old)'), (Code: 'spa'; DisplayName: 'Spanish'), (Code: 'slv'; DisplayName: 'Slovenian'), (Code: 'slk'; DisplayName: 'Slovakian'), (Code: 'ron'; DisplayName: 'Romanian'), (Code: 'por'; DisplayName: 'Portuguese'), (Code: 'pol'; DisplayName: 'Polish'), (Code: 'nor'; DisplayName: 'Norwegian'), (Code: 'nld'; DisplayName: 'Dutch'), (Code: 'msa'; DisplayName: 'Malay'), (Code: 'mlt'; DisplayName: 'Maltese'), (Code: 'mkd'; DisplayName: 'Macedonian'), (Code: 'mal'; DisplayName: 'Malayalam'), (Code: 'lit'; DisplayName: 'Lithuanian'), (Code: 'lav'; DisplayName: 'Latvian'), (Code: 'kor'; DisplayName: 'Korean'), (Code: 'kan'; DisplayName: 'Kannada'), (Code: 'ita_old'; DisplayName: 'Italian (Old)'), (Code: 'ita'; DisplayName: 'Italian'), (Code: 'isl'; DisplayName: 'Icelandic'), (Code: 'ind'; DisplayName: 'Indonesian'), (Code: 'chr'; DisplayName: 'Cherokee'), (Code: 'hun'; DisplayName: 'Hungarian'), (Code: 'hrv'; DisplayName: 'Croatian'), (Code: 'hin'; DisplayName: 'Hindi'), (Code: 'heb'; DisplayName: 'Hebrew'), (Code: 'glg'; DisplayName: 'Galician'), (Code: 'frm'; DisplayName: 'Middle French (ca. 1400-1600)'), (Code: 'frk'; DisplayName: 'Frankish'), (Code: 'fra'; DisplayName: 'French'), (Code: 'fin'; DisplayName: 'Finnish'), (Code: 'eus'; DisplayName: 'Basque'), (Code: 'est'; DisplayName: 'Estonian'), (Code: 'epo'; DisplayName: 'Esperanto'), (Code: 'enm'; DisplayName: 'Middle English (1100-1500)'), (Code: 'ell'; DisplayName: 'Greek'), (Code: 'deu'; DisplayName: 'German'), (Code: 'dan'; DisplayName: 'Danish'), (Code: 'ces'; DisplayName: 'Czech'), (Code: 'cat'; DisplayName: 'Catalan'), (Code: 'bul'; DisplayName: 'Bulgarian'), (Code: 'ben'; DisplayName: 'Bengali'), (Code: 'bel'; DisplayName: 'Belarusian'), (Code: 'aze'; DisplayName: 'Azerbaijani'), (Code: 'ara'; DisplayName: 'Arabic'), (Code: 'afr'; DisplayName: 'Afrikaans'), (Code: 'jpn'; DisplayName: 'Japanese'), (Code: 'chi_sim'; DisplayName: 'Chinese (Simplified)'), (Code: 'chi_tra'; DisplayName: 'Chinese (Traditional)'), (Code: 'rus'; DisplayName: 'Russian'), (Code: 'vie'; DisplayName: 'Vietnamese'), (Code: 'mcr'; DisplayName: 'MICR'), (Code: 'amh'; DisplayName: 'Amharic'), (Code: 'asm'; DisplayName: 'Assamese'), (Code: 'aze_cyrl'; DisplayName: 'Azerbaijani (Cyrillic)'), (Code: 'bod'; DisplayName: 'Tibetan'), (Code: 'bos'; DisplayName: 'Bosnian'), (Code: 'ceb'; DisplayName: 'Cebuano'), (Code: 'cym'; DisplayName: 'Welsh'), (Code: 'dan_frak'; DisplayName: 'Danish (Fraktur)'), (Code: 'dzo'; DisplayName: 'Dzongkha'), (Code: 'equ'; DisplayName: 'Equations'), (Code: 'fas'; DisplayName: 'Persian'), (Code: 'gle'; DisplayName: 'Irish'), (Code: 'guj'; DisplayName: 'Gujarati'), (Code: 'hat'; DisplayName: 'Haitian'), (Code: 'iku'; DisplayName: 'Inuktitut'), (Code: 'jav'; DisplayName: 'Javanese'), (Code: 'kat'; DisplayName: 'Georgian'), (Code: 'kat_old'; DisplayName: 'Georgian (Old)'), (Code: 'kaz'; DisplayName: 'Kazakh'), (Code: 'khm'; DisplayName: 'Khmer'), (Code: 'kir'; DisplayName: 'Kyrgyz'), (Code: 'kur'; DisplayName: 'Kurdish'), (Code: 'lao'; DisplayName: 'Lao'), (Code: 'lat'; DisplayName: 'Latin'), (Code: 'mar'; DisplayName: 'Marathi'), (Code: 'mya'; DisplayName: 'Burmese'), (Code: 'nep'; DisplayName: 'Nepali'), (Code: 'ori'; DisplayName: 'Oriya'), (Code: 'pan'; DisplayName: 'Punjabi'), (Code: 'pus'; DisplayName: 'Pashto'), (Code: 'san'; DisplayName: 'Sanskrit'), (Code: 'sin'; DisplayName: 'Sinhala'), (Code: 'slk_frak'; DisplayName: 'Slovakian (Fraktur)'), (Code: 'srp'; DisplayName: 'Serbian'), (Code: 'syr'; DisplayName: 'Syriac'), (Code: 'tgk'; DisplayName: 'Tajik'), (Code: 'tir'; DisplayName: 'Tigrinya'), (Code: 'uig'; DisplayName: 'Uyghur'), (Code: 'urd'; DisplayName: 'Urdu'), (Code: 'uzb'; DisplayName: 'Uzbek'), (Code: 'uzb_cyrl'; DisplayName: 'Uzbek (Cyrillic)'), (Code: 'yid'; DisplayName: 'Yiddish') ); {!!} function LanguageExistsInFolder(aLanguage : TIEOCRLanguages; const sFolder : string) : Boolean; overload; function LanguageExistsInFolder(const sLangCode : string; const sFolder : string) : Boolean; overload; function CubeEngineExistsInFolder(aLanguage : TIEOCRLanguages; const sFolder : string) : Boolean; overload; function CubeEngineExistsInFolder(const sLangCode : string; const sFolder : string) : Boolean; overload; const IEV_OCR_Language_Data_Ext = '.traineddata'; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// {!! IEVisionLib Declaration function IEVisionLib():
; Description When is true then this function returns a pre-built interface which allows you to create all other IEVision objects. Example // creates empty image image := IEVisionLib().createImage(); !!} function IEVisionLib(): TIEVisionLibrary; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// type TIEVisionCustomStreamProvider = interface(IUnknown) function size(): int64; safecall; procedure seek(offset: int64; whence: TIEVisionSeekOffset); safecall; function tell(): int64; safecall; function silent_read(ptr: pointer; size: int64): int64; safecall; function silent_write(ptr: pointer; size: int64): int64; safecall; function silent_getc(): int32_t; safecall; function eof(): bool32; safecall; end; TIEVisionCustomStream = interface(TIEVisionStream) procedure reset(provider: TIEVisionCustomStreamProvider; wantExceptions: bool32 = false); safecall; // don't free "provider" object! end; TIELibJPEGErrorManager = interface(TIEVisionBase) function getNumWarnings(wantExceptions: bool32 = false): int32_t; safecall; function getErrMsgCode(wantExceptions: bool32 = false): int32_t; safecall; end; TIELibJPEGMarker = interface(TIEVisionBase) function getID(wantExceptions: bool32 = false): uint8_t; safecall; function getData(wantExceptions: bool32 = false): pointer; safecall; function getLength(wantExceptions: bool32 = false): uint32_t; safecall; function next(wantExceptions: bool32 = false): TIELibJPEGMarker; safecall; end; TIELibJPEGDecompressor = interface(TIEVisionBase) procedure setErrorManager(errorManager: TIELibJPEGErrorManager; wantExceptions: bool32 = false); safecall; procedure createDecompress(wantExceptions: bool32 = false); safecall; procedure destroyDecompress(wantExceptions: bool32 = false); safecall; procedure setupReadStream(stream: TIEVisionStream; bufferSize: uint32_t; wantExceptions: bool32 = false); safecall; procedure readHeader(requireImage: bool32; wantExceptions: bool32 = false); safecall; procedure saveMarkers(markerCode: int32_t; lengthLimit: uint32_t; wantExceptions: bool32 = false); safecall; procedure startDecompress(wantExceptions: bool32 = false); safecall; function getOutputWidth(wantExceptions: bool32 = false): uint32_t; safecall; function getOutputHeight(wantExceptions: bool32 = false): uint32_t; safecall; function getOutputComponents(wantExceptions: bool32 = false): uint32_t; safecall; function getOutputScanline(wantExceptions: bool32 = false): uint32_t; safecall; function readScanlines(scanlines: pointer; maxLines: uint32_t; wantExceptions: bool32 = false): uint32_t; safecall; procedure finishDecompress(wantExceptions: bool32 = false); safecall; procedure setOutColorSpace(colorSpace: uint32_t; wantExceptions: bool32 = false); safecall; function getOutColorSpace(wantExceptions: bool32 = false): uint32_t; safecall; function getJpegColorSpace(wantExceptions: bool32 = false): uint32_t; safecall; procedure setDCTMethod(DCTMethod: uint32_t; wantExceptions: bool32 = false); safecall; function getDensityUnit(wantExceptions: bool32 = false): uint8_t; safecall; function getXDensity(wantExceptions: bool32 = false): uint16_t; safecall; function getYDensity(wantExceptions: bool32 = false): uint16_t; safecall; function getProgressiveMode(wantExceptions: bool32 = false): bool32; safecall; function getImageWidth(wantExceptions: bool32 = false): uint32_t; safecall; function getImageHeight(wantExceptions: bool32 = false): uint32_t; safecall; procedure setScale(num: uint32_t; den: uint32_t; wantExceptions: bool32 = false); safecall; function getMarkerList(wantExceptions: bool32 = false): TIELibJPEGMarker; safecall; end; TIELibJPEGCompressor = interface(TIEVisionBase) procedure setErrorManager(errorManager: TIELibJPEGErrorManager; wantExceptions: bool32 = false); safecall; procedure setupWriteStream(stream: TIEVisionStream; bufferSize: uint32_t; wantExceptions: bool32 = false); safecall; procedure createCompress(wantExceptions: bool32 = false); safecall; procedure destroyCompress(wantExceptions: bool32 = false); safecall; procedure setImageWidth(imageWidth: uint32_t; wantExceptions: bool32 = false); safecall; procedure setImageHeight(imageHeight: uint32_t; wantExceptions: bool32 = false); safecall; procedure setInputComponents(inputComponents: uint32_t; wantExceptions: bool32 = false); safecall; procedure setInColorSpace(colorSpace: uint32_t; wantExceptions: bool32 = false); safecall; procedure setColorSpace(colorSpace: uint32_t; wantExceptions: bool32 = false); safecall; procedure setDefaults(wantExceptions: bool32 = false); safecall; procedure setDensityUnit(densityUnit: uint8_t; wantExceptions: bool32 = false); safecall; procedure setXDensity(XDensity: uint16_t; wantExceptions: bool32 = false); safecall; procedure setYDensity(YDensity: uint16_t; wantExceptions: bool32 = false); safecall; procedure setDCTMethod(DCTMethod: uint32_t; wantExceptions: bool32 = false); safecall; procedure setOptimizeCoding(optimizeCoding: bool32; wantExceptions: bool32 = false); safecall; procedure setSmoothingFactor(smoothingFactor: int32_t; wantExceptions: bool32 = false); safecall; procedure setQuality(quality: int32_t; baseline: bool32; wantExceptions: bool32 = false); safecall; procedure setSampleFactor(componentIndex: int32_t; H: int32_t; V: int32_t; wantExceptions: bool32 = false); safecall; procedure setWriteJFIFHeader(writeJFIFHeader: bool32; wantExceptions: bool32 = false); safecall; procedure simpleProgression(wantExceptions: bool32 = false); safecall; procedure startCompress(writeAllTables: bool32; wantExceptions: bool32 = false); safecall; procedure writeMarker(markerID: int32_t; markerPtr: pointer; markerLength: uint32_t; wantExceptions: bool32 = false); safecall; function getNextScanlineIndex(wantExceptions: bool32 = false): uint32_t; safecall; function writeScanlines(scanlines: pointer; maxLines: uint32_t; wantExceptions: bool32 = false): uint32_t; safecall; procedure finishCompress(wantExceptions: bool32 = false); safecall; end; TIELibJPEGTransform = interface(TIEVisionBase) procedure requestWorkspace(source: TIELibJPEGDecompressor; wantExceptions: bool32 = false); safecall; function adjustParameters(source: TIELibJPEGDecompressor; dest: TIELibJPEGCompressor; sourceCoefArrays: pointer; wantExceptions: bool32 = false): pointer; safecall; procedure executeTransformation(source: TIELibJPEGDecompressor; dest: TIELibJPEGCompressor; sourceCoefArrays: pointer; wantExceptions: bool32 = false); safecall; end; TIELibJPEGCopy = interface(TIEVisionBase) procedure copyMarkersSetup(source: TIELibJPEGDecompressor; copyOption: int32_t; wantExceptions: bool32 = false); safecall; function readCoefficients(source: TIELibJPEGDecompressor; wantExceptions: bool32 = false): pointer; safecall; procedure copyCriticalParameters(source: TIELibJPEGDecompressor; dest: TIELibJPEGCompressor; wantExceptions: bool32 = false); safecall; procedure writeCoefficients(dest: TIELibJPEGCompressor; destCoefArrays: pointer; wantExceptions: bool32 = false); safecall; procedure copyMarkersExecute(source: TIELibJPEGDecompressor; dest: TIELibJPEGCompressor; copyOption: int32_t; wantExceptions: bool32 = false); safecall; end; TIELibPNGText = interface(TIEVisionBase) function getKey(wantExceptions: bool32 = false): PAnsiChar; safecall; function getText(wantExceptions: bool32 = false): PAnsiChar; safecall; function getNext(wantExceptions: bool32 = false): TIELibPNGText; safecall; end; TIELibPNGDecompressor = interface(TIEVisionBase) function isValid(wantExceptions: bool32 = false): bool32; safecall; procedure setReadFunction(ioPtr: pointer; readDataFunction: pointer; wantExceptions: bool32 = false); safecall; procedure readInfo(wantExceptions: bool32 = false); safecall; function getIHDR(out width: uint32_t; out height: uint32_t; out bitDepth: int32_t; out colorType: int32_t; out interlaceType: int32_t; out compressionType: int32_t; out filterType: int32_t; wantExceptions: bool32 = false): uint32_t; safecall; function getText(out outPngText: TIELibPNGText; wantExceptions: bool32 = false): uint32_t; safecall; function getBackground(defaultValue: TIEVisionBGR8; wantExceptions: bool32 = false): TIEVisionBGR8; safecall; procedure setExpand(wantExceptions: bool32 = false); safecall; procedure setStrip16(wantExceptions: bool32 = false); safecall; procedure setPacking(wantExceptions: bool32 = false); safecall; procedure setGrayToRGB(wantExceptions: bool32 = false); safecall; procedure setBGR(wantExceptions: bool32 = false); safecall; procedure setSwap(wantExceptions: bool32 = false); safecall; procedure setTRNStoAlpha(wantExceptions: bool32 = false); safecall; function setInterlaceHandling(wantExceptions: bool32 = false): int32_t; safecall; procedure readUpdateInfo(wantExceptions: bool32 = false); safecall; function getXPixelsPerMeter(wantExceptions: bool32 = false): uint32_t; safecall; function getYPixelsPerMeter(wantExceptions: bool32 = false): uint32_t; safecall; function getPalette(palette: pointer; out numPalette: int32_t; wantExceptions: bool32 = false): uint32_t; safecall; function getInterlaceType(wantExceptions: bool32 = false): uint8_t; safecall; function getChannels(wantExceptions: bool32 = false): uint8_t; safecall; procedure readRows(row: pointer; displayRow: pointer; numRows: uint32_t; wantExceptions: bool32 = false); safecall; procedure readEnd(wantExceptions: bool32 = false); safecall; function getTRNS(trans: pointer; out numTrans: int32_t; wantExceptions: bool32 = false): uint32_t; safecall; end; TIELibPNGTextList = interface(TIEVisionBase) procedure assign(index: int32_t; compression: int32_t; key: PAnsiChar; text: PAnsiChar; wantExceptions: bool32 = false); safecall; end; TIELibPNGCompressor = interface(TIEVisionBase) function isValid(wantExceptions: bool32 = false): bool32; safecall; procedure setWriteFunction(ioPtr: pointer; writeFunc: pointer; flushFunc: pointer; wantExceptions: bool32 = false); safecall; procedure setPalette(palette: pointer; numPalette: int32_t; wantExceptions: bool32 = false); safecall; procedure setTRNS(trans: pbyte; numTrans: int32_t; wantExceptions: bool32 = false); safecall; procedure setIHDR(width: uint32_t; height: uint32_t; bitDepth: int32_t; colorType: int32_t; interlaceType: int32_t; compressionType: int32_t; filterType: int32_t; wantExceptions: bool32 = false); safecall; procedure setPHYS(resX: uint32_t; resY: uint32_t; unitType: int32_t; wantExceptions: bool32 = false); safecall; procedure setFilter(method: int32_t; filters: int32_t; wantExceptions: bool32 = false); safecall; procedure setBackground(colorValue: TIEVisionBGR8; colorIndex: uint8_t; wantExceptions: bool32 = false); safecall; procedure setCompressionLevel(level: int32_t; wantExceptions: bool32 = false); safecall; procedure setBGR(wantExceptions: bool32 = false); safecall; procedure writeInfo(wantExceptions: bool32 = false); safecall; function setInterlaceHandling(wantExceptions: bool32 = false): int32_t; safecall; procedure writeRows(row: pointer; numRows: uint32_t; wantExceptions: bool32 = false); safecall; procedure writeEnd(wantExceptions: bool32 = false); safecall; procedure setText(textList: TIELibPNGTextList; wantExceptions: bool32 = false); safecall; end; TIELibJP2KComponentParamsList = interface(TIEVisionBase) procedure assign(index: int32_t; tlx: uint32_t; tly: uint32_t; hstep: uint32_t; vstep: uint32_t; width: uint32_t; height: uint32_t; prec: uint16_t; sgnd: int32_t; wantExceptions: bool32 = false); safecall; end; TIELibJP2KMatrix = interface(TIEVisionBase) function getValue(i: int32_t; j: int32_t; wantExceptions: bool32 = false): int32_t; safecall; end; TIELibJP2KImage = interface(TIEVisionBase) function getWidth(wantExceptions: bool32 = false): int32_t; safecall; function getHeight(wantExceptions: bool32 = false): int32_t; safecall; function getColorSpace(wantExceptions: bool32 = false): int32_t; safecall; function getComponentByType(component: int32_t; wantExceptions: bool32 = false): int32_t; safecall; function getComponentPrecision(index: int32_t; wantExceptions: bool32 = false): int32_t; safecall; function getNumComponents(wantExceptions: bool32 = false): int32_t; safecall; function getComponentHeight(index: int32_t; wantExceptions: bool32 = false): int32_t; safecall; function getComponentWidth(index: int32_t; wantExceptions: bool32 = false): int32_t; safecall; function readComponent(index: uint16_t; x: int32_t; y: int32_t; width: int32_t; height: int32_t; data: TIELibJP2KMatrix; wantExceptions: bool32 = false): int32_t; safecall; function getComponentTopLeftY(index: int32_t; wantExceptions: bool32 = false): int32_t; safecall; function getComponentTopLeftX(index: int32_t; wantExceptions: bool32 = false): int32_t; safecall; function getComponentVStep(index: int32_t; wantExceptions: bool32 = false): int32_t; safecall; function getComponentHStep(index: int32_t; wantExceptions: bool32 = false): int32_t; safecall; procedure encode(stream: TIEVisionStream; format: int32_t; options: PAnsiChar; wantExceptions: bool32 = false); safecall; procedure setComponentType(index: int32_t; component: int32_t; wantExceptions: bool32 = true); safecall; procedure writeComponentSample(index: int32_t; x: int32_t; y: int32_t; v: uint32_t; wantExceptions: bool32 = false); safecall; procedure writeRowRGB8(width: int32_t; rowIndex: int32_t; bgr8Array: pbyte; alphaArray: pbyte; colors: int32_t; wantExceptions: bool32 = false); safecall; procedure readLinearBGR8(blueMatrix: TIELibJP2KMatrix; greenMatrix: TIELibJP2KMatrix; redMatrix: TIELibJP2KMatrix; rowIndex: int32_t; bluePrec: int32_t; greenPrec: int32_t; redPrec: int32_t; destBGR8: pbyte; width: int32_t; wantExceptions: bool32 = true); safecall; end; TIELibDCRAWTextInfo = ( ievCOLOR_DESCRIPTION = 0, ievIMAGE_DESCRIPTION = 1, ievMAKE = 2, ievMODEL = 3, ievMODEL2 = 4, ievARTIST = 5 ); TIELibDCRAWIntInfo = ( ievWIDTH = 0, ievHEIGHT = 1, ievORIGINAL_WIDTH = 2, ievORIGINAL_HEIGHT = 3, ievPIXELFORMAT = 4 // its type is TIELibDCRAWPixelFormat ); TIELibDCRAWPixelFormat = ( ievRGB24 = 0, ievRGB48 = 1 ); TIELibDCRAWDecoder = interface(TIEVisionBase) function getTextInfo(info: TIELibDCRAWTextInfo; wantExceptions: bool32 = false): TIEVisionString; safecall; function getIntInfo(info: TIELibDCRAWIntInfo; wantExceptions: bool32 = false): int32_t; safecall; procedure getRow(rowIndex: uint32_t; destBuffer: pointer; wantExceptions: bool32 = false); safecall; function imageLoaded(wantExceptions: bool32 = false): longbool; safecall; function getOutStream(wantExceptions: bool32 = false): TIEVisionMemoryStream; safecall; end; TIELib = interface(TIEVisionBase) procedure debug(wantExceptions: bool32 = false); safecall; function createString(wantExceptions: bool32 = false): TIEVisionString; overload; safecall; function createString(src: TIEVisionString; wantExceptions: bool32 = false): TIEVisionString; overload; safecall; function createString(src: PAnsiChar; wantExceptions: bool32 = false): TIEVisionString; overload; safecall; function createVectorString(wantExceptions: bool32 = false): TIEVisionVectorString; overload; safecall; function createVectorString(src: TIEVisionVectorString; wantExceptions: bool32 = false): TIEVisionVectorString; overload; safecall; function createCustomStream(provider: TIEVisionCustomStreamProvider; wantExceptions: bool32 = false): TIEVisionCustomStream; safecall; function createJPEGErrorManager(wantExceptions: bool32 = false): TIELibJPEGErrorManager; safecall; function createJPEGDecompressor(wantExceptions: bool32 = false): TIELibJPEGDecompressor; safecall; function createJPEGCompressor(wantExceptions: bool32 = false): TIELibJPEGCompressor; safecall; function createJPEGTransform(transform: int32_t; trim: bool32; forceGrayscale: bool32; xoffs: uint32_t; yoffs: uint32_t; newWidth: uint32_t; newHeight: uint32_t; wantExceptions: bool32 = false): TIELibJPEGTransform; safecall; function createJPEGCopy(wantExceptions: bool32 = false): TIELibJPEGCopy; safecall; function createPNGDecompressor(errorPtr: pointer; errorFunc: pointer; warnFunc: pointer; wantExceptions: bool32 = false): TIELibPNGDecompressor; safecall; function PNGGetIOPtr(pngPtr: pointer; wantExceptions: bool32 = false): pointer; safecall; function PNGGetErrorPtr(pngPtr: pointer; wantExceptions: bool32 = false): pointer; safecall; function PNGSigCmp(sig: pointer; start: uint32_t; numToCheck: uint32_t; wantExceptions: bool32 = false): int32_t; safecall; function createPNGTextList(size: uint32_t; wantExceptions: bool32 = false): TIELibPNGTextList; safecall; function createPNGCompressor(errorPtr: pointer; errorFunc: pointer; warnFunc: pointer; wantExceptions: bool32 = false): TIELibPNGCompressor; safecall; procedure JP2KInitialize(wantExceptions: bool32 = false); safecall; procedure JP2KFinalize(wantExceptions: bool32 = false); safecall; function createJP2KImage(stream: TIEVisionStream; wantExceptions: bool32 = false): TIELibJP2KImage; overload; safecall; function createJP2KImage(numComponents: uint16_t; parameters: TIELibJP2KComponentParamsList; colorModel: int32_t; wantExceptions: bool32 = false): TIELibJP2KImage; overload; safecall; function createJP2KComponentParamsList(size: int32_t; wantExceptions: bool32 = false): TIELibJP2KComponentParamsList; safecall; function createJP2KMatrix(numRows: int32_t; numCols: int32_t; wantExceptions: bool32 = false): TIELibJP2KMatrix; safecall; function createDCRAWDecoder(inStream: TIEVisionStream; parameters: TIEVisionVectorString; progressCallback: pointer; progressUserData: pointer; wantExceptions: bool32 = false): TIELibDCRAWDecoder; safecall; end; procedure IEInitialize_ielib(const sDLLPath: WideString = ''; reinitialize: boolean = true); procedure IEFinalize_ielib(); function IELibAvailable(): boolean; function IELib(): TIELib; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// const IELIB_32BIT_DLL_FILENAME1 = 'ielib.dll'; IELIB_32BIT_DLL_FILENAME2 = 'ielib32.dll'; IELIB_64BIT_DLL_FILENAME = 'ielib64.dll'; IEVISION_32BIT_DLL_FILENAME1 = 'ievision.dll'; IEVISION_32BIT_DLL_FILENAME2 = 'ievision32.dll'; IEVISION_64BIT_DLL_FILENAME = 'ievision64.dll'; IELib_DLL_Filenames : array[0 .. 5] of string = ( IELIB_32BIT_DLL_FILENAME1, IELIB_32BIT_DLL_FILENAME2, IELIB_64BIT_DLL_FILENAME, IEVISION_32BIT_DLL_FILENAME1, IEVISION_32BIT_DLL_FILENAME2, IEVISION_64BIT_DLL_FILENAME ); implementation uses SyncObjs, iexBitmaps, hyieutils; var VisionHandle: THandle = 0; IEVisionLib_: TIEVisionLibrary = nil; IEVisionCS: TCriticalSection; iev_Library_create: procedure(out result: TIEVisionLibrary); cdecl; function IEVisionLib(): TIEVisionLibrary; begin if (VisionHandle = 0) or (IEVisionLib_ = nil) then // check also IEVisionLib_ because IEInitialize_ievision could still run in another thread IEInitialize_ievision('', false); result := IEVisionLib_; end; function IEVisionAvailable(): boolean; begin if (VisionHandle = 0) or (IEVisionLib_ = nil) then // check also IEVisionLib_ because IEInitialize_ievision could still run in another thread IEInitialize_ievision('', false); result := (VisionHandle <> 0) and (IEVisionLib_ <> nil); end; procedure IEInitialize_ievision(const sDLLPath: WideString = ''; reinitialize: boolean = true); procedure TryLoad(const dllname: WideString); begin if VisionHandle <> 0 then exit; if IsLibrary then // if this is a DLL try to load from dll path VisionHandle := LoadLibraryW(PWideChar( ExtractFilePath(GetModuleName(HInstance)) + dllname )); if VisionHandle = 0 then // in case IsLibrary was true but LoadLibrary failed VisionHandle := LoadLibraryW(PWideChar(dllname)); if VisionHandle <> 0 then begin @iev_Library_create := GetProcAddress(VisionHandle, 'iev_Library_create'); // initialization if @iev_Library_create <> nil then begin iev_Library_create(IEVisionLib_); end else begin FreeLibrary(VisionHandle); VisionHandle := 0; end; end; end; var I: Integer; begin IEVisionCS.Enter(); try if reinitialize then IEFinalize_ievision(); if sDLLPath <> '' then TryLoad( sDLLPath ) else for I := Low( IELib_DLL_Filenames ) to High( IELib_DLL_Filenames ) do TryLoad( IELib_DLL_Filenames[ I ]); finally IEVisionCS.Leave(); end; end; procedure IEFinalize_ievision(); begin if VisionHandle <> 0 then begin IEVisionLib_ := nil; FreeLibrary(VisionHandle); VisionHandle := 0; end; end; /////// var IELibHandle: THandle = 0; IELib_: TIELib = nil; iev_IELib_create: procedure(out result: TIELib); cdecl; function IELib(): TIELib; begin if (IELibHandle = 0) or (IELib_ = nil) then // check also IELib_ because IEInitialize_ielib could still run in another thread IEInitialize_ielib('', false); result := IELib_; end; {!! IELibAvailable Declaration function IELibAvailable() : Boolean; Description Returns true if the DLL's required by ImageEn are available (e.g. ielib64.dll for a 64bit ImageEn application. Also initializes the library. Example procedure TMainForm.FormShow(Sender: TObject); begin if IELibAvailable() = False then MessageDlg(format('The installation is incomplete. Please reinstall %s', [Application_Name]), mtError, [mbOK], 0); end; !!} function IELibAvailable() : Boolean; begin if (IELibHandle = 0) or (IELib_ = nil) then // check also IELib_ because IEInitialize_ielib could still run in another thread IEInitialize_ielib('', false); result := (IELibHandle <> 0) and (IELib_ <> nil); end; procedure IEInitialize_ielib(const sDLLPath: WideString = ''; reinitialize: boolean = true); procedure TryLoad(const dllname: WideString); begin if IELibHandle <> 0 then exit; if IsLibrary then // if this is a DLL try to load from dll path IELibHandle := LoadLibraryW(PWideChar( ExtractFilePath(GetModuleName(HInstance)) + dllname )); if IELibHandle = 0 then // in case IsLibrary was true but LoadLibrary failed IELibHandle := LoadLibraryW(PWideChar(dllname)); if IELibHandle <> 0 then begin @iev_IELib_create := GetProcAddress(IELibHandle, 'iev_IELib_create'); // initialization if @iev_IELib_create <> nil then begin iev_IELib_create(IELib_); end else begin FreeLibrary(IELibHandle); IELibHandle := 0; end; end; end; var I: Integer; begin IEVisionCS.Enter(); try if reinitialize then IEFinalize_ielib(); if sDLLPath <> '' then TryLoad( sDLLPath ) else for I := Low( IELib_DLL_Filenames ) to High( IELib_DLL_Filenames ) do TryLoad( IELib_DLL_Filenames[ I ]); finally IEVisionCS.Leave(); end; end; procedure IEFinalize_ielib(); begin if IELibHandle <> 0 then begin IELib_ := nil; FreeLibrary(IELibHandle); IELibHandle := 0; end; end; ///////////////////////////////////////////////////////////////////////// // Utilities function IEVisionSize(width, height: int32_t): TIEVisionSize; begin result.width := width; result.height := height; end; function IEVisionRect(x, y, width, height: int32_t): TIEVisionRect; begin result.x := x; result.y := y; result.width := width; result.height := height; end; function IEVisionRectToTRect(Rect: TIEVisionRect): TRect; begin result.Left := Rect.x; result.Top := Rect.y; result.Right := Rect.x + Rect.width - 1; result.Bottom := Rect.y + Rect.height - 1; end; function IEVisionPoint(x, y: int32_t): TIEVisionPoint; begin result.x := x; result.y := y; end; function IEVisionScalar(val0: double; val1: double = 0.0; val2: double = 0.0; val3: double = 0.0): TIEVisionScalar; begin result.val[0] := val0; result.val[1] := val1; result.val[2] := val2; result.val[3] := val3; end; function IEVisionFloatPair(first: double; second: double): TIEVisionFloatPair; begin result.first := first; result.second := second; end; function IEVisionTermCriteria(ctype: TIEVisionTermCriteriaType; maxIter: int32_t; epsilon: double): TIEVisionTermCriteria; begin result.ctype := ctype; result.maxIter := maxIter; result.epsilon := epsilon; end; {!! IEVisionLanguageCodeToName Declaration function IEVisionLanguageCodeToName(const sLangCode : string) : string; Description Converts a language code (which can be used for loading an OCR language file) to a display name. E.g. IEVisionLanguageCodeToName('eng') would retun 'English'. See Also - - - !!} function IEVisionLanguageCodeToName(const sLangCode : string) : string; var Lng : TIEOCRLanguages; begin Result := ''; for Lng := Low(IEOCRLanguageList) to High(IEOCRLanguageList) do if SameText(string(AnsiString(IEOCRLanguageList[Lng].Code)), sLangCode) then begin Result := IEOCRLanguageList[Lng].DisplayName; Break; end; end; {!! IEVisionLanguageNameToCode Declaration function IEVisionLanguageNameToCode(const sLangName : string) : string; Description Returns the language code (which can be used for loading an OCR language file) from a display name (filled using A TIEOCRLanguages>). E.g. IEVisionLanguageNameToCode('English') would retun 'eng'. Example procedure TMainForm.FormCreate(Sender: TObject); begin // Fill our Combobox with available languages IEVisionGetLanguagesInFolder(cmbLanguage.Items, ExtractFilePath(Application.ExeName), True); // Default to English cmbLanguage.ItemIndex := cmbLanguage.Items.IndexOf(IEOCRLanguageList[OCR_English_language].DisplayName); end; procedure TMainForm.btnRecognizeClick(Sender: TObject); var sLangCode: string; begin // Get selected language code sLangCode := IEVisionLanguageNameToCode(cmbLanguage.Text); // create OCR object m_OCR := IEVisionLib.createOCR(PAnsiChar(ExtractFilePath(Application.ExeName)), PAnsiChar(sLangCode), ievOCRFAST); ... end; See Also - - - !!} function IEVisionLanguageNameToCode(const sLangName : string) : string; var Lng : TIEOCRLanguages; begin Result := ''; for Lng := Low(IEOCRLanguageList) to High(IEOCRLanguageList) do if SameText(IEOCRLanguageList[Lng].DisplayName, sLangName) then begin Result := string(AnsiString(IEOCRLanguageList[Lng].Code)); Break; end; end; {!! IEVisionGetLanguagesInFolder Declaration function IEVisionGetLanguagesInFolder(ssDest : TStrings; const sFolder : string; bDisplayName : Boolean = False) : Boolean; Description Finds all the language files in a folder and fills ssDest with their display name or language code. Language files of IEVision will be named with a language code followed by extensions such as traineddata (IEV_OCR_Language_Data_Ext), word-freq, params, size, etc. Result is false if no language files are found. Example procedure TMainForm.FormCreate(Sender: TObject); begin // Fill our Combobox with available languages IEVisionGetLanguagesInFolder(cmbLanguage.Items, ExtractFilePath(Application.ExeName), True); // Default to English cmbLanguage.ItemIndex := cmbLanguage.Items.IndexOf(IEOCRLanguageList[OCR_English_language].DisplayName); end; procedure TMainForm.btnRecognizeClick(Sender: TObject); var sLangCode: string; begin // Get selected language code sLangCode := IEVisionLanguageNameToCode(cmbLanguage.Text); // create OCR object m_OCR := IEVisionLib.createOCR(PAnsiChar(ExtractFilePath(Application.ExeName)), PAnsiChar(sLangCode), ievOCRFAST); ... end; See Also - - - - !!} function IEVisionGetLanguagesInFolder(ssDest : TStrings; const sFolder : string; bDisplayName : Boolean = False) : Boolean; var Lng : TIEOCRLanguages; begin Result := False; ssDest.BeginUpdate; ssDest.Clear; for Lng := Low(IEOCRLanguageList) to High(IEOCRLanguageList) do if LanguageExistsInFolder(string(AnsiString(IEOCRLanguageList[Lng].Code)), sFolder) then begin if bDisplayName then ssDest.Add(IEOCRLanguageList[Lng].DisplayName) else ssDest.Add(string(AnsiString(IEOCRLanguageList[Lng].Code))); Result := True; end; ssDest.EndUpdate; end; {!! LanguageExistsInFolder Declaration function LanguageExistsInFolder(aLanguage : TIEOCRLanguages; const sFolder : string) : Boolean; overload; function LanguageExistsInFolder(const sLangCode : string; const sFolder : string) : Boolean; overload; Description Returns true if the language file for the specified language is found in a folder. Language files of IEVision will be named with a language code followed by extensions such as traineddata (IEV_OCR_Language_Data_Ext), word-freq, params, size, etc. Examples if LanguageExistsInFolder(IEVisionLanguageNameToCode('English'), ExtractFilePath(Application.ExeName)) = False then MessageDlg('The English language OCR files could not be found. Please reinstall.', mtError, [mbOK], 0); if LanguageExistsInFolder(OCR_English_language, ExtractFilePath(Application.ExeName)) = False then MessageDlg('The English language OCR files could not be found. Please reinstall.', mtError, [mbOK], 0); See Also - - - - - !!} function LanguageExistsInFolder(aLanguage : TIEOCRLanguages; const sFolder : string) : Boolean; begin result := LanguageExistsInFolder(string(AnsiString(IEOCRLanguageList[aLanguage].Code)), sFolder); end; function LanguageExistsInFolder(const sLangCode : string; const sFolder : string) : Boolean; var sFilename: string; begin sFilename := IEAddBackSlash(sFolder) + sLangCode + IEV_OCR_Language_Data_Ext; Result := FileExists(sFilename); end; {!! CubeEngineExistsInFolder Declaration function CubeEngineExistsInFolder(aLanguage : TIEOCRLanguages; const sFolder : string) : Boolean; overload; function CubeEngineExistsInFolder(const sLangCode : string; const sFolder : string) : Boolean; overload; Description Returns true if the support files for the Cube OCR engine of a specified language is found in a folder. When creating the OCR engine you must specify which OCR engine to use, base, Cube, or both. If you use the base OCR engine (ievOCRFAST) you will only require the *.trained data support file, e.g. eng.traineddata for processing of an English language document. Use of ievOCRCUBE and ievOCRACCURATE require you to also enclude the *.cube.* files. e.g. eng.cube.word-freq, eng.cube.size, etc. All existing cube trainings have the following files: XXX.cube.fold XXX.cube.lm XXX.cube.nn XXX.cube.params XXX.cube.size XXX.cube.word-freq Some also have these files: XXX.cube.bigrams XXX.cube-word-dawg XXX.cube-unicharset XXX.tesseract_cube.nn Example if (SelectedOCREngine in [ievOCRCUBE, ievOCRACCURATE]) and (CubeEngineExistsInFolder(OCR_English_language, ExtractFilePath(Application.ExeName)) = False) then MessageDlg('Files for the selected OCR engine could not be found. Please reinstall.', mtError, [mbOK], 0); See Also - - - - !!} function CubeEngineExistsInFolder(aLanguage : TIEOCRLanguages; const sFolder : string) : Boolean; begin result := CubeEngineExistsInFolder(string(AnsiString(IEOCRLanguageList[aLanguage].Code)), sFolder); end; function CubeEngineExistsInFolder(const sLangCode : string; const sFolder : string) : Boolean; const IEV_Cube_OCR_Engine_Ext_1 = '.cube.size'; IEV_Cube_OCR_Engine_Ext_2 = '.cube.word-freq'; var sFilename1, sFilename2 : string; begin sFilename1 := IEAddBackSlash(sFolder) + sLangCode + IEV_Cube_OCR_Engine_Ext_1; sFilename2 := IEAddBackSlash(sFolder) + sLangCode + IEV_Cube_OCR_Engine_Ext_2; Result := FileExists(sFilename1) and FileExists(sFilename2); end; initialization IEVisionCS := TCriticalSection.Create(); finalization FreeAndNil(IEVisionCS); {$else} // IEVISION interface function IELibAvailable(): boolean; function IEVisionAvailable(): boolean; implementation function IELibAvailable(): boolean; begin result := false; end; function IEVisionAvailable(): boolean; begin result := false; end; {$endif} // IEVISION end.