Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
eVision 6.7.1
C++
REFERENCE MANUAL
eVision 6.7.1
WARNING
EURESYS S.A. shall retain all property rights,
title and interest in the hardware or the software,
documentation and trademarks of EURESYS S.A.
All the names of companies and products mentioned in the
documentation may be the trademarks of their respective owners.
The licensing, use, leasing, loaning, translation,
reproduction, copying or modification of the hardware
or the software, marks or documentation of EURESYS S.A.
contained in this book, is not allowed without prior notice.
EURESYS S.A. may modify the product specifications
or change the information given in this documentation
at any time, in its discretion, and without prior notice.
EURESYS S.A. shall not be liable for any loss of or damage
to revenues, profits, goodwill, data, information systems
or other special, incidental, indirect, consequential
or punitive damages of any kind arising in connection
with the use of the hardware or the software of EURESYS S.A.
or resulting of omissions or errors in this book.
info@euresys.com
www.euresys.com
America
Asia
Japan
Europe
Euresys Inc.
Euresys s.a.
Japan Representative Office
Euresys s.a.
Corporate Headquarters
Singapore 389842
Shibuya-ku,
Tokyo 150-0012,
Japan
B-4031 Angleur,
Belgium
America
Toll free:
Phone:
Fax:
1-866-EURESYS
+1 630-250-2300
+1 630-250-2301
+32 4 367 72 88
+32 4 367 74 66
Asia
Phone:
Fax:
Japan
Phone:
Fax:
Europe
Phone:
Fax:
Table Of Contents
OVERVIEW OF EVISION COMPONENTS ...................................................1
vi
Table Of Contents
2.12 EROIC24................................................................................................................................53
2.12.1 EROIC24 Overview..............................................................................................................53
2.12.2 EROIC24 Class Members ...................................................................................................54
2.12.2.1 EROIC24 Construction ..................................................................................................54
Default Constructor ........................................................................................................................54
Sizing Constructor..........................................................................................................................54
Copy Constructor ...........................................................................................................................54
2.14 EROIC15................................................................................................................................57
2.14.1 EROIC15 Overview..............................................................................................................57
2.14.2 EROIC15 Class Members ...................................................................................................58
2.14.2.1 EROIC15 Construction ..................................................................................................58
Default Constructor ........................................................................................................................58
Sizing Constructor..........................................................................................................................58
Copy Constructor ...........................................................................................................................58
2.15 EROIC16................................................................................................................................59
2.15.1 EROIC16 Overview..............................................................................................................59
2.15.2 EROIC16 Class Members ...................................................................................................60
2.15.2.1 EROIC16 Construction ..................................................................................................60
Default Constructor ........................................................................................................................60
Sizing Constructor..........................................................................................................................60
Copy Constructor ...........................................................................................................................60
2.16 EVectorTemplate..................................................................................................................61
2.16.1 EVectorTemplate Overview .................................................................................................61
2.16.2 EVectorTemplate Class members .......................................................................................61
EVectorTemplate: Construction .....................................................................................................61
EVectorTemplate::Get/Set Closed .................................................................................................61
EVectorTemplate::WeightedMoment .............................................................................................62
EVectorTemplate::AddElement......................................................................................................62
viii
Table Of Contents
EVectorTemplate::GetDataPtr .......................................................................................................62
EVectorTemplate::Draw .................................................................................................................62
EVectorTemplate::Empty ...............................................................................................................63
EVectorTemplate::Get/SetNumElements.......................................................................................64
EVectorTemplate::Operator[ ] ........................................................................................................64
2.17 Vector<>................................................................................................................................64
2.17.1 Vector<> Overview ..............................................................................................................64
2.17.2 Vector<> Class Members ....................................................................................................65
2.18 EMeasurementUnit ..............................................................................................................66
2.18.1 EMeasurementUnit Class Members ....................................................................................66
EMeasurementUnit Construction ...................................................................................................66
EMeasurementUnit::ConversionFactorTo......................................................................................66
EMeasurementUnit::GetName .......................................................................................................66
EMeasurementUnit::SetName .......................................................................................................66
EMeasurementUnit::GetMagnitude................................................................................................66
EMeasurementUnit::SetMagnitude ................................................................................................66
2.19 EDimensionalValue..............................................................................................................67
2.19.1 EDimensionalValue Class Members ...................................................................................67
EDimensionalValue: Construction..................................................................................................67
EDimensionalValue::GetValue.......................................................................................................67
EDimensionalValue::SetValue .......................................................................................................67
EDimensionalValue::Get/SetUnit ...................................................................................................67
ix
2.21 ESerializer.............................................................................................................................76
2.21.1 ESerializer Overview............................................................................................................76
2.21.2 ESerializer Class Members..................................................................................................76
ESerializer::CreateFileWriter..........................................................................................................76
ESerializer::CreateFileReader .......................................................................................................77
ESerializer::GetNextObjectType ....................................................................................................77
ESerializer::IsWriting......................................................................................................................78
ESerializer::IsReading....................................................................................................................78
ESerializer::Close...........................................................................................................................78
enum FileWriterMode.....................................................................................................................78
enum ObjectType...........................................................................................................................79
2.22 EJpegHandler.......................................................................................................................80
2.22.1 EJpegHandler Overview ......................................................................................................80
2.22.2 EJpegHandler Class Members ............................................................................................80
2.22.2.1 Construction...................................................................................................................80
EJpegHandler Construction ...........................................................................................................80
3. FUNCTIONS.................................................................................................................................83
3.1 Initialization and Termination .............................................................................................83
Initialize ..........................................................................................................................................83
Terminate .......................................................................................................................................83
3.4 Copying.................................................................................................................................85
ESetRecursiveCopyBehavior.........................................................................................................85
EGetRecursiveCopyBehavior ........................................................................................................86
Table Of Contents
ETraceRS.......................................................................................................................................88
ThrowOnEError ..............................................................................................................................88
4. ENUMERATION CONSTANTS....................................................................................................94
4.1 enum DATA_SIZE ................................................................................................................94
4.2 enum DATA_TYPE ...............................................................................................................94
4.3 enum E_ANGLE_UNITS.......................................................................................................94
4.4 enum E_MEASUREMENT_UNITS .......................................................................................94
4.5 enum E_FRAME_POSITION ................................................................................................95
4.6 enum E_SELECTION_MODE...............................................................................................95
4.7 enum E_TRACE_MODE .......................................................................................................95
4.8 enum E_HANDLES...............................................................................................................95
4.9 enum IMAGE_FILE_TYPES .................................................................................................96
4.10 enum E_IMAGE_TYPES.......................................................................................................97
4.11 enum E_STATE ....................................................................................................................97
4.12 enum VECT_TYPE ...............................................................................................................97
5. SAMPLE PROGRAMS.................................................................................................................98
xi
EKernel::GetDataPtr ....................................................................................................................104
EKernel::GetKernelData...............................................................................................................104
EKernel::SetKernelData ...............................................................................................................104
2.2 EMovingAverage................................................................................................................107
2.2.1 EMovingAverage Overview ...............................................................................................107
2.2.2 EMovingAverage Class Members .....................................................................................107
2.2.2.1 Construction.................................................................................................................107
EmovingAverage: Construction....................................................................................................107
EMovingAverage::Get/SetSize.....................................................................................................108
EMovingAverage::Get/SetSize.....................................................................................................108
EMovingAverage::Reset ..............................................................................................................109
EMovingAverage::Average/GetSrcImage ....................................................................................109
EMovingAverage::Average/GetSrcImage ....................................................................................110
3. FUNCTIONS...............................................................................................................................111
3.1 Intensity Scale Transforms ...............................................................................................114
ImgGainOffset ..............................................................................................................................114
ImgNormalize ...............................................................................................................................115
ImgLut ..........................................................................................................................................115
ImgTransform...............................................................................................................................116
ImgUniformize ..............................................................................................................................116
xii
Table Of Contents
ImgConvolGradientY....................................................................................................................133
ImgConvolGradient ......................................................................................................................134
ImgConvolPrewittX.......................................................................................................................134
ImgConvolPrewittY.......................................................................................................................134
ImgConvolPrewitt .........................................................................................................................135
ImgConvolSobelX ........................................................................................................................135
ImgConvolSobelY ........................................................................................................................136
ImgConvolSobel...........................................................................................................................136
ImgConvolRoberts .......................................................................................................................136
ImgConvolUniform .......................................................................................................................137
ImgConvolGaussian.....................................................................................................................137
ImgModulusImage........................................................................................................................138
ImgArgumentImage......................................................................................................................138
ImgGradientScalar .......................................................................................................................139
3.8 Contouring..........................................................................................................................157
ImgContour ..................................................................................................................................157
xiii
ImgBinaryMoments ......................................................................................................................160
ImgWeightedMoments .................................................................................................................161
ImgGravityCenter .........................................................................................................................162
ImgCount......................................................................................................................................163
ImgPixelCount..............................................................................................................................163
ImgPixelAverage ..........................................................................................................................164
ImgLocalAverage .........................................................................................................................164
ImgPixelStdDev............................................................................................................................165
ImgLocalDeviation........................................................................................................................165
ImgPixelVariance .........................................................................................................................166
ImgPixelMax.................................................................................................................................166
ImgPixelMin..................................................................................................................................167
ImgPixelStat .................................................................................................................................167
ImgPixelCompare.........................................................................................................................167
4. ENUMERATION CONSTANTS..................................................................................................182
4.1 enum ARITH_LOGIC_OPERATIONS ................................................................................182
4.2 enum CONNEXITY .............................................................................................................183
4.3 enum CONTOUR_MODE....................................................................................................183
4.4 enum CONTOUR_THRESHOLD ........................................................................................183
4.5 enum IMG_HISTOGRAM_FEATURE .................................................................................183
4.6 enum IMG_REFERENCE_NOISE ......................................................................................184
4.7 enum IMG_THRESHOLD_MODES ....................................................................................184
4.8 enum KERNEL_RECTIFIER...............................................................................................184
4.9 enum KERNEL_ROTATION ...............................................................................................185
4.10 enum KERNEL_TYPE ........................................................................................................185
5. SAMPLE PROGRAMS...............................................................................................................186
xiv
Table Of Contents
3. FUNCTIONS...............................................................................................................................200
3.1 Color Conversions .............................................................................................................200
Quantized Color Conversions ......................................................................................................200
Unquantized Color Conversions ..................................................................................................201
xv
4. ENUMERATION CONSTANTS..................................................................................................215
4.1 enum E_COLOR_SYSTEM ................................................................................................215
4.2 enum E_RGB_STANDARD ................................................................................................215
4.3 enum E_COLOR_QUANTIZATION ....................................................................................216
5. SAMPLE PROGRAMS...............................................................................................................217
xvi
Table Of Contents
ECodedImage::FeatureVariance..................................................................................................230
ECodedImage::FeatureDeviation.................................................................................................230
ECodedImage::ObjectConvexHull ...............................................................................................230
ECodedImage::Get/Set LimitAngle ..............................................................................................231
2.1.2.7 Drawing........................................................................................................................234
ECodedImage::Get/Set DrawDiagonals.......................................................................................234
ECodedImage::DrawObjects........................................................................................................234
ECodedImage::DrawObjectsFeature ...........................................................................................235
ECodedImage::DrawObject .........................................................................................................236
ECodedImage::DrawObjectFeature .............................................................................................236
ECodedImage::Drawn Features...................................................................................................237
xvii
ECodedImage::BuildLabeledRuns ...............................................................................................245
3. FUNCTIONS...............................................................................................................................254
3.1 Features computation........................................................................................................254
ObjContourArea ...........................................................................................................................254
ObjContourGravityCenter.............................................................................................................254
ObjContourInertia.........................................................................................................................254
4. ENUMERATION CONSTANTS..................................................................................................255
4.1 enum OBJECT_CONNEXITY .............................................................................................255
4.2 enum OBJECT_FEATURES...............................................................................................255
4.3 enum RUN_TYPE ...............................................................................................................256
4.4 enum SELECT_OPTIONS ..................................................................................................257
4.5 enum SELECT_BY_POSITION ..........................................................................................257
4.6 enum SORT_OPTIONS ......................................................................................................257
5. STRUCTURES ...........................................................................................................................258
xviii
Table Of Contents
5.1
5.2
5.3
5.4
6. SAMPLE PROGRAMS...............................................................................................................260
2.1.2.6 Measurement...............................................................................................................272
EGauge::Measure ....................................................................................................................272
EGauge::Process .....................................................................................................................272
EGauge::MeasureSample ........................................................................................................272
EGauge::Get/Set ActualShape.................................................................................................273
EGauge::Get/Set SamplingStep...............................................................................................273
EGauge::Get/Set FilteringThreshold ........................................................................................273
EGauge::Get/Set NumFilteringPasses .....................................................................................274
EGauge::Get/Set HVConstraint................................................................................................274
EGauge::Get/Set MinNumFitSamples......................................................................................275
xix
EGauge::AddSkipRange ..........................................................................................................275
EGauge::GetNumSkipRanges..................................................................................................276
EGauge::GetSkipRange ...........................................................................................................276
EGauge::RemoveSkipRange ...................................................................................................276
xx
Table Of Contents
2.3.2.3 Measurement...............................................................................................................291
ELineGauge::Get/Set KnownAngle..............................................................................................291
ELineGauge::Get/Set ClippingMode ............................................................................................291
2.4.2.3 Measurement...............................................................................................................298
ECircleGauge::Get/Set InnerFilteringThreshold...........................................................................298
ECircleGauge::DisableInnerFiltering............................................................................................298
ECircleGauge::IsInnerFilteringEnabled........................................................................................299
2.5.2.4 Measurement...............................................................................................................304
xxi
2.6 EWedgeGauge....................................................................................................................306
2.6.1.1 EWedgeGauge Overview ............................................................................................306
2.6.2 EWedgeGauge Class Members ........................................................................................307
2.6.2.1 EWedgeGauge Constrution.........................................................................................307
Default constructor .......................................................................................................................307
Copy constructor ..........................................................................................................................308
xxii
Table Of Contents
EFrameShape::GetNumDaughters ..............................................................................................318
EFrameShape::GetDaughter .......................................................................................................318
3. ENUMERATION CONSTANTS..................................................................................................320
3.1 enum GGE_TRANSITION_TYPE .......................................................................................320
3.2 enum GGE_TRANSITION_CHOICE...................................................................................320
3.3 enum GGE_CLIPPING_MODE...........................................................................................320
3.4 enum INS_SHAPE_TYPES ................................................................................................321
3.5 enum INS_DRAWING_MODES..........................................................................................321
3.6 enum GGE_PLOT_ITEMS ..................................................................................................321
3.7 enum INS_HANDLES .........................................................................................................321
3.8 enum INS_SHAPE_BEHAVIOR .........................................................................................324
3.9 enum INS_DRAGGING_MODES........................................................................................324
4. SAMPLE PROGRAMS...............................................................................................................325
xxiii
2.1.2.6 Drawing........................................................................................................................349
EOCR::DrawChar.........................................................................................................................349
EOCR::DrawChars.......................................................................................................................349
3. ENUMERATION CONSTANTS..................................................................................................350
3.1 enum OCRClasses .............................................................................................................350
3.2 enum OCRColor .................................................................................................................350
3.3 enum OCRSegmentationMode .........................................................................................351
3.4 enum OCR_MATCHING_MODES ......................................................................................351
3.5 enum OCR_SHIFTING_MODES.........................................................................................351
4. SAMPLE PROGRAMS...............................................................................................................352
xxiv
Table Of Contents
EASYFIND .............................................................................................353
1. EASYFIND INTRODUCTION .....................................................................................................355
2. CLASSES...................................................................................................................................356
2.1 EasyFind: Introduction to Classes ...................................................................................356
2.2 PatternFinder......................................................................................................................356
2.2.1 PatternFinder Overview .....................................................................................................356
2.2.2 PatternFinder Properties....................................................................................................356
2.2.2.1 Learning properties......................................................................................................356
PatternFinder::ForcedThreshold property ....................................................................................356
PatternFinder::LightBalance property ..........................................................................................357
PatternFinder::PatternType property............................................................................................357
PatternFinder::Pivot property .......................................................................................................357
PatternFinder::ThinStructureMode property.................................................................................357
PatternFinder::TransitionThickness property ...............................................................................357
2.3 FoundPattern......................................................................................................................363
2.3.1 FoundPattern Overview .....................................................................................................363
2.3.2 FoundPattern Properties....................................................................................................363
FoundPattern::Angle property ......................................................................................................363
FoundPattern::Center property ....................................................................................................363
FoundPattern::Scale property ......................................................................................................363
FoundPattern::Score property......................................................................................................363
xxv
FoundPattern::Draw .....................................................................................................................364
FoundPattern::Draw .....................................................................................................................364
3. ENUMERATION CONSTANTS..................................................................................................365
3.1 enum Contrast::Type .........................................................................................................365
3.2 enum PatternType::Type ...................................................................................................365
3.3 enum ThinStructureMode::Type .......................................................................................365
4. SAMPLE PROGRAMS...............................................................................................................366
xxvi
Table Of Contents
EMatch::GetIsotropicScale...........................................................................................................382
EMatch::GetAngleStep.................................................................................................................382
EMatch::GetScaleStep.................................................................................................................382
EMatch::GetScaleX/YStep ...........................................................................................................383
EMatch::SetExtension..................................................................................................................383
xxvii
EOCV::m_TemplateImage ...........................................................................................................407
2.1.2.16 Inspection.....................................................................................................................422
EOCV::Inspect .............................................................................................................................422
EOCV::GetDiagnostics.................................................................................................................423
2.1.2.17 Statistics.......................................................................................................................423
EOCV::ClearStatistics ..................................................................................................................423
EOCV::UpdateStatistics ...............................................................................................................423
EOCV::GetStatisticsCount ...........................................................................................................423
EOCV::AdjustTextsLocationRanges ............................................................................................424
EOCV::AdjustCharsLocationRanges ...........................................................................................424
EOCV::AdjustTextsQualityRanges...............................................................................................425
EOCV::AdjustCharsQualityRanges..............................................................................................425
xxviii
Table Of Contents
EOCV::AdjustShiftTolerances ......................................................................................................426
2.2 EOCVChar...........................................................................................................................426
2.2.1 EOCVChar Overview .........................................................................................................426
2.2.2 EOCVChar Class Members ...............................................................................................426
EOCVChar::ResetParameters .....................................................................................................426
EOCVChar: Character location parameters.................................................................................426
EOCVChar: Character position parameters.................................................................................427
EOCVChar: Character inspection parameters .............................................................................427
3. ENUMERATION CONSTANTS..................................................................................................434
3.1 enum OCV_CHAR_CREATION_MODES...........................................................................434
3.2 enum OCV_QUALITY_INDICATORS.................................................................................434
3.3 enum OCV_DIAGNOSTICS................................................................................................434
3.4 enum OCV_LOCATION_MODE .........................................................................................434
4. SAMPLE PROGRAMS...............................................................................................................435
xxix
EChecker::GetLightGray ..............................................................................................................442
2.1.2.8 Drawing........................................................................................................................444
EChecker::Draw ...........................................................................................................................444
3. ENUMERATION CONSTANTS..................................................................................................447
3.1 enum ROI_HIT ....................................................................................................................447
3.2 enum OCV_DEGREES_OF_FREEDOM ............................................................................447
3.3 enum OCV_NORMALIZATION_MODE ..............................................................................447
3.4 enum OCV_LEARNING_MODE .........................................................................................447
3.5 enum OCV_DRAWING_MODE ..........................................................................................447
4. SAMPLE PROGRAMS...............................................................................................................448
2.2.2 Reading..............................................................................................................................452
EBarCode::Detect ........................................................................................................................452
EBarCode::Decode ......................................................................................................................453
EBarCode::Read ..........................................................................................................................453
EBarCode::GetNumEnabledSymbologies ...................................................................................453
xxx
Table Of Contents
EBarCode::GetNumDecodedSymbologies ..................................................................................453
EBarCode::GetDecodedSymbology.............................................................................................454
EBarCode::GetDecodedDirection ................................................................................................454
EBarCode::GetDecodedAngle .....................................................................................................454
EBarCode::GetDecodedRectangle ..............................................................................................455
3. ENUMERATION CONSTANTS..................................................................................................461
3.1 enum BRC_SYMBOLOGIES ..............................................................................................461
4. SAMPLE PROGRAMS...............................................................................................................462
xxxi
3.3 SearchParamsType............................................................................................................474
3.3.1 SearchParamsType Overview ...........................................................................................474
3.3.2 SearchParamsType Properties..........................................................................................474
SearchParamsType::LogicalSize property...................................................................................474
SearchParamsType::Family property...........................................................................................474
SearchParamsType::Contrast property........................................................................................474
SearchParamsType::Flipping property.........................................................................................474
4. ENUMERATION CONSTANTS..................................................................................................481
4.1 enum LearnParams::Type .................................................................................................481
4.2 enum LogicalSize::Type ....................................................................................................481
4.3 enum Contrast::Type .........................................................................................................481
4.4 enum Flipping::Type..........................................................................................................482
4.5 enum Family::Type ............................................................................................................482
xxxii
Table Of Contents
2.1.2.3 Inspection.....................................................................................................................487
EBGA::Inspect..............................................................................................................................487
EBGA::Get/Set BallDiameterTolerance .......................................................................................487
EBGA::Get/Set BallCircularityTolerance ......................................................................................488
EBGA::GetBallOffset X/Y Tolerance ............................................................................................488
EBGA::SetBallOffsetTolerance ....................................................................................................488
EBGA::GetBallPitch X/Y Tolerance..............................................................................................488
EBGA::SetBallPitchTolerance......................................................................................................489
EBGA::Get/Set BallDoughnutnessTolerance...............................................................................489
EBGA::Get/Set BallQualityFactorTolerance.................................................................................489
EBGA::Get/Set WhiteOnBlack .....................................................................................................490
EBGA::Get/Set BlobThreshold.....................................................................................................490
EBGA::Get/Set MaxBlobArea ......................................................................................................491
EBGA::Get/Set MinBlobArea .......................................................................................................491
EBGA::Get/Set SingulatedComponents.......................................................................................491
EBGA::Get/Set MaxMissingBalls .................................................................................................491
EBGA::Get/Set OuterRoiDiameter ...............................................................................................492
EBGA::Get/Set InnerRoiDiameter................................................................................................492
EBGA::Get/SetPackCloseBlobs...................................................................................................492
EBGA::Get/Set MeasureAssessment ..........................................................................................493
EBGA::Get/Set CircularityAssessment ........................................................................................494
EBGA::Get/Set FineBallMeasure .................................................................................................494
EBGA::Get/Set FineCircularity .....................................................................................................495
xxxiii
EBGA::GetMinimumPitch.............................................................................................................498
EBGA::GetMaximumPitch............................................................................................................498
EBGA::GetAveragePitch ..............................................................................................................499
EBGA::GetDeviationPitch ............................................................................................................499
EBGA::GetMinimumDiameter ......................................................................................................499
EBGA::GetMaximumDiameter .....................................................................................................499
EBGA::GetAverageDiameter .......................................................................................................500
EBGA::GetDeviationDiameter......................................................................................................500
EBGA::GetMinimumCircularity.....................................................................................................500
EBGA::GetMaximumCircularity....................................................................................................500
EBGA::GetAverageCircularity ......................................................................................................500
EBGA::GetDeviationCircularity ....................................................................................................501
EBGA::GetMinimumDoughnutness..............................................................................................501
EBGA::GetMaximumDoughnutness.............................................................................................501
EBGA::GetAverageDoughnutness...............................................................................................501
EBGA::GetDeviationDoughnutness .............................................................................................502
EBGA::GetMinimumQualityFactor ...............................................................................................502
EBGA::GetMaximumQualityFactor ..............................................................................................502
EBGA::GetAverageQualityFactor.................................................................................................502
EBGA::GetDeviationQualityFactor ...............................................................................................502
EBGA::ClearBatchStatistics .........................................................................................................503
EBGA::DrawPackages .................................................................................................................503
EBGA::DrawClutter ......................................................................................................................503
EBGA::DrawExtraBalls.................................................................................................................503
xxxiv
Table Of Contents
EBGA::GetComponent.................................................................................................................511
EBGA::GetComponentPitch X/Y ..................................................................................................511
EBGA::SetComponentPitches .....................................................................................................512
EBGA::GetRegularPlacement......................................................................................................512
EBGA::SetNumComponents........................................................................................................512
EBGA::SetCurrentComponent .....................................................................................................512
EBGA::GetCurrentComponent.....................................................................................................512
EBGA::SetComponentCenter ......................................................................................................513
2.1.2.6 Auto-calibration............................................................................................................513
EBGA::Get/Set AutoCalibrateBalls ..............................................................................................513
EBGA::Get/Set AutoCalibrateWorld.............................................................................................513
2.2.2.3 Statistics.......................................................................................................................516
EBGABall::GetNumBatchSamples...............................................................................................516
EBGABall::GetMinimumOffset .....................................................................................................516
EBGABall::GetMaximumOffset ....................................................................................................516
EBGABall::GetAverageOffset ......................................................................................................516
EBGABall::GetDeviationOffset.....................................................................................................516
EBGABall::GetMinimumPitch.......................................................................................................517
EBGABall::GetMaximumPitch......................................................................................................517
EBGABall::GetAveragePitch ........................................................................................................517
EBGABall::GetDeviationPitch ......................................................................................................517
EBGABall::GetMinimumDiameter ................................................................................................517
EBGABall::GetMaximumDiameter ...............................................................................................517
EBGABall::GetAverageDiameter .................................................................................................517
EBGABall::GetDeviationDiameter................................................................................................517
EBGABall::GetMinimumCircularity...............................................................................................518
EBGABall::GetMaximumCircularity..............................................................................................518
EBGABall::GetAverageCircularity ................................................................................................518
EBGABall::GetDeviationCircularity ..............................................................................................518
EBGABall::GetMinimumDoughnutness........................................................................................518
EBGABall::GetMaximumDoughnutness.......................................................................................518
EBGABall::GetAverageDoughnutness.........................................................................................518
EBGABall::GetDeviationDoughnutness .......................................................................................518
EBGABall::GetMinimumQualityFactor .........................................................................................519
EBGABall::GetMaximumQualityFactor ........................................................................................519
EBGABall::GetAverageQualityFactor...........................................................................................519
EBGABall::GetDeviationQualityFactor .........................................................................................519
xxxv
EBGABall::GetBallColIndex .........................................................................................................520
2.4 EBGAComponent...............................................................................................................522
2.4.1 EBGAComponent Overview ..............................................................................................522
2.4.2 EBGAComponent Class Members ....................................................................................523
2.4.2.1 Component model .......................................................................................................523
EBGAComponent::GetNumBalls .................................................................................................523
EBGAComponent::SetCenter ......................................................................................................523
2.4.2.3 Statistics.......................................................................................................................524
EBGAComponent::GetMinimumOffset.........................................................................................524
EBGAComponent::GetMaximumOffset........................................................................................524
EBGAComponent::GetAverageOffset..........................................................................................524
EBGAComponent::GetDeviationOffset ........................................................................................524
EBGAComponent::GetMinimumPitch ..........................................................................................524
EBGAComponent::GetMaximumPitch .........................................................................................524
EBGAComponent::GetAveragePitch ...........................................................................................524
EBGAComponent::GetDeviationPitch..........................................................................................524
EBGAComponent::GetMinimumDiameter....................................................................................525
EBGAComponent::GetMaximumDiameter...................................................................................525
EBGAComponent::GetAverageDiameter.....................................................................................525
EBGAComponent::GetDeviationDiameter ...................................................................................525
EBGAComponent::GetMinimumCircularity ..................................................................................525
EBGAComponent::GetMaximumCircularity .................................................................................525
EBGAComponent::GetAverageCircularity ...................................................................................525
EBGAComponent::GetDeviationCircularity..................................................................................525
EBGAComponent::GetMinimumDoughnutness ...........................................................................525
EBGAComponent::GetMaximumDoughnutness ..........................................................................526
EBGAComponent::GetAverageDoughnutness ............................................................................526
EBGAComponent::GetDeviationDoughnutness...........................................................................526
EBGAComponent::GetMinimumQualityFactor.............................................................................526
EBGAComponent::GetMaximumQualityFactor............................................................................526
EBGAComponent::GetAverageQualityFactor ..............................................................................526
EBGAComponent::GetDeviationQualityFactor ............................................................................526
3. ENUMERATION CONSTANTS..................................................................................................527
3.1 enum BGA_DIAGNOSTICS................................................................................................527
3.2 enum BGA_QUALITY_INDICATORS ................................................................................527
3.3 enum BGA_SYMMETRY ....................................................................................................527
3.4 enum INS_DRAWING_MODES..........................................................................................527
3.5 enum BGA_MEASURE_ASSESSMENT ............................................................................528
3.6 enum BGA_CIRCULARITY_ASSESSMENT......................................................................528
xxxvi
Table Of Contents
4. SAMPLE PROGRAMS...............................................................................................................529
xxxvii
EWorldShape::Draw.....................................................................................................................548
EWorldShape::DrawGrid..............................................................................................................548
EWorldShape::DrawCrossGrid ....................................................................................................548
EWorldShape::SetZoom ..............................................................................................................549
EWorldShape::SetPan .................................................................................................................549
EWorldShape::GetZoom X/Y .......................................................................................................549
EWorldShape::GetPan X/Y ..........................................................................................................549
3. ENUMERATION CONSTANTS..................................................................................................550
3.1 enum INS_CALIBRATION_MODES...................................................................................550
4. SAMPLE PROGRAM .................................................................................................................551
7.5 Surface................................................................................................................................563
7.5.1 Surface Overview...............................................................................................................563
7.5.2 Surface Methods................................................................................................................564
Surface constructor ......................................................................................................................564
Surface::Free ...............................................................................................................................564
Surface::Reserve .........................................................................................................................564
xxxviii
Table Of Contents
7.7 SignalInfo............................................................................................................................566
7.7.1 SignalInfo Overview ...........................................................................................................566
7.7.2 SignalInfo Properties..........................................................................................................567
SignalInfo::Signal property ...........................................................................................................567
SignalInfo::Surf property ..............................................................................................................567
7.8 Exception............................................................................................................................567
7.8.1 Exception Overview ...........................................................................................................567
7.8.2 Exception Method ..............................................................................................................567
Exception::What ...........................................................................................................................567
8. FUNCTIONS...............................................................................................................................568
CreateImage... .............................................................................................................................568
CreateSurface ..............................................................................................................................568
UpdateImageConfig .....................................................................................................................568
GLOSSARY............................................................................................571
APPENDIX.............................................................................................579
INDEX ...................................................................................................613
xxxix
EasyFind
is a library aimed at rapidly locating patterns in an image down to the sub-pixel precision. In a onesentence definition: EasyFind finds instances similar to a model in a search field and reports
information about these instances.
EasyFind is robust against noise, occlusion, blurring and illumination variations.
EasyMatch
locates patterns or image templates (previously shown to the system) arbitrarily positioned in an
image. It can be used for instance for image registration or component placement inspection.
EasyOCV
is a mark inspection tool. It is able to check the printing quality of labels against a good quality
template. Defects such as low contrast, misalignment, scratches or incorrect marking can be reliably
detected. Two complementary tools are available: EOCV models the marking as a set of independent
shapes; EChecker, on the other hand, inspects globally and is based on image comparison.
EChecker
is an inspection tool based on image comparison, i.e. finding visible differences between
representative samples (parts free of defects), and the sample to be inspected.
EasyBarCode
is a library dedicated to the reading of barcodes. By contrast with printed characters, barcodes are
machine-readable only. They are generally used to ensure traceability of goods.
EasyMatrixCode
is a library dedicated to the reading of Data Matrix.
EasyBGA
is a 2D BGA inspection package. This means that it allows checking one ore several BGA devices at a
time by means of a top view. Characteristics such as ball diameters, positions, pitches and circularities
can be measured and controlled. Diagnostics are reported when any of these quantities fall outside of
predefined ranges.
EWorldShape
manages a field of view calibration context. Such an object is able to represent the relationship
between World (physical units) and Sensor (pixels) coordinates and account for the distortions inherent
in the image formation process. Calibration can be setup by providing explicit calibration parameters of
the calibration model, or by identifying those parameters by means of a set of known points
(landmarks), or by means of a calibration target.
EasyMultiCam
provides tools to acquire images with Euresys Frame-Grabbers. EasyMultiCam classes offer a full
control of the image acquisition process. A set of functions provide a seamless integration with eVision
EImage... objects.
The eVision libraries were designed as a set of C++ classes, along with a few member functions to
access their internal data, and a set of global functions. A library is simply incorporated in a C++
program by including the corresponding header file (.h) and linking to the import library file (.lib).
The EasyAccess interactive prototyping tool (which is also a code generator) can help you write the
function calls you need.
Sample programs are also provided with each eVision library, their purpose is twofold:
- illustrate the use of eVision classes, class members and functions;
- show basic C++ techniques that can be used when developing interactive applications.
Note. The eVision libraries use several features specific of the C++ language. The classes play a
fundamental role. The class member functions handle all the operations dealing with a single object.
When several objects are involved, a global function is usually preferred.
Functions can be overloaded, which means that they can appear with several prototypes. Default
arguments are also used on occasions (the default arguments may be omitted from the function call;
the default value that is supplied instead appears in the function prototype). End of note.
1.
EASY: INTRODUCTION
The Easy library gathers general-purpose features that can be used in any of the other application
libraries. It includes functions dealing with:
File Access: reading and writing images from/to disk files.
Error Processing: automatically displaying error messages in case of faulty conditions.
Display: displaying an image within a Windows window.
The following C++ objects play an important role:
in several flavors, deriving one from the other. See Image types for more information.
EROIBW1: region of interest mapped on a black and white image (EImageBW1).
EImageBW1: black and white images (1 bit per pixel, 2 levels).
EROIBW8: region of interest mapped on a gray level image (EImageBW8).
EImageBW8: gray-level images (8 bits per pixel, 256 levels).
EROIBW16: region of interest mapped on a gray level image (EImageBW16).
EImageBW16: gray-level images (16 bits per pixel, 65536 levels).
EROIC24: region of interest mapped on a color image (EImageC24).
EImageC24: true color images (3 x 8 RGB bits per pixel). See EasyColor for more information about color
processing.
EROIC24A: region of interest mapped on a color image (EImageC24A).
EImageC24A: RGB32 images (3 x 8 RGB plus alpha channel). See EasyColor for more information about
color processing.
EROIC15: region of interest mapped on a color image (EImageC15).
EImageC15: RGB15 images (3 x 5 RGB bits per pixel). See EasyColor for more information about color
processing.
EROIC16: region of interest mapped on a color image (EImageC16).
EImageC16: RGB16 images (5-6-5 RGB bits packing). See EasyColor for more information about color
processing.
E...Vector: the vector classes are used to represent one-dimensional data such as profiles, histograms,
projections, ... Most of the time, these appear as the result of some processing on an image. Each class
has a specific use. They are collectively known as the EVectorTemplate class. See Vector types for more
information.
The classes EMeasurementUnit and EDimensionalValue are auxiliary objects used to represent numeric
values accompanied by a measurement unit.
Declare using
#include "Easy.h"
The class EImageSequence is an auxiliary object used to handle AVI image sequence files.
Declare using
#include "EAVI.h"
1.1
Image types
Images are the main objects you will be dealing with. The image classes encapsulate all the functionality
needed to represent rectangular shaped images. An image is characterized by a few parameters. Its width
and height indicate the total number of pixel rows and columns. Its depth tells how many bits are used to
encode the value of each pixel. The number of planes indicates how many spectral components are
considered. For gray level images, this number is always one.
Note. The pixel values are always treated as unsigned (non-negative) numbers. End of note.
Usually, you will work on 8-bit gray-level images, so that the most relevant classes are EImageBW8 and
EROIBW8.
In order to create a new 8-bit gray-level image, say of width 640 and height 480, use one of the following
constructs:
EImageBW8 MyImage(640, 480);
...
// Static allocation
or:
EImageBW8* pMyImage= new EImageBW8(640, 480); // Dynamic allocation
...
delete pMyImage;
// Release after use
When using these constructs, you implicitly invoke the object constructor (EImageBW8) to create it, and
destructor (~EImageBW8) to get rid of it. These handle the necessary memory allocation and deallocation operations.
An image object has an associated data area, accessible via a pointer, where the pixel values are stored
contiguously, row by row. You normally need not access those values directly. See the class member
GetImagePtr.
Additional information can be associated to with an image, such as a title, a creation date, an author name
and a comment, as well as the true size of the pixels (horizontal and vertical). See the class members
SetAuthor, SetComment, SetDate, SetTitle, SetPixelDimensions and SetResolution.
A region of interest of an image (ROI) is a rectangular zone within the image, defined by an origin point
(upper left corner), a width and a height. The position of the origin point is specified with respect to the
parent image.
The nice feature of ROIs is that they can be used anywhere and passed to processing functions as if they
were full images.
An image may be associated with an arbitrary number of ROIs, which can be nested in a hierarchical way.
To create a region of interest, you just specify its placement and the image to which it belongs:
EROIBW8 MyROI(&MyImage, 100, 200, 128, 64);
EROIBW8 MySubROI(&MyROI, 10, 10, 64, 64);
The image classes provide several member functions to traverse the hierarchy of ROIs associated with an
image. See the ROI management class members.
1.2
Vector types
A vector is a one-dimensional array of elements. Each element is defined as either a scalar value or a
structure with a few members. Each vector class has a specific purpose, as follows:
EBW8Vector: sequence of gray-level pixel values, often extracted from an image profile (used by ImgLut,
ImgSetupEqualize, ImgImageToLineSegment, ImgLineSegmentToImage, ImgProfileDerivative, ...). Each
element has type EBW8.
10
11
Example
// Create a vector of three BW8 elements
EBW8Vector Profile(3);
// Set the elements
Profile[0]= 10;
Profile[1]= 20;
Profile[2]= 30;
// Add a fourth element
Profile.AddElement(40);
// Remove all elements
Profile.Empty();
1.3
The following data types are used throughout the eVision libraries and are defined using typedefs:
BOOL
boolean.
CHAR
character.
INT8
signed integer, 8 bits.
INT16
signed integer, 16 bits.
INT32
signed integer, 32 bits.
UINT8
unsigned integer, 8 bits.
UINT16
unsigned integer, 16 bits.
UINT32
unsigned integer, 32 bits.
FLOAT32
single precision floating-point, 32 bits.
FLOAT64
double precision floating-point, 64 bits.
1.4
The following image pixel types are used throughout the eVision libraries and are defined as C++
structures.
Integral type suitable for
implicit conversion (*)
Name
Structure
Description
EBW1
UINT32
EBW8
UINT8
EBW16
UINT16
EBW32
UINT32
12
EC24
EC24A
EC15
EC16
(*) In eVision versions before 6.5, the image pixel types were defined using typedefs of integral types.
Note. Implicit conversion to- and from- the previous integral pixel types is provided, so that the transition
should be seamless. In case you are using pointers to integral pixel types, you can safely cast the newly
provided pointer to the structure(s) to a pointer to the integral type. For example:
EImageBW8 image;
...
UINT8* ptr = image.GetImagePtr( );
...
The above code did compile previously, but does not compile anymore. You can safely cast the result of
GetImagePtr( ) if you need to retrieve the integral type pointer (the structures have the same binary layout
than the previous integral types):
EImageBW8 image;
...
UINT8* ptr = reinterpret_cast<UINT8*>(image.GetImagePtr( ));
...
An alternative to casting could be to always work with the actual pixel types, instead of working with the
integral types:
EImageBW8 image;
...
EBW8* ptr = image.GetImagePtr( );
...
Of course this latter option might require significant changes in the code. End of note.
13
1.5
The following vector element types are used throughout the eVision libraries and are defined as C++
structures.
Name
Structure
Description
EPath
EBW8Path
EBW16Path
EC24Path
EPeak
14
2.
2.1
2.1.1
The following major features of the eVision images are common to all image/ROI classes above.
Graphical Interaction to draw the images, regions of interest and other objects on the screen and to
graphically interact with the ROIs.
Persistent storage to load or save images or ROIs from/to the disk.
Coordinates to size and position the images and regions of interest with respect to each other or to the
topmost parent image.
ROIs Hierarchy to control the parent/daughter relationships of the images and their regions of interest.
Data Access to directly access the pixels of an image.
Character Strings to accompany images with textual information.
Typing and Type Compatibility enable you to check that an image is appropriate for a given operation.
Pixel Dimensions and Resolution to associate physical dimensions to the pixels.
Declare using
#include "Easy.h"
2.1.2
Class Members
2.1.2.1
Copying
EImage/ROI...::CopyTo
EImage* EImage::CopyTo(EImage* pImage, BOOL bRecursive) const;
EROI* EROI::CopyTo(EROI* pROI, BOOL bRecursive) const;
Copies all the parameters of the current EImage [EROI] object into another EImage [EROI]
object and returns it.
Parameters
pImage/pROI
bRecursive
15
Example
EImageBW8 Image1, Image2;
// Copy Image1 into Image2
Image1.CopyTo(&Image2);
Remarks
1. In case of a NULL pointer, a new EImage [EROI] object will be created and returned.
2. When the buffer of the source image is provided by a SetImagePtr, the pointer will be copied into
the destination image.
EImage/ROI...::Operator=
EImage& EImage::operator=(const EImage& Image);
EROI& EROI::operator=(const EROI& ROI);
Copies all the parameters of the current EImage [EROI] object into another EImage [EROI]
object.
The ROI children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
Image/ROI
Example
EImageBW8 Image1, Image2;
// Copy Image1 into Image2
Image2=Image1;
Remarks
The EImage and EROI objects are always included in a hierarchy of similar objects.
In this hierarchy, an object owns:
siblings: objects at the same level than the object to be copied (siblings have the same direct
parent).
The object newly copied by the assignment operator has the following properties:
2.1.2.2
Graphical interaction
EImage/ROI...::Draw
void Draw(HDC hDC, FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f);
16
f32ZoomX
f32ZoomY
Remarks
An image can be drawn (its pixels rendered) using a device context. The same applies to a region of
interest. In the latter case, only the ROI contents is drawn, starting at the upper left corner of the
window.
Zooming by arbitrary factors (in the range 1/16..16), possibly different horizontally and vertically, is
possible.
Additional lookup-table translation capabilities are available for the display of gray-level images. See
EImageBW8::Draw and EROIBW8::Draw.
EROI...::DrawFrame
void DrawFrame(HDC hDC, E_FRAME_POSITION eFramePosition= E_FRAME_ON, BOOL bHandles=
FALSE, FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32 f32PanX= 0.f, FLOAT32
f32PanY= 0.f);
bHandles
f32ZoomX
f32ZoomY
f32PanX
f32PanY
handle to the device context of the destination window. (Use the MFC call
CDC::GetSafeHdc( ) to obtain it from the device context).
specifies how the frame should be drawn with respect to its edges, as
defined by enum E_FRAME_POSITION. This is only relevant for thick
pens.
TRUE if handles are to be drawn.
magnification factor for zooming in or out in the horizontal direction. By
default, the image is displayed in true scale.
magnification factor for zooming in or out in the vertical direction. Setting a
0 value (which is the default) will result in isotropic scaling (i.e. equal
horizontal and vertical factors).
translation factor for panning in the horizontal direction.
translation factor for panning in the vertical direction.
Remarks
A frame can be drawn (using a device context) around an image or region of interest, possibly with
nine sizing handles. The current pen and brush attributes are used. Zooming and panning are possible.
Panning is applied before zooming. By default, the frame is displayed from the upper left corner of the
window.
EROI...::HitTest
enum E_HANDLES HitTest(INT32 n32X, INT32 n32Y, FLOAT32 f32ZoomX= 1.f, FLOAT32
f32ZoomY= 0.f, FLOAT32 f32PanX= 0.f, FLOAT32 f32PanY= 0.f);
17
Parameters
n32X, n32Y
f32ZoomX
f32ZoomY
f32PanX
f32PanY
Remarks
If zooming and/or panning were used when drawing the ROI, the same values must be used with
HitTest and Drag.
EROI...::Drag
void Drag(enum E_HANDLES eHandle, INT32 n32X, INT32 n32Y, FLOAT32 f32ZoomX= 1.f,
FLOAT32 f32ZoomY= 0.f, FLOAT32 f32PanX= 0.f, FLOAT32 f32PanY= 0.f);
Moves the specified handle to a new position and updates all placement parameters of the ROI.
Parameters
eHandle
n32X, n32Y
f32ZoomX
f32ZoomY
f32PanX
f32PanY
Remarks
If zooming and/or panning were used when drawing the ROI, the same values must be used with
HitTest and Drag.
2.1.2.3
Persistent storage
EImage/ROI...::Load
enum IMAGE_FILE_TYPES EImage/ROI...::Load(const char* pszPathName);
Restores an image stored in the given file by a previous EImage/ROI...::Save call, and returns the
corresponding file format, as defined by enum IMAGE_FILE_TYPES.
Parameters
pszPathName
Remarks
When loading, an image is resized if need be. On the opposite, a region of interest cannot be resized,
and the sizes must match. The image contents around the region of interest remains unchanged.
16 bit gray-level images can only be saved to/loaded from a file in the TIFF format (.tif extension).
18
15 and 16 bit packed color images can only be saved to/loaded from a file in the BMP format (.bmp
extension). Note, however, that this file format is not supported by Windows (!) and can only be used
with eVision.
When loading an EImage/ROI... from a TIFF file, text properties Author, Comment, Date and Title are
respectively loaded from TIFF tags "Artist", "ImageDescription", "DateTime" and "DocumentName".
void EImage/ROI...::Load(FILE* file);
Remarks
This method allows to read several eVision objects from the same file by passing the same FILE
pointer to several Load(FILE* file) calls. Moreover, this file can also contained any kind of
information saved with fwrite (and thus retrieved by a fread call) between the eVision objects.
An error code will be set if the data in the file does not represent a well-formed EImage/ROI... object.
The FILE pointer given as argument must have been previously initialized with a proper call to fopen.
It is of a greater importance to note that data are read at the current file pointer position.
It is up to users to correctly manage their files to be able to retrieve their eVision objects. Results
obtained by trying to restore an object of the wrong type are undefined.
To circumvent this problem, it is advised to use the ESerializer version of the Load method.
void EImage/ROI...::Load(ESerializer* serializer);
This method behaves identically to the EImage/ROI...::Load(FILE* file) method, but accepts a file-like
ESerializer object instead of a regular file.
Parameters
serializer
ESerializer object.
Example
// Create an ESerializer object for reading
ESerializer *pSerializer = ESerializer::CreateFileReader("test.img");
// Load the EImage object from the file
m_pImage.Load( pSerializer);
Remarks
This method allows to read several eVision objects from the same file by passing the same ESerializer
object to several Load(ESerializer* serializer) calls. Moreover, this file can also contained
any kind of information saved with fwrite (and thus retrieved by a fread call) between the eVision
objects.
The ESerializer object given as argument must have been previously created with a call to
ESerializer::CreateFileReader.
The serialization object contains a hidden pointer to the current position in the archive. This pointer
represents the position where the next Load operation will take place. Moreover, each Load operation
also moves the pointer at the end of the just read object (corresponding to the beginning of the next
object or to the end of the file).
It is the user responsibility to use the Load method of the right object. To get information about the
type of the next object in the file, the ESerializer::GetNextObjectType method could be used.
19
EImage/ROI...::Save
void EImage/ROI...::Save(const char* pszPathName, enum IMAGE_FILE_TYPES eFormat =
E_FILE_FORMAT_AUTO);
Serializes (saves) the image or ROI to the given file, using a specified format.
By default (if no format is specified), the file format is determined from the file extension. The latter
must be one of '.bmp", ".tif" or ".jpg".
Parameters
pszPathName
eFormat
Remarks
An image can be saved to a file using a standard format (see enum IMAGE_FILE_TYPES), and then
loaded back. The same applies to a region of interest of an image. The file extension is arbitrary and is
not related to the file format.
16 bit gray-level images can only be saved to/loaded from a file in the TIFF format (.tif extension).
15 and 16 bit packed color images can only be saved to/loaded from a file in the BMP format (.bmp
extension). Note, however, that this file format is not supported by Windows (!) and can only be used
with eVision.
When saving an EImage/ROI... to a TIFF file, text properties Author, Comment, Date and Title are
respectively saved to TIFF tags "Artist", "ImageDescription", "DateTime" and "DocumentName".
void EImage/ROI...::Save(FILE* file);
Serializes (saves) the image or ROI to an already opened file, at the current file pointer position.
Parameters
file
Remarks
This method allows to store several eVision objects in the same file by passing the same FILE pointer
to several Save(FILE* file) calls. Moreover, this file can also contained any kind of information
saved with fwrite (and thus retrieved by a fread call) between the eVision objects.
The FILE pointer given as argument must have been previously initialized with a proper call to fopen.
Data are saved at the current file pointer position. At the end of the writing, the file pointer is moved by
the EImage/ROI... object size.
It is the user responsibility to know the exact structure of the used files.
To circumvent this problem, it is advised to use the ESerializer version of the Save method.
void EImage/ROI...:::Save(ESerializer* serializer);
This method behaves identically to the EImage/ROI...::Save(FILE* file) method, but accepts a file-like
ESerializer object instead of a regular file.
Parameters
serializer
ESerializer object.
Example
// Create an ESerializer object for writing (with the default creation mode)
ESerializer *pSerializer = ESerializer::CreateFileWriter("test.img");
20
Remarks
This method allows to store several eVision objects in the same file by passing the same ESerializer
object to several Save(ESerializer* serializer) calls.
The ESerializer object given as argument must have been previously created with a call to
ESerializer::CreateFileWriter.
The serialization object contains a hidden pointer to the current position in the archive. This pointer
represents the position where the next Save operation will take place. Moreover, each Save operation
also moves the pointer at the end of the just written object (the end of the file).
2.1.2.4
Coordinates
EImage/ROI...::SetSize
void SetSize(INT32 n32Width, INT32 n32Height);
void SetSize(EImage/ROI...* pImage);
Sets the width and height of an image or a ROI from given values or from an other Image/ROI.
Parameters
n32Width
n32Height
pImage
new width.
new height.
image/ROI pointer from which the width and height are issued.
Remarks
The size of an image is specified as a number of columns (Width) and rows (Height). There is no
restriction on the width and height an image can have, as long as it can fit in memory (maximum 232
bytes of memory space).
The placement of an ROI is given by the abscissa and ordinate of its upper left corner with respect to
its parent image (not its topmost parent image), its width and its height.
EROI...::SetPlacement
void EROI::SetPlacement(INT32 n32OrgX, INT32 n32OrgY, INT32 n32Width, INT32
n32Height);
Remarks
The placement of an ROI is given by the abscissa and ordinate of its upper left corner (origin point)
with respect to its parent image (not to its topmost parent image), its width and its height.
This function can only be used on ROI classes.
21
EROI...::SetOrgX
void EROI...::SetOrgX(INT32 n32OrgX);
Sets the abscissa of the upper left corner of the ROI, with respect to its parent image/ROI.
Parameters
n32OrgX
Remarks
The placement of an ROI is given by the abscissa and ordinate of its upper left corner (origin point)
with respect to its parent image (not to its topmost parent image), its width and its height.
This function can only be used on ROI classes.
EROI...::SetOrgY
void EROI...::SetOrgY(INT32 n32OrgY);
Sets the ordinate of the upper left corner of the ROI, with respect to its parent image/ROI.
Parameters
n32OrgY
Remarks
The placement of an ROI is given by the abscissa and ordinate of its upper left corner (origin point)
with respect to its parent image (not to its topmost parent image), its width and its height.
This function can only be used on ROI classes.
EROI...::SetWidth
void EROI...::SetWidth(INT32 n32Width);
new width.
Remarks
The placement of an ROI is given by the abscissa and ordinate of its upper left corner (origin point)
with respect to its parent image (not to its topmost parent image), its width and its height.
This function can only be used on ROI classes.
EROI...::SetHeight
void EROI...::SetHeight(INT32 n32Height);
22
new height.
Remarks
The placement of an ROI is given by the abscissa and ordinate of its upper left corner (origin point)
with respect to its parent image (not to its topmost parent image), its width and its height.
This function can only be used on ROI classes.
EImage/ROI...::GetOrgX
INT32 GetOrgX( );
Returns the abscissa of the upper left corner of the image, with respect to its parent image/ROI.
Remarks
The size of an image is specified as a number of columns (Width) and rows (Height). Size limitations
for images are 232 bytes of memory space.
The placement of an ROI is given by the abscissa and ordinate of its upper left corner with respect to
its parent image (not its topmost parent image), its width and its height.
EImage/ROI...::GetOrgY
INT32 GetOrgY( );
Returns the ordinate of the upper left corner of the image, with respect to its parent image/ROI.
Remarks
The size of an image is specified as a number of columns (Width) and rows (Height). Size limitations
for images are 232 bytes of memory space
The placement of an ROI is given by the abscissa and ordinate of its upper left corner with respect to
its parent image (not its topmost parent image), its width and its height.
EImage/ROI...::GetWidth
INT32 GetWidth( );
23
EImage/ROI...::GetTotalOrgX
INT32 GetTotalOrgX( );
Returns the abscissa of the upper left corner of the image with respect to its topmost parent.
Remarks
The "total origin coordinates" indicate the position of the upper left corner of the current ROI with
respect to its topmost parent image. The total origin coordinates of a topmost parent are always (0,0).
EImage/ROI...::GetTotalOrgY
INT32 GetTotalOrgY( );
Returns the ordinate of the upper left corner of the image with respect to its topmost parent.
Remarks
The "total origin coordinates" indicate the position of the upper left corner of the current ROI with
respect to its topmost parent image. The total origin coordinates of a topmost parent are always (0,0).
EImage/ROI...::GetTotalWidth
INT32 GetTotalWidth( );
2.1.2.5
ROIs Hierarchy
EROI...::Attach
void Attach(EROI...* pParent);
Remarks
The ROI constructor also allows you to attach an ROI to a parent.
This function applies to plain ROIs, not images.
24
EROI...::Detach
void Detach( );
Returns a pointer to the next ROI within the same parent image/ROI, or NULL.
Remarks
The regions of interest tied to an image form a hierarchy of arbitrary depth, structured like a tree. The
root of the tree is called the topmost parent. Having several levels of nesting can be convenient,
because all the sub-ROIs of an ROI are rigidly fastened to it so that they move all together.
25
EImage/ROI...::GetNextROI
EGenericROI* GetNextROI(EImage/ROI... *pStartROI);
Returns a pointer to another ROI, or NULL. This function can be used to traverse all ROIs of an image.
Parameters
pStartROI
Example
pROI= pStartROI= ... <select a starting ROI>
while (pROI != NULL)
{
... <process the ROI>
pROI= pROI->GetNextROI(pStartROI);
}
Remarks
The regions of interest tied to an image form a hierarchy of arbitrary depth, structured like a tree. The
root of the tree is called the topmost parent. Having several levels of nesting can be convenient,
because all the sub-ROIs of an ROI are rigidly fastened to it so that they move all together.
2.1.2.6
Data Access
EImage/ROI...::Get/SetPixel
EBW8 GetPixel(INT32 n32X= 0, INT32 n32Y= 0);
EBW16 GetPixel(INT32 n32X= 0, INT32 n32Y= 0);
EC24 GetPixel(INT32 n32X= 0, INT32 n32Y= 0);
EC15 GetPixel(INT32 n32X= 0, INT32 n32Y= 0);
EC16 GetPixel(INT32 n32X= 0, INT32 n32Y= 0);
26
EImage/ROI...::GetImagePtr
Pixel* GetImagePtr(INT32 n32X= 0, INT32 n32Y= 0);
Sets the pointer to an externally allocated image buffer. This overrides the internally allocated image
buffer of the EImage. As long as the image accesses this buffer, it must not be deleted.
The overloaded function allows to specify the image size at the same time as the image data pointer,
thus combining the sequence of EImage::SetSize; EImage::SetImagePtr in a single operation.
After a call to SetImagePtr, GetImagePtr will return this value.
Parameters
n32Width
n32Height
pImagePtr
n32BitsPerRow
Remarks
An image has an associated pixel data area reached through a pointer. This pointer refers to the top
left pixel of the image. The next pixels are stored contiguously, row by row, from top to bottom and
from left to right. Padding at the end of a row may be used, but it must be a multiple of 4 bytes.
Example
The following example shows how to retrieve the information associated with an existing MultiCam
surface and call the SetImagePtr function so that the eVision image buffer points to the same buffer as
the MultiCam surface.
In this case, the n32BitsPerRow argument of the SetImagePtr function always needs to be set. The
default value 0 does not allow the eVision image to retrieve the pitch of the MultiCam surface.
27
2)
Note:
The value returned by the MultiCam function McGetParamInt for the surface Pitch is expressed in
bytes while the eVision image pitch is expressed in bits. This is why it needs to be multiplied by 8.
EImage/ROI...::GetColPitch
INT32 GetColPitch ();
Returns the pitch of an image/ROI column (number of bytes between two horizontally adjacent pixels).
EImage/ROI...::GetRowPitch
INT32 GetRowPitch();
Returns the pitch of an image/ROI row (number of bytes between two vertically adjacent pixels).
EImage/ROI...::Void
BOOL Void();
2.1.2.7
Character Strings
EImage/ROI...::Get/SetAuthor
CHAR* GetAuthor( );
Remarks
A few character strings can be associated to an image or an ROI. They are meant to receive a authors
name, an arbitrary comment, a date and a title. There is no limit on the length of those strings, which
must be null terminated. The strings are accessed through a pointer to the first character, which
remains NULL if no string has been defined.
28
To remove a character string associated to an Image/ROI..., simply reset its pointer to the NULL value.
All the ROIs of the same image can have different strings.
When saving / loading an EImage/ROI... to / from a TIFF file, this text string is associated to the "Artist"
TIFF tag.
EImage/ROI...::Get/SetComment
CHAR* GetComment( );
Remarks
A few character strings can be associated to an image or an ROI. They are meant to receive a authors
name, an arbitrary comment, a date and a title. There is no limit on the length of those strings, which
must be null terminated. The strings are accessed through a pointer to the first character, which
remains NULL if no string has been defined.
To remove a character string associated to an Image/ROI..., simply reset its pointer to the NULL value.
All the ROIs of the same image can have different strings.
When saving / loading an EImage/ROI... to / from a TIFF file, this text string is associated to the
"ImageDescription" TIFF tag.
EImage/ROI...::Get/SetDate
CHAR* GetDate( );
Remarks
A few character strings can be associated to an image or an ROI. They are meant to receive a authors
name, an arbitrary comment, a date and a title. There is no limit on the length of those strings, which
must be null terminated. The strings are accessed through a pointer to the first character, which
remains NULL if no string has been defined.
To remove a character string associated to an Image/ROI..., simply reset its pointer to the NULL value.
All the ROIs of the same image can have different strings.
When saving / loading an EImage/ROI... to / from a TIFF file, this text string is associated to the
"DateTime" TIFF tag.
For the sake of convenience, when member SetDate is passed an empty string ("", not NULL), it is
automatically filled with the current timestamp using the format YYYY:MM:DD HH:MM:SS (TIFF
standard format).
29
EImage/ROI...::Get/SetTitle
CHAR* GetTitle( );
Remarks
A few character strings can be associated to an image or an ROI. They are meant to receive a authors
name, an arbitrary comment, a date and a title. There is no limit on the length of those strings, which
must be null terminated. The strings are accessed through a pointer to the first character, which
remains NULL if no string has been defined.
To remove a character string associated to an Image/ROI..., simply reset its pointer to the NULL value.
All the ROIs of the same image can have different strings.
When saving / loading an EImage/ROI... to / from a TIFF file, this text string is associated to the
"DocumentName" TIFF tag.
2.1.2.8
EImage/ROI...::Get/SetColorSystem
void SetColorSystem( );
Sets a default color system compatible with this image (E_COLOR_SYSTEM_GRAY_SCALE for
EImageBW... types and E_COLOR_SYSTEM_RGB for EImageC... types)
void SetColorSystem(enum E_COLOR_SYSTEM eColorSystem);
Returns the color system used by this image, as defined by enum E_COLOR_SYSTEM
Remarks
The color system associated to an image is mainly relevant when working on color images. See
EasyColor for more information.
EImage/ROI...::GetType
enum E_IMAGE_TYPES GetType();
30
EImage/ROI...::IsAnROI
BOOL IsAnROI( );
Checks whether this image/ROI agrees in width and height with another one
Parameters
pImage
Remarks
If the image/ROI is not compatible, the last error code is set to
E_ERROR_IMAGES_NOT_SAME_SIZE, else it is set to E_OK.
To get error information, call EGetError or EGetErrorText.
EImage/ROI...::GetBitsPerPixel
INT32 GetBitsPerPixel( );
2.1.2.9
EImage/ROI...::Get/SetPixelDimensions
void GetPixelDimensions(FLOAT32& f32PixelWidth, FLOAT32& f32PixelHeight,
EMeasurementUnit* (&pUnitofLength));
Sets the width and height of the pixels, using dimensional values.
31
Parameters
f32PixelWidth
f32PixelHeight
pPixelUnitOfLenght
width value.
height value.
pointer to a measurement unit. By default, the dimensions remain pixels.
Remarks
The physical dimensions of the pixels (width and height) of an image are expressed as dimensional
units, typically in centimeters or inches. The physical resolution corresponds to the inverse of the
dimensions (horizontal and vertical pixels per unit of length) and is also expressed as dimensional
units, typically dots per centimeter or dots per inch (DPIs).
When an image is loaded from a file, the dimensions are read, provided they were correctly recorded.
When an image is saved to a file, the dimensions are written, provided the selected file format is able
to store this information.
EImage/ROI...::Get/SetResolution
VOID GetResolution(FLOAT32& f32HorizontalPixelsPerUnit, FLOAT32&
f32VerticalPixelsPerUnit, EMeasurementUnit* (&pUnitofLength));
Returns the horizontal and vertical resolution (pixels per unit of length), and measurement unit of
pixels.
Parameters
f32HorizontalPixelsPerUnit reference to the horizontal resolution value.
f32VerticalPixelsPerUnit
reference to the vertical resolution value.
pPixelUnitOfLength
reference to a pointer to the measurement unit.
VOID SetResolution(FLOAT32 f32HorizontalPixelsPerUnit, FLOAT32
f32VerticalPixelsPerUnit, EMeasurementUnit* pPixelUnitOfLength = &EUnitNone);
Sets the horizontal and vertical resolutions (pixels per unit of length), using dimensional values.
Parameters
f32HorizontalPixelsPerUnit horizontal resolution value.
f32VerticalPixelsPerUnit
vertical resolution value.
pPixelUnitOfLength
pointer to a measurement unit. By default, the dimensions remain pixels.
Remarks
The physical dimensions of the pixels (width and height) of an image are expressed as dimensional
units, typically in centimeters or inches. The physical resolution corresponds to the inverse of the
dimensions (horizontal and vertical pixels per unit of length) and is also expressed as dimensional
units, typically dots per centimeter or dots per inch (DPIs).
When an image is loaded from a file, the dimensions are read, provided they were correctly recorded.
When an image is saved to a file, the dimensions are written, provided the selected file format is able
to store this information.
The file formats in use represent the resolution information with the following limitations:
BMP: resolution in pixels per meter, stored as a 32 bit integer value;
JPEG: resolution in pixels per centimeters, inches or no unit, stored as a 16 bit integer value;
TIFF: resolution in pixels per centimeters, inches or no unit, stored as the quotient of two 32 bit integer
values.
When the image resolution unit is not supported by the file format, a conversion to a metric unit is
done.
32
2.2
2.2.1
EImageBW1 Overview
The EImageBW1 class is suited to handle the black and white images. The pixel values are coded on only
1 bit, leaving 2 possible levels.
Construction may imply image memory allocation/de-allocation.
Declare using
#include "Easy.h"
2.2.2
2.2.2.1
EImageBW1 Construction
Default Constructor
EImageBW1::EImageBW1();
Constructs an empty black and white 1-bit image context. All parameters are initialized to their
respective default values.
Example
// Create an EImageBW1 instance with all default values.
EImageBW1 Image1;
Remarks
A void EImageBW1 has no associated pixel data.
33
The size of the constructed EImageBW1 is not fixed. This has to be done by calling to the SetSize
method.
Sizing Constructor
EImageBW1::EImageBW1(INT32 n32Width, INT32 n32Height);
Constructs a black and white 1-bit image context of given size. All parameters are initialized to their
respective default values.
Parameters
n32Width
n32Height
width, in pixels.
height, in pixels.
Example
// Create a sized EImageBW1 instance with all default values.
EImageBW1 Image1( 640, 480);
Remarks
Size limitations for images are 232 bytes of memory space, i.e. 232 pixels for a black and white 1-bit
image.
Copy Constructor
EImageBW1::EImageBW1(const EImageBW1& ImageBW1);
Constructs a black and white 1-bit image context based on a pre-existing EImageBW1 object. The
image children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
ImageBW1
EImageBW1 object
Example
// Create a copy of an existing EImageBW1 object.
EImageBW1 ImageBW1_2( &ImageBW1_1);
2.3
2.3.1
34
The EImageBW8 class is suited to handle the gray level images. The pixel values are coded on 8 bits,
leaving 256 possible levels. This is sufficient for most applications. Most of the eVision gray level
operations apply to this class.
Construction may imply image memory allocation/de-allocation.
Drawing of these gray level images can be done using an intermediate lookup table.
Declare using
#include "Easy.h"
2.3.2
2.3.2.1
EImageBW8 Construction
Default Constructor
EImageBW8::EImageBW8();
Constructs an empty gray-scale 8-bit image context. All parameters are initialized to their respective
default values.
Example
// Create an EImageBW8 instance with all default values.
EImageBW8 Image1;
Remarks
A void EImageBW8 has no associated pixel data.
The size of the constructed EImageBW8 is not fixed. This has to be done by calling to the SetSize
method.
Sizing Constructor
EImageBW8::EImageBW8(INT32 n32Width, INT32 n32Height);
Constructs a gray-scale 8-bit image context of given size. All parameters are initialized to their
respective default values.
Parameters
n32Width
n32Height
width, in pixels.
height, in pixels.
35
Example
// Create a sized EImageBW8 instance with all default values.
EImageBW8 Image1( 640, 480);
Remarks
Size limitations for images are 232 bytes of memory space, i.e. 232 pixels for a gray-scale 8-bit image.
Copy Constructor
EImageBW8::EImageBW8(const EImageBW8& ImageBW8);
Constructs a gray-scale 8-bit image context based on a pre-existing EImageBW8 object. The image
children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
ImageBW8
EImageBW8 object
Example
// Create a copy of an existing EImageBW8 object.
EImageBW8 ImageBW8_2( &ImageBW8_1);
2.3.2.2
Graphical Interaction
EImageBW8::Draw
void Draw(HDC hDC, EBW8Vector* pGrayScale, FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY=
0.f);
void Draw(HDC hDC, EC24Vector* pColorScale, FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY=
0.f);
Draws a gray-level image in a Windows window, using an intermediate lookup table. See
EImage/ROI...::Draw for drawing of images without use of lookup table.
Parameters
hDC
pGrayScale
pColorScale
f32ZoomX
f32ZoomY
36
2.4
2.4.1
EImageBW16 Overview
The EImageBW16 class is suited to handle the gray level images. The pixel values are coded on 16 bits,
leaving 65536 possible levels. This is used to make more accurate intermediate calculations on 8-bit graylevel images.
Construction may imply image memory allocation/de-allocation.
Declare using
#include "Easy.h"
2.4.2
2.4.2.1
EImageBW16 Construction
Default Constructor
EImageBW16::EImageBW16();
Constructs an empty gray-scale 16-bit image context. All parameters are initialized to their respective
default values.
Example
// Create an EImageBW16 instance with all default values.
EImageBW16 Image1;
37
Remarks
A void EImageBW16 has no associated pixel data.
The size of the constructed EImageBW16 is not fixed. This has to be done by calling to the SetSize
method.
Sizing Constructor
EImageBW16::EImageBW16(INT32 n32Width, INT32 n32Height);
Constructs a gray-scale 16-bit image context of given size. All parameters are initialized to their
respective default values.
Parameters
n32Width
n32Height
width, in pixels.
height, in pixels.
Example
// Create a sized EImageBW16 instance with all default values.
EImageBW16 Image1( 640, 480);
Remarks
Size limitations for images are 232 bytes of memory space, i.e. 231 pixels for a gray-scale 16-bit image.
Copy Constructor
EImageBW16::EImageBW16(const EImageBW16& ImageBW16);
Constructs a gray-scale 16-bit image context based on a pre-existing EImageBW16 object. The image
children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
ImageBW16
EImageBW16 object
Example
// Create a copy of an existing EImageBW16 object.
EImageBW16 ImageBW16_2( &ImageBW16_1);
38
2.5
2.5.1
EImageC24 Overview
The EImageC24 class is suited to handle the color images. The pixel values are coded on 24 bits, leaving
256 possible levels per color component (Red, Green or Blue). This is sufficient for most applications.
Most of the eVision color operations apply to this class.
Construction may imply image memory allocation/de-allocation.
Declare using
#include "Easy.h"
2.5.2
2.5.2.1
EImageC24 Construction
Default Constructor
EImageC24::EImageC24();
Constructs an empty true color (3 x 8 bits) image context. All parameters are initialized to their
respective default values.
Example
// Create an EImageC24 instance with all default values.
EImageC24 Image1;
Remarks
A void EImageC24 has no associated pixel data.
39
The size of the constructed EImageC24 is not fixed. This has to be done by calling to the SetSize
method.
Sizing Constructor
EImageC24::EImageC24(INT32 n32Width, INT32 n32Height);
Constructs a true color (3 x 8 bits) image context of given size. All parameters are initialized to their
respective default values.
Parameters
n32Width
n32Height
width, in pixels.
height, in pixels.
Example
// Create a sized EImageC24 instance with all default values.
EImageC24 Image1( 640, 480);
Remarks
Size limitations for images are 232 bytes of memory space, i.e. [232 /3] pixels for a color 24bit image.
Copy Constructor
EImageC24::EImageC24(const EImageC24& ImageC24);
Constructs a true color (3 x 8 bits) image context based on a pre-existing EImageC24 object. The
image children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
ImageC24
EImageC24 object
Example
// Create a copy of an existing EImageC24 object.
EImageC24 ImageC24_2( &ImageC24_1);
2.6
2.6.1
The EImageC24A class is suited to handle the Windows RGB32 color format. The pixel values are coded
on 32 bits, leaving 256 possible levels per color component (Red, Green or Blue) and 8 more bits for an
alpha channel.
40
Warning
The EImageC24A image type is supported for compatibility with the Windows bitmap formats. In
particular, some acquisition or image display devices use this format. eVision is capable of
loading/saving/displaying such images using their native format.
Currently, the alpha channel is not used for any purpose in the eVision processing function. Users are
free to use it to store an additional gray-level content.
Construction may imply image memory allocation/de-allocation.
Declare using
#include "Easy.h"
2.6.2
2.6.2.1
EImageC24A Construction
Default Constructor
EImageC24A::EImageC24A();
Constructs an empty RGB32 color (3 x 8 + 8 bits) image context. All parameters are initialized to their
respective default values.
Example
// Create an EImageC24A instance with all default values.
EImageC24A Image1;
Remarks
A void EImageC24A has no associated pixel data.
The size of the constructed EImageC24A is not fixed. This has to be done by calling to the SetSize
method.
Sizing Constructor
EImageC24A::EImageC24A(INT32 n32Width, INT32 n32Height);
Constructs a RGB32 color (3 x 8 + 8 bits) image context of given size. All parameters are initialized to
their respective default values.
Parameters
n32Width
n32Height
width, in pixels.
height, in pixels.
Example
// Create a sized EImageC24A instance with all default values.
EImageC24A Image1( 640, 480);
Remarks
Size limitations for images are 232 bytes of memory space, i.e. 230 pixels for a RGB32 image.
41
Copy Constructor
EImageC24A::EImageC24A(const EImageC24A& ImageC24A);
Constructs a RGB32 color (3 x 8 + 8 bits) image context based on a pre-existing EImageC24A object.
The image children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
ImageC24A
EImageC24A object
Example
// Create a copy of an existing EImageC24A object.
EImageC24A ImageC24A_2( &ImageC24A_1);
2.7
2.7.1
The EImageC15 class is suited to handle the Windows RGB 15 color images. The pixel values are coded
on 15 bits, leaving 32 possible levels per color component (Red, Green or Blue).
Warning
The EImageC15 image type is supported for compatibility with the Windows bitmap formats. In
particular, some acquisition or image display devices use this format. eVision is capable of
loading/saving/displaying such images using their native format.
Construction may imply image memory allocation/de-allocation.
Declare using
#include "Easy.h"
42
2.7.2
2.7.2.1
EImageC15 Construction
Default Constructor
EImageC15::EImageC15();
Constructs an empty RGB15 color (3 x 5 bits) image context. All parameters are initialized to their
respective default values.
Example
// Create an EImageC15 instance with all default values.
EImageC15 Image1;
Remarks
A void EImageC15 has no associated pixel data.
The size of the constructed EImageC15 is not fixed. This has to be done by calling to the SetSize
method.
Sizing Constructor
EImageC15::EImageC15(INT32 n32Width, INT32 n32Height);
Constructs a RGB15 color (3 x 5 bits) image context of given size. All parameters are initialized to their
respective default values.
Parameters
n32Width
n32Height
width, in pixels.
height, in pixels.
Example
// Create a sized EImageC15 instance with all default values.
EImageC15 Image1( 640, 480);
Remarks
Size limitations for images are 232 bytes of memory space, i.e. 231 pixels for a RGB15 color image.
Copy Constructor
EImageC15::EImageC15(const EImageC15& ImageC15);
Constructs a RGB15 color (3 x 5 bits) image context based on a pre-existing EImageC15 object. The
image children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
ImageC15
EImageC15 object
Example
// Create a copy of an existing EImageC15 object.
EImageC15 ImageC15_2( &ImageC15_1);
43
2.8
2.8.1
EImageC16 Overview
The EImageC16 class is suited to handle the Windows RGB16 color images. The pixel values are coded
on 16 bits (5-6-5), leaving 32 possible levels for R and B component, and 64 possible levels for G
component.
Warning
The EImageC16 image type is supported for compatibility with the Windows bitmap formats. In
particular, some acquisition or image display devices use this format. eVision is capable of
loading/saving/displaying such images using their native format.
Construction may imply image memory allocation/de-allocation.
Declare using
#include "Easy.h"
2.8.2
2.8.2.1
EImageC16 Construction
Default Constructor
EImageC16::EImageC16();
Constructs an empty RGB16 color (5-6-5 bits) image context. All parameters are initialized to their
respective default values.
Example
// Create an EImageC16 instance with all default values.
EImageC16 Image1;
Remarks
A void EImageC16 has no associated pixel data.
The size of the constructed EImageC16 is not fixed. This has to be done by calling to the SetSize
method.
44
Sizing Constructor
EImageC16::EImageC16(INT32 n32Width, INT32 n32Height);
Constructs a RGB16 color (5-6-5 bits) image context of given size. All parameters are initialized to their
respective default values.
Parameters
n32Width
n32Height
width, in pixels.
height, in pixels.
Example
// Create a sized EImageC16 instance with all default values.
EImageC16 Image1( 640, 480);
Remarks
Size limitations for images are 232 bytes of memory space, i.e. 231 pixels for a RGB16 color image.
Copy Constructor
EImageC16::EImageC16(const EImageC16& ImageC16);
Constructs a RGB16 color (5-6-5 bits) image context based on a pre-existing EImageC16 object. The
image children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
ImageC16
EImageC16 object
Example
// Create a copy of an existing EImageC16 object.
EImageC16 ImageC16_2( &ImageC16_1);
45
2.9
2.9.1
EROIBW1
EROIBW1 Overview
The EROIBW1 class is used to represent regions of interest which are a restriction of a black and white
image to a rectangular part of it. An ROI is linked to its parent image. Several ROIs may be linked to the
same image. The ROIs may be nested, i.e. an ROI may have another ROI rather than an image for
parent. An ROI must always be wholly contained in its parent.
ROIs nesting
When you create an ROI, you must pass a pointer to its parent.
Construction never imply image memory allocation.
Most of the operations that apply to a gray level image also apply to its ROIs.
For other features, refer to the EImage/ROI... overview.
Declare using
#include "Easy.h"
46
2.9.2
2.9.2.1
EROIBW1 Construction
Default Constructor
EROIBW1::EROIBW1();
Constructs an empty black and white 1-bit ROI context. All parameters are initialized to their respective
default values.
Example
// Create an EROIBW1 instance with all default values.
EROIBW1 Roi1;
Remarks
A void EROIBW1 has no associated pixel data and is not attached to any other ROI or image.
Sizing Constructor
EROIBW1::EROIBW1(EROIBW1* pParent, INT32 n32OrgX, INT32 n32OrgY, INT32 n32Width,
INT32 n32Height);
Constructs a black and white 1-bit ROI context of given size within a parent black and white 1-bit
image/ROI. All parameters are initialized to their respective default values.
Parameters
pParent
n32OrgX
n32OrgY
n32Width
n32Height
Example
// Create a sized EROIBW1 instance with all default values.
EROIBW1 SubRoi( &Roi, 100, 150, 75, 75);
Remarks
If the limits of the ROI extend outside of its parent image/ROI, they are clipped against it.
Copy Constructor
EROIBW1::EROIBW1(const EROIBW1& RoiBW1);
Constructs a black and white 1-bit ROI context based on a pre-existing EROIBW1 object. The newly
constructed ROI is attached to the same parent than the copied ROI. So, the two ROIs are siblings.
The ROI children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
RoiBW1
EROIBW1 object
Example
// Create a copy of an existing EROIBW1 object.
EROIBW1 RoiBW1_2( &RoiBW1_1);
47
2.10 EROIBW8
2.10.1 EROIBW8 Overview
The EROIBW8 class is used to represent regions of interest which are a restriction of a gray level image
to a rectangular part of it. An ROI is linked to its parent image. Several ROIs may be linked to the same
image. The ROIs may be nested, i.e. an ROI may have another ROI rather than an image for parent. An
ROI must always be wholly contained in its parent.
ROIs nesting
When you create an ROI, you must pass a pointer to its parent.
Construction never imply image memory allocation.
Most of the operations that apply to a gray level image also apply to its ROIs.
For other features, refer to the EImage/ROI... overview.
Declare using
#include "Easy.h"
48
Constructs an empty gray-scale 8-bit ROI context. All parameters are initialized to their respective
default values.
Example
// Create an EROIBW8 instance with all default values.
EROIBW8 Roi1;
Remarks
A void EROIBW8 has no associated pixel data and is not attached to any other ROI or image.
Sizing Constructor
EROIBW8::EROIBW8(EROIBW8* pParent, INT32 n32OrgX, INT32 n32OrgY, INT32 n32Width,
INT32 n32Height);
Constructs a gray-scale 8-bit ROI context of given size within a parent gray-scale 8-bit image/ROI. All
parameters are initialized to their respective default values.
Parameters
pParent
n32OrgX
n32OrgY
n32Width
n32Height
Example
// Create a sized EROIBW8 instance with all default values.
EROIBW8 SubRoi( &Roi, 100, 150, 75, 75);
Remarks
If the limits of the ROI extend outside of its parent image/ROI, they are clipped against it.
Copy Constructor
EROIBW8::EROIBW8(const EROIBW8& RoiBW8);
Constructs a gray-scale 8-bit ROI context based on a pre-existing EROIBW8 object. The newly
constructed ROI is attached to the same parent than the copied ROI. So, the two ROIs are siblings.
The ROI children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
RoiBW8
EROIBW8 object
49
Example
// Create a copy of an existing EROIBW8 object.
EROIBW8 RoiBW8_2( &RoiBW8_1);
Draws a gray-level ROI in a Windows window using an intermediate lookup table. See
EImage/ROI...::Draw for drawing of ROIs without use of lookup table.
Parameters
hDC
pGrayScale
pColorScale
f32ZoomX
f32ZoomY
50
2.11 EROIBW16
2.11.1 EROIBW16 Overview
The EROIBW16 class is used to represent regions of interest which are a restriction of a gray level image
to a rectangular part of it. An ROI is linked to its parent image. Several ROIs may be linked to the same
image. The ROIs may be nested, i.e. an ROI may have another ROI rather than an image for parent. An
ROI must always be wholly contained in its parent.
ROIs nesting
When you create an ROI, you must pass a pointer to its parent.
Construction never imply image memory allocation.
Most of the operations that apply to a gray level image also apply to its ROIs.
For other features, refer to the EImage/ROI... Overview.
Declare using
#include "Easy.h"
51
Constructs an empty gray-scale 16-bit ROI context. All parameters are initialized to their respective
default values.
Example
// Create an EROIBW16 instance with all default values.
EROIBW16 Roi1;
Remarks
A void EROIBW16 has no associated pixel data and is not attached to any other ROI or image.
Sizing Constructor
EROIBW16::EROIBW16(EROIBW16* pParent, INT32 n32OrgX, INT32 n32OrgY, INT32 n32Width,
INT32 n32Height);
Constructs a gray-scale 16-bit ROI context of given size within a parent gray-scale 16-bit image/ROI.
All parameters are initialized to their respective default values.
Parameters
pParent
n32OrgX
n32OrgY
n32Width
n32Height
Example
// Create a sized EROIBW16 instance with all default values.
EROIBW16 SubRoi( &Roi, 100, 150, 75, 75);
Remarks
If the limits of the ROI extend outside of its parent image/ROI, they are clipped against it.
Copy Constructor
EROIBW16::EROIBW16(const EROIBW16& RoiBW16);
Constructs a gray-scale 16-bit ROI context based on a pre-existing EROIBW16 object. The newly
constructed ROI is attached to the same parent than the copied ROI. So, the two ROIs are siblings.
The ROI children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
RoiBW16
EROIBW16 object
Example
// Create a copy of an existing EROIBW16 object.
EROIBW16 RoiBW16_2( &RoiBW16_1);
52
2.12 EROIC24
2.12.1 EROIC24 Overview
The EROIC24 class is used to represent regions of interest which are a restriction of a color image to a
rectangular part of it. An ROI is linked to its parent image. Several ROIs may be linked to the same image.
The ROIs may be nested, i.e. an ROI may have another ROI rather than an image for parent. An ROI
must always be wholly contained in its parent.
ROIs nesting
When you create an ROI, you must pass a pointer to its parent.
Construction never imply image memory allocation.
Most of the operations that apply to a color image also apply to its ROIs.
For other features, refer to the EImage/ROI... Overview.
Declare using
#include "Easy.h"
53
Constructs an empty true color (3 x 8 bits) ROI context. All parameters are initialized to their respective
default values.
Example
// Create an EROIC24 instance with all default values.
EROIC24 Roi1;
Remarks
A void EROIC24 has no associated pixel data and is not attached to any other ROI or image.
Sizing Constructor
EROIC24::EROIC24(EROIC24* pParent, INT32 n32OrgX, INT32 n32OrgY, INT32 n32Width,
INT32 n32Height);
Constructs a true color (3 x 8 bits) ROI context of given size within a parent true color (3 x 8 bits)
image/ROI. All parameters are initialized to their respective default values.
Parameters
pParent
n32OrgX
n32OrgY
n32Width
n32Height
Example
// Create a sized EROIC24 instance with all default values.
EROIC24 SubRoi( &Roi, 100, 150, 75, 75);
Remarks
If the limits of the ROI extend outside of its parent image/ROI, they are clipped against it.
Copy Constructor
EROIC24::EROIC24(const EROIC24& RoiC24);
Constructs a true color (3 x 8 bits) ROI context based on a pre-existing EROIC24 object. The newly
constructed ROI is attached to the same parent than the copied ROI. So, the two ROIs are siblings.
The ROI children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
RoiC24
EROIC24 object
Example
// Create a copy of an existing EROIC24 object.
EROIC24 RoiC24_2( &RoiC24_1);
54
2.13 EROIC24A
2.13.1 EROIC24A Overview
The EROIC24A class is used to represent regions of interest which are a restriction of a RGB32 color
image to a rectangular part of it. An ROI is linked to its parent image. Several ROIs may be linked to the
same image. The ROIs may be nested, i.e. an ROI may have another ROI rather than an image for
parent. An ROI must always be wholly contained in its parent.
ROIs nesting
When you create an ROI, you must pass a pointer to its parent.
Construction never imply image memory allocation.
Most of the operations that apply to a color image also apply to its ROIs.
For other features, refer to the EImage/ROI... Overview.
Declare using
#include "Easy.h"
55
Constructs an empty RGB32 color (3 x 8 + 8 bits) ROI context. All parameters are initialized to their
respective default values.
Example
// Create an EROIC24A instance with all default values.
EROIC24A Roi1;
Remarks
A void EROIC24A has no associated pixel data and is not attached to any other ROI or image.
Sizing Constructor
EROIC24A::EROIC24A(EROIC24A* pParent, INT32 n32OrgX, INT32 n32OrgY, INT32 n32Width,
INT32 n32Height);
Constructs a RGB32 color (3 x 8 + 8 bits) ROI context of given size within a parent RGB32 color
image/ROI. All parameters are initialized to their respective default values.
Parameters
pParent
n32OrgX
n32OrgY
n32Width
n32Height
Example
// Create a sized EROIC24A instance with all default values.
EROIC24A SubRoi( &Roi, 100, 150, 75, 75);
Remarks
If the limits of the ROI extend outside of its parent image/ROI, they are clipped against it.
Copy Constructor
EROIC24A::EROIC24A(const EROIC24A& RoiC24A);
Constructs a RGB32 color (3 x 8 + 8 bits) ROI context based on a pre-existing EROIC24A object. The
newly constructed ROI is attached to the same parent than the copied ROI. So, the two ROIs are
siblings. The ROI children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
RoiC24A
EROIC24A object
Example
// Create a copy of an existing EROIC24A object.
EROIC24A RoiC24A_2( &RoiC24A_1);
56
2.14 EROIC15
2.14.1 EROIC15 Overview
The EROIC15 class is used to represent regions of interest which are a restriction of a RGB15 color
image to a rectangular part of it. An ROI is linked to its parent image. Several ROIs may be linked to the
same image. The ROIs may be nested, i.e. an ROI may have another ROI rather than an image for
parent. An ROI must always be wholly contained in its parent.
ROIs nesting
When you create an ROI, you must pass a pointer to its parent.
Construction never imply image memory allocation.
Most of the operations that apply to a color image also apply to its ROIs.
For other features, refer to the EImage/ROI... Overview.
Declare using
#include "Easy.h"
57
Constructs an empty RGB15 color (3 x 5 bits) ROI context. All parameters are initialized to their
respective default values.
Example
// Create an EROIC15 instance with all default values.
EROIC15 Roi1;
Remarks
A void EROIC15 has no associated pixel data and is not attached to any other ROI or image.
Sizing Constructor
EROIC15::EROIC15(EROIC15* pParent, INT32 n32OrgX, INT32 n32OrgY, INT32 n32Width,
INT32 n32Height);
Constructs a RGB15 color (3 x 5 bits) ROI context of given size within a parent RGB15 color
image/ROI. All parameters are initialized to their respective default values.
Parameters
pParent
n32OrgX
n32OrgY
n32Width
n32Height
Example
// Create a sized EROIC15 instance with all default values.
EROIC15 SubRoi( &Roi, 100, 150, 75, 75);
Remarks
If the limits of the ROI extend outside of its parent image/ROI, they are clipped against it.
Copy Constructor
EROIC15::EROIC15(const EROIC15& RoiC15);
Constructs a RGB15 color (3 x 5 bits) ROI context based on a pre-existing EROIC15 object. The newly
constructed ROI is attached to the same parent than the copied ROI. So, the two ROIs are siblings.
The ROI children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
RoiC15
EROIC15 object
Example
// Create a copy of an existing EROIC15 object.
EROIC15 RoiC15_2( &RoiC15_1);
58
2.15 EROIC16
2.15.1 EROIC16 Overview
The EROIC16 class is used to represent regions of interest which are a restriction of a color image to a
rectangular part of it. An ROI is linked to its parent image. Several ROIs may be linked to the same image.
The ROIs may be nested, i.e. an ROI may have another ROI rather than an image for parent. An ROI
must always be wholly contained in its parent.
ROIs nesting
When you create an ROI, you must pass a pointer to its parent.
Construction never imply image memory allocation.
Most of the operations that apply to a color image also apply to its ROIs.
For other features, refer to the EImage/ROI... Overview.
Declare using
#include "Easy.h"
59
Constructs an empty RGB16 color (5-6-5 bits) ROI context. All parameters are initialized to their
respective default values.
Example
// Create an EROIC16 instance with all default values.
EROIC16 Roi1;
Remarks
A void EROIC16 has no associated pixel data and is not attached to any other ROI or image.
Sizing Constructor
EROIC16::EROIC16(EROIC16* pParent, INT32 n32OrgX, INT32 n32OrgY, INT32 n32Width,
INT32 n32Height);
Constructs a RGB16 color (5-6-5 bits) ROI context of given size within a parent RGB16 color
image/ROI. All parameters are initialized to their respective default values.
Parameters
pParent
n32OrgX
n32OrgY
n32Width
n32Height
Example
// Create a sized EROIC16 instance with all default values.
EROIC16 SubRoi( &Roi, 100, 150, 75, 75);
Remarks
If the limits of the ROI extend outside of its parent image/ROI, they are clipped against it.
Copy Constructor
EROIC16::EROIC16(const EROIC16& RoiC16);
Constructs a RGB16 color (5-6-5 bits) ROI context based on a pre-existing EROIC16 object. The newly
constructed ROI is attached to the same parent than the copied ROI. So, the two ROIs are siblings.
The ROI children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
RoiC16
EROIC16 object
Example
// Create a copy of an existing EROIC16 object.
EROIC16 RoiC16_2( &RoiC16_1);
60
2.16 EVectorTemplate
2.16.1 EVectorTemplate Overview
EVectorTemplate objects are used to store one dimensional data. Using them is very similar to using
one-dimensional arrays, except that the size can vary at run-time. Memory allocation is handled internally.
to fill a vector with values, first empty it using the Empty member and then add elements one at
time at the tail by calling the AddElement member;
to access a vector element, either for reading or writing, use the brackets [] operator. To
inquire for the current number of elements, use member GetNumElements.
Declare using
#include "Easy.h"
Constructs a vector.
Parameters
un32MaxElements
EVectorTemplate::Get/Set Closed
BOOL GetClosed( );
Returns a boolean value that indicates whether the shape built with ImgContour must be closed or not.
void SetClosed(BOOL bClosed);
Sets a boolean value that indicates whether the shape built with ImgContour must be closed or not.
Parameters
bClosed
TRUE indicates that the shape built with ImgContour must be closed.
61
Remarks
This only applies to EPathVector, EBW8PathVector, EBW16PathVector and EC24PathVector.
EVectorTemplate::WeightedMoment
FLOAT32 WeightedMoment(UINT32 un32From= 0, UINT32 un32To= ~0);
first element of the vector portion for which the weighted moment will be
calculated. By default, this is the first element of the vector.
last element of the vector portion for which the weighted moment will be
calculated. By default, this is the last element of the vector.
Remarks
This only applies to EBW8Vector, EBW16Vector and EBW32Vector.
EVectorTemplate::AddElement
void AddElement(Type Element);
Appends (adds at the tail) an element to the vector. The element type depends on the vector type.
Parameters
Element
Example
EBW8Vector Lookup;
Lookup.Empty( );
// Prepare a ramp lookup table
for (int i= 0; i < 256; i++)
{ Lookup.AddElement(i);
}
EVectorTemplate::GetDataPtr
Type GetDataPtr ();
62
Draws a plot of the vector element values. Applies to EBW8Vector, EBW16Vector, EBW32Vector,
EC24Vector and EBWHistogramVector vector classes.
In the special case of the EC24Vector, three curves are drawn instead of one, each corresponding to a
color component. Three pen objects must be provided to draw the curves with appropriate attributes.
Parameters
hDC
f32Width
f32Height
f32OrgX
f32OrgY
hPen0, hPen1, hPen2
void Draw(HDC hDC, FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32 f32PanX=
0.f, FLOAT32 f32PanY= 0.f);
EVectorTemplate::Empty
void Empty( );
63
EVectorTemplate::Get/SetNumElements
UINT32 GetNumElements( );
EVectorTemplate::Operator[ ]
operator[](UINT32 un32Index);
Example
EBW8Vector Lookup;
// Clear element index 5
if (Lookup.GetNumElements( ) >= 6)
{ Lookup[5]= 0;
}
2.17 Vector<>
2.17.1 Vector<> Overview
Vector<> objects are used to store, in a linear arrangement, sets of ordered items of the type specified by
the template argument.
The Vector<> class in found in the Euresys::eVision::Utils namespace.
Declare using
#include "Easy.h"
64
Checked accessor.
An exception is thrown if the index is out of bounds.
const Vector<ItemType>::Item Type& operator[]( size_t i) const
65
2.18 EMeasurementUnit
2.18.1 EMeasurementUnit Class Members
EMeasurementUnit Construction
EMeasurementUnit::EMeasurementUnit(FLOAT32 f32Magnitude, CHAR* pszName);
EMeasurementUnit::ConversionFactorTo
FLOAT32 EMeasurementUnit::ConversionFactorTo(const EMeasurementUnit& Unit) const;
Returns the factor needed to convert from this measurement unit to a second one.
Parameters
Unit
EMeasurementUnit::GetName
CHAR* EMeasurementUnit::GetName( ) const;
EMeasurementUnit::GetMagnitude
FLOAT32 EMeasurementUnit::GetMagnitude( ) const;
Returns the relative magnitude of this unit with respect to a standard unit (e.g. 1 mm = 0.001 m).
EMeasurementUnit::SetMagnitude
void EMeasurementUnit::SetMagnitude(FLOAT32 f32Magnitude);
Sets the relative magnitude of this unit with respect to a standard unit (e.g. 1 mm = 0.001 m).
Parameters
f32Magnitude
66
2.19 EDimensionalValue
2.19.1 EDimensionalValue Class Members
EDimensionalValue: Construction
EDimensionalValue::EDimensionalValue(FLOAT32 f32Value, EMeasurementUnit* pUnit);
numerical value.
pointer to an existing measurement unit.
EDimensionalValue::GetValue
FLOAT32 EDimensionalValue::GetValue( );
EDimensionalValue::SetValue
VOID EDimensionalValue::SetValue(FLOAT32 f32Value);
numerical value.
numerical value.
pointer to an existing measurement unit.
EDimensionalValue::Get/SetUnit
EMeasurementUnit* EDimensionalValue::GetUnit( );
2.20 EImageSequence
2.20.1 EImageSequence: Overview
68
Parameters
n32Width
n32Height
eImageType
EImageSequence Destruction
~EImageSequence();
2.20.2.2 Sizing
EImageSequence::Get/Set Width
INT32 GetWidth();
EImageSequence::Get/Set Height
INT32 GetHeight();
2.20.2.3 Typing
EImageSequence::Get/Set ImageType
enum E_IMAGE_TYPES GetImageType();
Returns the type of the images in the sequence as defined by enum E_IMAGE_TYPES.
69
Sets the type of the images in the sequence as defined by enum E_IMAGE_TYPES.
The type of the sequence must be set before any use. While recording, reading or when images are
queued, the type may not be changed
Parameters
eImageType
2.20.2.4 Sequencing
EImageSequence::GetCount
INT32 GetCount();
EImageSequence::CloseFile
void CloseFile ();
70
By default (if NumRate and DenomRate haven't been specified), EImageSequence suggests
16 images/second playback. The compression chosen by SetCodecFourcc is used, excepted when
hwndDialogParent is valid. In that case, a dialog box allows the user to select the codec and to
configure it. If no CodecFourcc has been specified, EImageSequence records without compression.
Choosing the codec with the dialog box is handy, it gives you the opportunity to choose any codec and
to configure it.
Remark
Some codecs are limited to some image types and sizes.
Parameters
psZFileName
hwndDialogParent
EImageSequence::Seek
void Seek(INT32 n32Delta);
EImageSequence::AddImage
void AddImage(EImageBW1* pBW1Src);
void AddImage(EImageBW8* pBW8Src);
void AddImage(EImageC15* pC15Src);
void AddImage(EImageC24* pC24Src);
void AddImage(EImageC24A* pC24ASrc);
EImageSequence::AddImageData
void AddImageData(UINT8* pImg);
71
EImageSequence::AddImages
void AddImages(EImageBW1** ppBW1Src, INT32 n32Count);
void AddImage(EImageBW8** ppBW8Src, INT32 n32Count);
void AddImage(EImageC15** ppC15Src, INT32 n32Count);
void AddImage(EImageC24** ppC24Src, INT32 n32Count);
void AddImage(EImageC24A** ppC24ASrc, INT32 n32Count);
Sets the AVI file from which the image sequence will be read.
The type and size of the images are set to those of the file.
Parameters
pszFileName
EImageSequence::SetPosition
void SetPosition(INT32 n32Position);
72
Parameters
N32Position
EImageSequence::GetImage
void GetImage(EImageBW1* pBW1Dst);
void GetImage(EImageBW8* pBW8Dst);
void GetImage(EImageC15* pC15Dst);
void GetImage(EImageC24* pC24Dst);
void GetImage(EImageC24A* pC24ADst);
EImageSequence::GetImages
int GetImages(EImageBW1** ppBW1Dst, INT32 n32Count);
int GetImages(EImageBW8** ppBW8Dst, INT32 n32Count);
int GetImages(EImageC15** ppC15Dst, INT32 n32Count);
int GetImages(EImageC24** ppC24Dst, INT32 n32Count);
int GetImages(EImageC24A** ppC24ADst, INT32 n32Count);
Gets a specified number of images from the sequence to an array. The array must be large enough
and each pointer in the array should point to an image holder.
The function returns the number of images effectively read.
The images are bottom-up. The destination images should be of the same type as the one of the
sequence images.
Parameters
ppBW1Dst
ppBW8Dst
ppC15Dst
ppC24Dst
ppC24ADst
n32Count
73
flipping mode.
Sets the FOURCC code of codec to use for recording. By default, EImageSequence records without
compression. The codec can only be set before setting the file to record to.
Be aware that some codecs are limited to some image types and sizes.
Parameters
n32Fourcc
pszFourcc
FOURCC code.
null termined string. Four characters FOURCC code.
Remarks
pszFourcc must be four characters Long plus the terminating NULL byte.
EImageSequence::Get/Set NumRate
INT32 GetNumRate();
74
EImageSequence::Get/Set DenomRate
INT32 GetDenomRate();
EImageSequence::Get/Set DataRate
INT32 GetDataRate();
desired data rate in bytes. A value of 0 (which is the default value) means
that there is no desire about the data rate.
EImageSequence::Get/Set KeyFrameRate
INT32 GetKeyFrameRate()
75
EImageSequence::Get/Set CompressionQuality
INT32 GetCompressionQuality()
2.21 ESerializer
2.21.1 ESerializer Overview
Returns an ESerializer object suitable for opening a file and writing into it.
Parameters
filePath
mode
76
const std::string& : full path and name specification of the file to be used
to create the ESerializer object. It is allowed to give a regular C string
(char*).
const std::basic_string<wchar_t>& : full path and name of the file, in
Unicode format, to be used to create the ESerializer object.
creation mode of the storage file, as defined by enum FileWriterMode (by
default, mode = Create).
Example
// Create an ESerializer object for writing with the append mode
ESerializer *pSerializer = ESerializer::CreateFileWriter( "filename",
ESerializer::Append);
Remarks
The FileWriterMode parameter is an enumerated type that allows to control what happens when the
file already exists:
if "mode" is ESerializer::Create, the call will not succeed if the file already exists,
if "mode" is ESerializer::Overwrite, the existing file will be overwritten,
if "mode" is ESerializer::Append, the new data will be appended to the existing file content.
It is up to users to delete the ESerializer object when they have done using it in Save( ) calls.
If the call does not succeed, it returns NULL. Please check the eVision error code to get further
information.
ESerializer::CreateFileReader
static ESerializer* ESerializer::CreateFileReader( const std::string& filePath);
static ESerializer* ESerializer::CreateFileReader( const std::basic_string<wchar_t>&
filePath);
const std::string& : full path and name specification of the file to be used
to create the ESerializer object. It is allowed to give a regular C string
(char*).
const std::basic_string<wchar_t>& : full path and name of the file, in
Unicode format, to be used to create the ESerializer object.
Example
// Create an ESerializer object for reading
ESerializer *pSerializer = ESerializer::CreateFileReader( "filename");
Remarks
It is up to users to delete the ESerializer object when they have done using it in Load( ) calls.
If the call does not succeed, it returns NULL. Please check the eVision error code to get further
informations.
ESerializer::GetNextObjectType
ObjectType ESerializer::GetNextObjectType();
Returns the type of the next object previously saved in the file, when the ESerializer object has
been created for reading. The returned type is an enumerated defined by enum ObjectType.
Example
// Create an ESerializer object for reading
ESerializer *pSerializer = ESerializer::CreateFileReader( "filename");
// Verify there is yet an object in the file
if (pSerializer->GetNextObjectType() != ESerializer::EndOfArchive) {
77
Remarks
If the ESerializer object has been created for writing (instead of reading), the
ESerializer::GetNextObjectType method returns an error message ("Attempting to read with a
serializer not open for read access").
ESerializer::IsWriting
BOOL ESerializer::IsWriting() const;
Returns TRUE if the ESerializer object has been created for writing and FALSE otherwise.
ESerializer::IsReading
BOOL ESerializer::IsReading() const;
Returns TRUE if the ESerializer object has been created for reading and FALSE otherwise.
ESerializer::Close
void ESerializer::Close();
enum FileWriterMode
The FileWriterMode is an enumerated type given by
class ESerializer {
enum FileWriterMode {
Create,
Overwrite,
Append
};
};
It tells the ESerializer::CreateFileWriter method the mode in which the archive has to be created:
Create: create the archive file on the hard disk. If the file already exists, the Serializer::CreateFileWriter
method returns NULL.
Overwrite: overwrite the previously created archive if it already exists, or created it otherwise.
Append: append the data at the end of the previously created archive, or create the archive if it doesn't
exist.
78
enum ObjectType
The ObjectType is an enumerated type given by
class ESerializer {
enum ObjectType {
EndOfArchive,
NotSerializable,
EMatch = 0x20,
EImageBW1,
EImageBW8,
EImageBW16,
EImageBW32,
EImageC15,
EImageC16,
EImageC24,
EImageC24A,
EROIBW1,
EROIBW8,
EROIBW16,
EROIBW32,
EROIC15,
EROIC16,
EROIC24,
EROIC24A,
Unknown = ( INT32)0xffffffff
};
};
It tells the ESerializer::GetNextObjectType method the type of the object following the current object
and previously saved in the archive:
EndOfArchive: end of the file.
NotSerializable: not serializable object.
EMatch = 0x20: EMatch object.
EImageBW1:black and white image (1 bit per pixel).
EImageBW8: 8 bits per pixel gray-level image.
EImageBW16: 16 bits per pixel gray-level image.
EImageBW32: 32 bits per pixel gray-level image.
EImageC15: 15 bits per pixel color image (R:5 G:5 B:5).
EImageC16: 16 bits per pixel color image (R:5 G:6 B:5).
EImageC24: 24 bits per pixel color image (RGB).
EImageC24A: 32 bits per pixel color image (RGB + unused alpha channel).
EROIBW1: region of interest mapped on a black and white image (EImageBW1).
EROIBW8: region of interest mapped on an 8-bit gray-level image (EImageBW8).
EROIBW16: region of interest mapped on a 16-bit gray-level image (EImageBW16).
EROIBW32: region of interest mapped on a 32-bit gray-level image (EImageBW32).
EROIC15: region of interest mapped on a 15-bit color image (EImageC15).
EROIC16: region of interest mapped on a 16-bit color image (EImageC16).
EROIC24: region of interest mapped on a 24-bit color image (EImageC24).
EROIC24A: region of interest mapped on a 32-bit color image (EImageC24A).
79
2.22 EJpegHandler
2.22.1 EJpegHandler Overview
The EJpegHandler class can be used to manage single- and dual-field JPEG images. It allows to
load/save the JPEG data to/from disk files and serialization streams and decompress and interlace the
dual field image to an EImageC24.
In order to use an EJpegHandler, you have to set its internal pointer(s) to the JPEG data by using the
SetBuffers call.
Declare using
#include "Easy.h"
Sets the EJpegHandler internal pointers to the given buffers. An error will be set if these buffers do not
contain valid JPEG data.
You can optionally set the downField to be NULL. In this case, the image is treated as a single-field
image.
Parameters
upField
upFieldByteSize
downField
downFieldByteSize
EJpegHandler::DecompressToImage
void EJpegHandler::DecompressToImage(EImageC24& DstImage) const;
Decompresses the JPEG field buffers to the given EImageC24 by interlacing the fields. If the down
field buffer is NULL, then no interlacing is performed.
80
Parameters
DstImage
EImageC24 object.
Remarks
Please note the image will be resized to fit the JPEG field size if needed.
Remarks
Please note these functions cannot be used to read ordinary JPEG/JFIF files (if you wish to do so, you
should use the EImage..::Load method or the EJpegHandler::LoadFJfif / LoadSJfif methods).
void EJpegHandler::Load(FILE* file);
void EJpegHandler::Load(ESerializer* serializer);
Reads the EJpegHandler object from the given stream. They will fail if the stream does not contain a
valid EJpegHandler objet at its current position. Please see the ESerializer documentation for details.
Parameters
file
serializer
EJpegHandler::LoadFJfif
void EJpegHandler::LoadFJfif(const char* pathName);
void EJpegHandler::LoadFJfif(const std::string& pathName);
EJpegHandler::LoadSJfif
void EJpegHandler::LoadSJfif(const char* pathName);
void EJpegHandler::LoadSJfif(const std::string& pathName);
Parameters
pathName
EJpegHandler::Save
void EJpegHandler::Save(const char* pszPathName) const;
void EJpegHandler::Save(const UNICHAR* pszPathName) const;
void EJpegHandler::Save(const std::string& pathName) const;
void EJpegHandler::Save(const std::basic_string<wchar_t>& pathName) const;
Writes the content of the JPEG field buffers to the given file.
Parameters
pszPathName/pathName
Remarks
Please note the file is written in an eVision proprietary format. If you wish to save a regular JPEG file,
you can do so by converting the EJpegHandler instance to an EImageC24 instance, and use the
EImageC24::Save method.
void EJpegHandler::Save(FILE* file) const;
void EJpegHandler::Save(ESerializer* serializer) const;
Writes the object to the given file or stream, at its current position. Please see the ESerializer
documentation for instructions on how to create and use such a stream.
Parameters
file
serializer
EJpegHandler::SaveFJfif
void EJpegHandler::SaveFJfif(const char* pathName);
void EJpegHandler::SaveFJfif(const std::string& pathName);
EJpegHandler::SaveSJfif
void EJpegHandler::SaveSJfif(const char* pathName);
void EJpegHandler::SaveSJfif(const std::string& pathName);
82
3.
FUNCTIONS
3.1
Initialize
void Initialize();
3.2
File Access
ESetTiffThreshold
void ESetTiffThreshold(UINT32 un32Threshold);
Sets the threshold used to convert a gray-level image to a binary image for storage using the bilevel
TIFF formats. Use this function before calling Save.
83
Parameters
un32Threshold
Example
ESetTiffThreshold(128);
MyImage.Save ("\\Images\\Dst.tif", E_FILE_FORMAT_PACKED_BILEVEL_TIFF);
ESetJpegQuality
void ESetJpegQuality(UINT32 un32Quality);
Sets the compression quality of a JPEG compressed image file. Use this function before calling Save.
Parameters
un32Quality
Remarks
A value of 0 % leads to the most efficient compression. A value of 100 % produces the best image
quality.
Example
ESetJpegQuality(100);
MyImage.Save ("\\Images\\Dst.jpg", E_FILE_FORMAT_COLOR_JPEG);
3.3
Resizing
EResize
void EResize(EROIBW8* pSrcImage, EROIBW8* pDstImage);
void EResize(EROIBW16* pSrcImage, EROIBW16* pDstImage);
void EResize(EROIC15* pSrcImage, EROIC15* pDstImage);
void EResize(EROIC16* pSrcImage, EROIC16* pDstImage);
void EResize(EROIC24* pSrcImage, EROIC24* pDstImage);
void EResize(EROIC24A* pSrcImage, EROIC24A* pDstImage);
Example
//Initialize source and destination images
EImageBW8 Src(640, 480);
EImageBW8 Dst(800, 600); //Destination image MUST be initialized
//Load image
Src.Load(...);
//Resize image
EResize(&Src, &Dst);
84
Remarks
Before using this function, the destination image must have a size and thus be initialized.
3.4
Copying
ESetRecursiveCopyBehavior
void ESetRecursiveCopyBehavior(BOOL bRecursiveCopy= TRUE);
Sets the global flag controlling the default behavior of copy constructors and assignment operators,
throughout all the eVision libraries.
When this flag is set to TRUE, the object children will be recursively copied. If this flag is set to FALSE,
then the target object will not have any children after the copy operation.
Parameters
bRecursiveCopy
Example1
// Copy an image instance WITH its attached ROI
// into another image instance (default behaviour)
EImageBW8 Src;
EImageBW8 Dst;
EROIBW8 SrcROI;
Example2
// Copy a gauge instance WITHOUT its daughter gauges
// into another gauge instance
ERectangleGauge Rectangle1;
ERectangleGauge Rectangle2;
ELineGauge Line;
EPointGauge Point;
Remark
This flag is only relevant where objects are stored in a tree-like structure, like EROI and EImage
objects, or EGauge objects.
85
EGetRecursiveCopyBehavior
BOOL EGetRecursiveCopyBehavior();
Returns the global flag controlling the default behavior of copy constructors and assignment operators,
throughout all the eVision libraries.
Remark
When this flag is set to TRUE, the object children will be recursively copied. If this flag is set to FALSE,
then the target object will not have any children after the copy operation.
3.5
eVision uses a uniform mechanism for error reporting: each time a function (or class function member) is
invoked, a success code is generated. It can be either the predefined value E_OK, if everything went fine,
or an explanatory error code otherwise. The possible error conditions usually result from a bad object
initialization (data memory allocation), an arithmetic exception or an invalid parameter value.
When an error condition arises, an error message can be output automatically or not, depending on the
trace mode previously set with ESetTraceMode.
In any case, the EGetError function always returns the success code of the last eVision function call.
EGetErrorText returns the associated error message.
The following shorthand macros can also be very handy: ETrace, ETraceR, ETraceRS.
EGetError, EGetErrorText
enum E_ERRORS EGetError( )
Returns the success code of the last function call as an enum E_ERRORS.
Example
EImageBW8* pImage= new EImageBW8(512, 512);
if (EGetError( ) != E_OK)
goto Failure;
CHAR* EGetErrorText( )
EGetError, EGetErrorText
enum E_ERRORS EGetError( )
Returns the success code of the last function call as an enum E_ERRORS.
Example
EImageBW8* pImage= new EImageBW8(512, 512);
if (EGetError( ) != E_OK)
goto Failure;
86
EOk
E_ERRORS EOk();
Example
ESetTraceMode(E_TRACE_DISPLAY_FULL_MESSAGE);
EGetTraceMode
enum E_TRACE_MODE EGetTraceMode();
Traces any error condition resulting from a call to an eVision function using the current tracing mode.
This function MUST be used if full trace messages are wanted.
Parameters
"function call"
87
Example
ETrace(ImgOper(IMG_MULTIPLY, &Src, 2, &Dst));
ETraceR
ETraceR("function call");
Traces any error condition resulting from a call to an eVision function using the current tracing mode.
By contrast with ETrace, a return from the current function is forced in case of an error.
This function MUST be used if full trace messages are wanted.
Parameters
"function call"
Example
void Test( ){
// In case of an error, exit from Test( );
ETraceR(ImgOper(IMG_MULTIPLY, &Src, 2, &Dst));
...
}
ETraceRS
ETraceRS("function call");
Traces any error condition resulting from a call to an eVision function using the current tracing mode.
By contrast with ETraceR, a return from the current function with the error code is forced in case of an
error. This function MUST be used if full trace messages are wanted.
Parameters
"function call"
Example
enum E_ERRORS Test( )
{
// In case of an error, return from Test( ); with the value of the status
ETraceRS(ImgOper(IMG_MULTIPLY, &Src, 2, &Dst));
...
}
ThrowOnEError
void ThrowOnEError();
Automatically throws an eVision::Exception if the previous eVision call was not successful.
Remark
This function is declared into the Euresys::eVision namespace.
Example
// Load an image
image.Load(image.bmp);
// Test for a possible error
ThrowOnEError();
88
3.6
EOpenImageDC
HDC EOpenImageDC(EImageBW8* pImage);
HDC EOpenImageDC(EImageC24* pImage);
Allows to draw in a gray-level or a color image, using any of the Windows device context functions (the
image contents is altered, allowing destructive overlays).
The function returns a handle to a device context associated to the image pixel data. When the device
context is no more needed, call function ECloseImageDC with the same argument.
Parameters
pImage
Example
// Open a device context
HDC hDC= EOpenImageDC(&Src);
// Draw in the image
LineTo(hDC, 0, 50);
LineTo(hDC, 50, 0);
...
// Release the device context
ECloseImageDC(&Src);
ECloseImageDC
void ECloseImageDC(EImageBW8* pImage);
void ECloseImageDC(EImageC24* pImage);
Example
// Open a device context
HDC hDC= EOpenImageDC(&Src);
// Draw in the image
LineTo(hDC, 0, 50);
LineTo(hDC, 50, 0);
...
// Release the device context
ECloseImageDC(&Src);
89
3.7
Image 3D Rendering
ERender3D
VOID ERender3D(EROIBW8* pSrcImage, EROIBW8* pDstImage, FLOAT32 f32Phi, FLOAT32
f32Psi, FLOAT32 f32XScale= 1.f, FLOAT32 f32Yscale= 1.f, FLOAT32 f32Zscale= 1.f,
INT32 n32DotSize= 4)
Prepares a three dimensional rendering of an image where the gray level values are taken for
altitudes. The image is viewed by rotating it about the X axis, then about the Y axis. Magnification
factors in the three directions (X=width, Y=height and Z=depth) can be given.
The rendered image appears as independent dots. The dot size can be adjusted so that the surface
appears more or less opaque.
The function does not display the rendered image by itself. Rather, it prepares a destination image to
be displayed.
Parameters
pSrcImage
pDstImage
f32Phi
f32Psi
f32XScale
f32YScale
f32ZScale
n32DotSize
Example
// Prepare the rendered image
ERender3D(&SrcImage, &DstImage, f32Phi, f32Psi);
// Display it
DstImage.Draw(pDC->GetSafeHdc( ));
ERenderColorHistogram
void ERenderColorHistogram(EROIC24* pSrcImage, EROIC24* pDstImage, FLOAT32 f32Phi,
FLOAT32 f32Psi, FLOAT32 f32XScale= 1.f, FLOAT32 f32YScale= 1.f, FLOAT32 f32ZScale=
1.f);
void ERenderColorHistogram(EROIC24* pRgbImage, EROIC24* pSysImage, EROIC24*
pDstImage, FLOAT32 f32Phi, FLOAT32 f32Psi, FLOAT32 f32XScale= 1.f, FLOAT32
f32YScale= 1.f, FLOAT32 f32ZScale= 1.f);
Prepares a three dimensional rendering of the histogram of a color image: the pixels are drawn in the
RGB space rather than in the XY plane. This allows to observe the clustering and dispersion of the
RGB values.
The image is viewed by rotating it about the X axis, then about the Y axis. Magnification factors in the
three directions (X=Red, Y=Green and Z=Blue) can be given.
In a more advanced version, prepares a three dimensional rendering of the pixels in another system
than RGB (EasyColor provides conversion means). However, the raw RGB image must still be
provided to allow the display of the pixels in their usual colors.
The rendered image appears as independent dots.
90
The function does not display the rendered image by itself. Rather, it prepares a destination image to
be displayed.
Parameters
pSrcImage
pSysImage
pDstImage
f32Phi
f32Psi
f32Xscale
f32Yscale
f32Zscale
Example
EImageC24 SrcImage(512, 512), LhsImage(512, 512), DstImage(512, 512);
EColorLookup Lookup;
// Convert the source image to HSV, using a color lookup table
Lookup.ConvertFromRGB(E_COLOR_SYSTEM_LSH);
ClrTransform(&SrcImage, &LhsImage, &Lookup);
// Prepare the rendered image, using the LHS coordinates
ERenderColorHistogram(&SrcImage, & LhsImage, &DstImage, f32Phi, f32Psi);
// Display it
DstImage.Draw(pDC->GetSafeHdc( ));
3.8
Angle Unit
EGet/SetAngleUnit
enum E_ANGLE_UNITS EGetAngleUnit( );
Remarks
All angles are computed using some angular unit, as well on input as on output. The desired unit can
be changed at any time. By default, all angles are given in degrees (0..360).
EFromRadians
FLOAT32 EFromRadians(FLOAT32& f32Angle);
Returns the angle, converted from radians to the current angle unit.
91
Parameters
f32Angle
angle to be converted.
EToRadians
FLOAT32 EToRadians(FLOAT32& f32Angle);
3.9
angle to be converted.
Timing
EStartTiming / EStopTiming
void EStartTiming( );
Returns the time, in specified time units, elapsed since the last invocation of EStartTiming
Parameters
n32Resolution
Example
EStartTiming( );
// Process
...
// Elapsed time, in microseconds
n32Elapsed= EStopTiming(1000000);
ETrueTimingResolution
INT32 ETrueTimingResolution ( );
Returns the actual resolution of the timing clock, in ticks per seconds. Can be used to select an
appropriate timing resolution when using EStopTiming.
3.10 Licensing
SetOemKey
void SetOemKey(char key[8], Location::Type where=Location::Auto, INT32 index=-1);
92
Puts theOEM key key into an Eurecard or a Rainbow Sentinel Dongle non-volatile memory. If the
function cannot put the OEM key where specified, it raises an Euresys::eVision::Exception
exception.
Parameters
where
index
Remark
This function is declared into the Euresys::eVision::Licences namespace.
CheckOemKey
BOOL CheckOemKey(char key[8], Location::Type where=Location::Auto, INT32 index=-1);
Returns TRUE if the OEM key key could be found into an Eurecard or a Rainbow Sentinel Dongle nonvolatile memory, FALSE otherwise.
Parameters
where
index
Remark
This function is declared into the Euresys::eVision::Licences namespace.
enum Location::Type
Location::Auto
Use all types of holders.
Location::EureCard
Non-volatile memory holder is an Eurecard.
Location::SentinelDongle Non-volatile memory holder is a Rainbow Sentinel Dongle.
3.11 Miscellaneous
EGetVersion
CHAR* EGetVersion( );
Returns a pointer to a null terminated character string that contains the current version number of
eVision.
93
4.
ENUMERATION CONSTANTS
4.1
enum DATA_SIZE
= E_1_BIT_DATA bit.
E_8_BITS_PER_PIXEL
= E_8_BIT_DATA byte.
E_16_BITS_PER_PIXEL
= E_16_BIT_DATA word.
E_24_BITS_PER_PIXEL
= E_24_BIT_DATA 3 bytes.
E_32_BITS_PER_PIXEL
= E_32_BIT_DATA longword.
E_64_BITS_PER_PIXEL
= E_64_BIT_DATA quadword.
4.2
enum DATA_TYPE
Data types
E_DATA_TYPE_UNSIGNED_INT
unsigned integer.
E_DATA_TYPE_SIGNED_INT
signed integer.
E_DATA_TYPE_FLOAT
floating-point.
4.3
enum E_ANGLE_UNITS
Anglular modes
E_ANGLE_UNIT_REVOLUTIONS
E_ANGLE_UNIT_RADIANS
E_ANGLE_UNIT_DEGREES
E_ANGLE_UNIT_GRADES
4.4
enum E_MEASUREMENT_UNITS
Measurement units
E_UNIT_UM
micron
E_UNIT_MM
millimeter
E_UNIT_CM
centimeter
E_UNIT_DM
decimeter
E_UNIT_M
meter
E_UNIT_DAM
decameter
E_UNIT_HM
hectometer
E_UNIT_KM
kilometer
94
E_UNIT_MIL
1/1000 inch
E_UNIT_INCH
inch
E_UNIT_FOOT
foot
E_UNIT_YARD
yard
E_UNIT_MILE
mile
E_UNIT_UNKNOWN
unknown
4.5
enum E_FRAME_POSITION
E_FRAME_INSIDE
the outer edges of the frame remain totally inside the image/ROI.
E_FRAME_OUTSIDE
4.6
enum E_SELECTION_MODE
E_SELECTED_TRUE
E_SELECTED_FALSE
4.7
enum E_TRACE_MODE
E_TRACE_SILENT
no trace message.
E_TRACE_DISPLAY_MESSAGE
E_TRACE_DISPLAY_FULL_MESSAGE
4.8
enum E_HANDLES
No handle.
E_HANDLE_INSIDE
Inside handle.
E_HANDLE_NORTH
Northern handle.
E_HANDLE_EAST
Eastern handle.
E_HANDLE_SOUTH
Southern handle.
95
E_HANDLE_WEST
Western handle.
E_HANDLE_NORTH_WEST
North-Western handle.
E_HANDLE_SOUTH_WEST
South-Western handle.
E_HANDLE_NORTH_EAST
North-Eastern handle.
E_HANDLE_SOUTH_EAST
South-Eastern handle.
4.9
enum IMAGE_FILE_TYPES
E_FILE_FORMAT_BILEVEL_TIFF
uncompressed (Compression=None)
black and white (SamplesPerPixel=1,
BitsPerSample=1) TIFF.
E_FILE_FORMAT_GRAY_LEVEL_TIFF
uncompressed (Compression=None)
gray-level (SamplesPerPixel=1,
BitsPerSample=8 or 16) TIFF.
E_FILE_FORMAT_COLOR_TIFF
uncompressed (Compression=None)
color (SamplesPerPixel=3,
BitsPerSample=(8,8,8)) TIFF.
E_FILE_FORMAT_PACKED_BILEVEL_TIFF
compressed (Compression=PackBits)
black and white (SamplesPerPixel=1,
BitsPerSample=1) TIFF.
E_FILE_FORMAT_PACKED_GRAY_LEVEL_TIFF
compressed (Compression=PackBits)
gray-level (SamplesPerPixel=1,
BitsPerSample=8) TIFF.
E_FILE_FORMAT_BILEVEL_BMP
E_FILE_FORMAT_GRAY_LEVEL_BMP
uncompressed (Compression=BI_RGB)
gray-level (BitCount=8) Windows Bitmap.
E_FILE_FORMAT_COLOR_BMP
uncompressed (Compression=BI_RGB)
color (BitCount=24, 16 or 15) Windows
Bitmap.
E_FILE_FORMAT_GRAY_LEVEL_JPEG
E_FILE_FORMAT_COLOR_JPEG
Remarks
1. The following synonyms are obsolete:
E_FILE_FORMAT_TIFF
E_FILE_FORMAT_BMP
E_FILE_FORMAT_JPEG
2. A gray level image can be saved as a bilevel image. In this case, all pixel values below the TIFF
threshold area considered as black.
3. The TIFF files that are handled comply with the Baseline format described by the TIFF Revision 6.0
standard. In particular, the following tags are always used: ImageWidth, ImageLength, BitsPerSample,
Compression, PhotometricInterpretation, StripOffsets, RowsPerStrip, StripByteCounts, XResolution,
YResolution and ResolutionUnit. Multi-strip images are supported.
96
4. This software is based in part on the work of the Independent JPEG Group (IJG). The JPEG
compressed images are stored using the JFIF (JPEG File Interchange Format), as implemented by the
IJG JPEG library, Release 6a. We are grateful to them.
5. 15-bit and 16-bit BMP format are not supported by Windows.
bilevel image.
E_BW8
E_BW16
E_BW32
E_C15
E_C16
E_C24
E_C24A
The corresponding pixel types are obtained by removing the underscore character. For instance, an
EImageC24 has type value E_C24 and its pixels are typed as EC24.
E_STATE_INACTIVE
E_VECT_TYPE_HIST
E_VECT_TYPE_LUT_UINT8
E_VECT_TYPE_SEG
E_VECT_TYPE_PEAK
E_VECT_TYPE_MEASURE
E_VECT_TYPE_LUT_FLOAT32
97
5.
SAMPLE PROGRAMS
The available sample programs dedicated to the EasyImage library are the following:
ImgProjection: performs a vertical projection of an image and plots the resulting graph.
Shows how to use vectors and draw lines.
ImgRingWarp: reads the marking printed around the center of a CD by first retrieving the
position of the center of the CD, unwarping the marking and then performing the read.
ImgStatistics: plots the histogram and computes statistical parameters over a region of
interest. Shows how colors can be used to plot graphs.
Remarks
The corresponding projects for Microsoft Visual C++ can be found in the eVision\MsVc Samples subfolder, while the projects for Borland C++ Builder are located in the eVision\BcB Samples sub-folder.
98
1.
EASYIMAGE: INTRODUCTION
The EasyImage library contains a large number of general image processing functions. The following
categories are distinguished:
Arithmetic & logic: pixel-wise arithmetical and logical combinations between two images or between
an image and a constant;
Kernels
A kernel carries the required coefficients to perform a linear convolution operation. This includes an array
of floating-point coefficients of arbitrary dimensions, a global gain, a rectification mode and a global offset.
Before the global gain is applied, the coefficients are normalized so that their sum equals one, unless their
sum equals zero (as is the case for a gradient operator). The rectification enables to handle the negative
values that may appear after convolution.
There are essentially two ways of creating a kernel, either by specifying a predefined kernel type, or by
explicitly giving the desired kernel parameters:
EKernel SobelXKernel(E_SOBELX_KRNL); // Sobel X kernel
or
EKernel MyKernel(3, 2, 1.f, 0, DO_NOT_RECTIFY, 0);
// 3 x 2 kernel with unit global gain, no offset, no rectification,
// out-of-limits value is 0
MyKernel.SetKernelData(0, 0, 1.0f);
MyKernel.SetKernelData(1, 0, 2.0f);
MyKernel.SetKernelData(2, 0, 1.0f);
MyKernel.SetKernelData(0, 1, 1.0f);
MyKernel.SetKernelData(1, 1, 2.0f);
MyKernel.SetKernelData(2, 1, 1.0f);
// Kernel array of coefficients:
// 1 2 1
// 1 2 1
101
Note. Since optimized versions of the convolution operations exist, it is not necessary to create a
predefined kernel to perform the corresponding convolution. End of note.
Moving averages
When images are acquired in very noisy conditions, spatial filtering (low pass convolution or median filter)
may not be sufficient. In such cases, temporal averaging, also called integration, may be very effective:
rather than considering a single image, a sequence of N images are summed together so that noise
cancels out, and then averaged. Of course, this technique can be applied to still scenes only.
When applied navely, integration only generates one de-noised image every N captured image, so that
live display cannot be achieved. The moving average method consists in computing the average of the
last N acquired images, so that for each new input image, a de-noised image is output.
The EMovingAverage object implements the integration process and does it in such a way that processing
time remains very short and independent of N.
Two working modes (external and internal) are available depending on how the image buffers are
handled: either image acquisition is done separately in a distinct image (possibly in a user-defined buffer),
or the EMovingAverage object provides a image in which to acquire. In both modes, the EMovingAverage
object manages a set of internal buffers and performs the necessary bookkeeping.
Vectors
Some of the processing functions apply to or use vector rather than image data (1D instead of 2D).
Several vector classes are available and share the features of class EVectorTemplate.
The vectors support drawing methods that allow you to give them a graphical appearance. Two types of
representations exist:
graph of the vector data using the index as independent variable (X) and the vector element value as
the dependent value (Y). This applies vector types EBW8Vector, EBW16Vector, EBW32Vector,
EC24Vector and EBWHistogramVector. Such a plot is meant to appear on an empty background,
not on an image.
XY graph of the element coordinates. This applies for vector types EPath, EBW8Path, EBW16Path
and EC24Path, usually corresponding to contours. Such a plot is meant to appear on the source
image it came from.
Declare using
#include "EImage.h"
102
2.
2.1
EKernel
2.1.1
EKernel Overview
A kernel carries the required coefficients to perform a linear convolution operation. This includes an array
of floating-point coefficients of arbitrary dimensions, a global gain, a rectification mode and a global offset.
Before the global gain is applied, the coefficients are normalized so that their sum equals one, unless their
sum equals zero (as is the case for a derivation operator). The rectification enables to handle the negative
values that may appear after convolution.
There are essentially two ways of creating a kernel, either by specifying a predefined kernel type, or by
explicitly giving the desired kernel parameters:
EKernel SobelXKernel(E_SOBELX_KRNL); // Sobel X kernel
or
EKernel MyKernel(3, 2, 1.f, 0, DO_NOT_RECTIFY, 0);
// 3 x 2 kernel with unit global gain, no offset, no rectification,
// out-of-limits value is 0
MyKernel.SetKernelData(0, 0, 1.0f);
MyKernel.SetKernelData(1, 0, 2.0f);
MyKernel.SetKernelData(2, 0, 1.0f);
MyKernel.SetKernelData(0, 1, 1.0f);
MyKernel.SetKernelData(1, 1, 2.0f);
MyKernel.SetKernelData(2, 1, 1.0f);
// Kernel array of coefficients:
// 1 2 1
// 1 2 1
Note. Since optimized versions of the convolution operations exist, it is not necessary to create a
predefined kernel to perform the corresponding convolution. End of note.
Declare using
#include "EImage.h"
2.1.2
2.1.2.1
Construction
EKernel: Construction
EKernel::EKernel();
103
Parameters
KernelType
2.1.2.2
Convolution Coefficients
EKernel::GetDataPtr
FLOAT32* GetDataPtr();
EKernel::SetKernelData
INT16 EKernel::SetKernelData(INT32 n32DataX, INT32 n32DataY, FLOAT32 f32Data);
104
Parameters
f32Data00, ... f32Data22
2.1.2.3
Global parameters
EKernel::Get/SetGain
FLOAT32 EKernel::GetGain();
gain value.
Remarks
Before the global gain is applied, the coefficients are normalized so that their sum equals one, unless
their sum equals zero (as is the case for a derivation operator). The rectification enables to handle the
negative values that may appear after convolution.
105
EKernel::Get/SetOffset
UINT32 EKernel::GetOffset();
offset value.
EKernel::Get/SetOutsideValue
UINT32 EKernel::GetOutsideValue();
Return the out-of-limits image value (only influences the result along image edges).
VOID EKernel::SetOutsideValue(UINT32 un32OutsideValue);
Sets the out-of-limits image value (only influences the result along image edges).
Parameters
un32OutsideValue
EKernel::Get/SetRectifier
INT16 EKernel::GetRectifier();
2.1.2.4
Sizing
EKernel::Get/SetSizeX
INT16 EKernel::GetSizeX();
106
EKernel::Get/SetSizeY
INT16 EKernel::GetSizeY();
2.2
EMovingAverage
2.2.1
EMovingAverage Overview
The moving average operation performs temporal integration of a number of images to reduce noise.
Each time an image is acquired, it is accumulated to the previously acquired ones and the average image
is output. When noise between images is uncorrelated, the noise amplitude is reduced by a factor equal to
the square root of the number of images.
Two working modes (external and internal) are available depending on how the image buffers are
handled: either image acquisition is done separately in a distinct image (possibly in a user-defined buffer),
or the EMovingAverage object provides an image in which to acquire. In both modes, the
EMovingAverage object manages a set of internal buffers and performs the necessary bookkeeping.
To perform noise reduction, just call member Average.
Important note: when the number of images is a power of 2, processing is much faster.
Declare using
#include "EImage.h"
2.2.2
2.2.2.1
Construction
EmovingAverage: Construction
EMovingAverage();
107
Parameters
un32Period
n32Width
n32Height
bInternal
EMovingAverage::Get/SetSize
void GetSize(UINT32& un32Period, INT32& n32Width, INT32& n32Height, BOOL&
bInternal);
EMovingAverage::Get/SetSize
void GetSize(UINT32& un32Period, INT32& n32Width, INT32& n32Height, BOOL&
bInternal);
n32Height
bInternal
image height.
buffer allocation scheme. When TRUE, the moving average context
provides the image to be acquired into (see member GetSrcImage).
EMovingAverage::Reset
void Reset();
Restarts the average process as if no image had ever been handed to the EMovingAverage object.
(The behaviour is thus the same as after a EMovingAverage::SetSize operation).
EMovingAverage::Average/GetSrcImage
External mode
void Average(EROIBW8* pSrc, EROIBW8* pDst);
Performs averaging of the given source image with the preceding ones and computes the de-noised
image.
Parameters
pSrc
pDst
Example
EImageBW8 Src(512, 512), Dst(512, 512);
EMovingAverage MovingAverage(8, 512, 512, FALSE);
// Acquisition loop
...Acquire a new image into Src...
MovingAverage.Average(&Src, &Dst);
Internal mode
EImageBW8* GetSrcImage();
Performs averaging of the source image with the preceding ones and computes the de-noised image.
Parameters
pDst
Example
EImageBW8 * pSrc, Dst(512, 512);
EMovingAverage Average(8, 512, 512, TRUE);
// Acquisition loop
pSrc= MovingAverage.GetSrcImage();
...Acquire a new image into *pSrc...
Average.Average(&Dst);
109
EMovingAverage::Average/GetSrcImage
External mode
void Average(EROIBW8* pSrc, EROIBW8* pDst);
Performs averaging of the given source image with the preceding ones and computes the de-noised
image.
Parameters
pSrc pointer to the source image.
pDst pointer to the destination image.
Example
EImageBW8 Src(512, 512), Dst(512, 512);
EMovingAverage MovingAverage(8, 512, 512, FALSE);
// Acquisition loop
...Acquire a new image into Src...
MovingAverage.Average(&Src, &Dst);
Internal mode
EImageBW8* GetSrcImage();
Performs averaging of the source image with the preceding ones and computes the de-noised image.
Parameters
pDst pointer to the destination image.
Example
EImageBW8 * pSrc, Dst(512, 512);
EMovingAverage Average(8, 512, 512, TRUE);
// Acquisition loop
pSrc= MovingAverage.GetSrcImage();
...Acquire a new image into *pSrc...
Average.Average(&Dst);
110
3.
FUNCTIONS
Intensity Scale Transforms
ImgGainOffset
Applies gain and offset.
ImgNormalize
Adjusts gain and offset to normalize average and standard deviation.
ImgLut
Applies an user-defined transform stored as a lookup table.
ImgTransform
Applies an user-defined transform.
ImgUniformize
Corrects shading (to compensate non-uniform lighting).
Thresholding
ImgThreshold
ImgDoubleThreshold
ImgIsodataThreshold
ImgHistogramThreshold
ImgAutoThreshold
111
ImgConvolRoberts
ImgConvolUniform
ImgConvolGaussian
ImgModulusImage
ImgArgumentImage
ImgGradientScalar
Histograms
ImgHistogram
ImgCumulateHistogram
ImgAnalyseHistogram
112
ImgEqualize
ImgSetupEqualize
Contouring
ImgContour
Iso-level curve.
Projections
ImgProjectOnAColumn
ImgProjectOnARow
Statistics
ImgArea
ImgAreaDoubleThreshold
ImgGravityCenter
ImgBinaryMoments
ImgWeightedMoments
ImgCount
ImgPixelCount
ImgPixelAverage
ImgLocalAverage
ImgPixelStdDev
ImgLocalDeviation
ImgPixelVariance
ImgPixelMax
ImgPixelMin
ImgPixelStat
ImgPixelCompare
Noise reduction
ImgSignalNoiseRatio
Signal to noise ratio of an image.
ImgRmsNoise
Root mean square amplitude of noise in an image.
ImgSetRecursiveAverageLUT Sets up a non linear lookup table for use in noise reduction.
ImgRecursiveAverage
Reduces noise by recursive temporal filtering.
Conversions
ImgConvert
ImgConvertTo422
Vector operations
ImgSetupEqualize
ImgImageToLineSegment
ImgLineSegmentToImage
ImgImageToPath
ImgPathToImage
Histogram equalization.
Image data extraction along a line segment.
Image data modification along a line segment.
Image data extraction along a path.
Image data modification along a path.
113
ImgProfileDerivative
ImgGetProfilePeaks
ImgConvolUniform
Frame
ImgGet/SetFrame
ImgRebuildFrame
ImgRealignFrame
ImgMatchFrames
ImgSwapFrames
Miscellaneous
ImgFocusing
Declare using
#include "EImage.h"
3.1
ImgGainOffset
void ImgGainOffset(EROIBW8* pSrcImage, EROIBW8* pDstImage, FLOAT32 f32Gain= 1.f,
FLOAT32 f32Offset= 0.f);
void ImgGainOffset(EROIBW16* pSrcImage, EROIBW16* pDstImage, FLOAT32 f32Gain= 1.f,
FLOAT32 f32Offset= 0.f);
Transforms the gray levels of an image, applying a gain and offset to all pixels (new value = old value
times gain plus offset). The default values leave the image unchanged.
Parameters
pSrcImage
pDstImage
f32Gain
f32Offset
Example
ImgGainOffset(&SrcImage, &DstImage, 1.1f, 0.f);
void ImgGainOffset (EROIC24* pSrc, EROIC24* pDst, EColor Gain= EColor(1.f, 1.f,
1.f), EColor Offset= EColor(0.f, 0.f, 0.f));
Transforms the color components of an image, applying three separate gains and offsets to all pixels
(new value = old value times gain plus offset). The separate gain and offset values are specified a
triple of values stored in an EColor structure. The default values leave the image unchanged.
Parameters
pSrc
pDst
Gain
114
Offset
Example
// Halve all red component values
ImgGainOffset(&SrcImage, &DstImage, EColor(0.5f, 1, 1), EColor(0, 0, 0));
Declare using
#include "EImage.h"
ImgNormalize
void ImgNormalize(EROIBW8* pSrcImage, EROIBW8* pDstImage, FLOAT32 f32NewAverage,
FLOAT32 f32NewStdDev);
void ImgNormalize(EROIBW16* pSrcImage, EROIBW16* pDstImage, FLOAT32 f32NewAverage,
FLOAT32 f32NewStdDev);
Normalizes an image, i.e. applies a linear transform to the gray levels so that their average and
standard deviation are imposed.
Parameters
pSrcImage
pDstImage
f32NewAverage
f32NewStdDev
Example
EImageBW8 SrcImage, DstImage;
ImgNormalize(&SrcImage, &DstImage, 127.0, 32.0);
Declare using
#include "EImage.h"
ImgLut
void ImgLut(EROIBW8* pSrcImage, EROIBW8* pDstImage, EBW8Vector* pLut);
void ImgLut(EROIBW16* pSrcImage, EROIBW16* pDstImage, EBW16Vector* pLut);
void ImgLut(EROIBW16* pSrcImage, EROIBW8* pDstImage, EBW8Vector* pLut, UINT32
un32NumScalingBits= ~0);
Transforms the gray levels of an image, using a lookup table stored in a vector (of unsigned values).
A 16bits image usually does not make use of its 16 bits. In most cases, only 10 or 12 bits are used.
These bits are called significant bits. In the 16bits information, significant bits can be left aligned, right
aligned or not aligned at all. To indicate which are the significant bits, we have to tell how many bits are
significant and the number of right padding bits (0 right padding bits means that significant bits are right
aligned).
The number of significant bits is given by the number of Look Up table entries. For example a Lut of
1024 entries is used for an image of 10 significant bits (as the 10th power of 2 equals 1024).
The number of right padding bits is given by means of the un32NumScalingBits parameter. Leaving
this parameter undefined indicates that the significant bits are left aligned on the word.
115
Parameters
pSrcImage
pDstImage
pLut
un32NumScalingBits
Example
ImgLUT(&SrcImage, &DstImage, &LUTVector);
Declare using
#include "EImage.h"
ImgTransform
void ImgTransform(EROIBW8* pSrcImage, EROIBW8* pDstImage, EBW8 (*Transform)(EBW8
bw8Src), BOOL bUseLUT= TRUE);
void ImgTransform(EROIBW16* pSrcImage, EROIBW16* pDstImage, EBW16 (*Transform)(EBW16
bw16Src), BOOL bUseLUT= TRUE);
Transforms the gray levels of all pixels in an image, using a user-defined transform.
Parameters
pSrcImage
pDstImage
Transform
bUseLUT
Example
EBW8 Square(EBW8 bw8Src)
{ return bw8Src * bw8Src;
}
ImgTransform(&SrcImage, &DstImage, Square);
Declare using
#include "EImage.h"
ImgUniformize
Gray Level
Area scan
void ImgUniformize(EROIBW8* pSrc, EBW8 bw8LightReference, EROIBW8* pLightReference,
EBW8 bw8DarkReference, EROIBW8* pDarkReference, EROIBW8* pDst);
void ImgUniformize(EROIBW16* pSrc, EBW16 bw16LightReference, EROIBW16*
pLightReference, EBW16 bw16DarkReference, EROIBW16* pDarkReference, EROIBW16* pDst);
void ImgUniformize(EROIBW8* pSrc, EBW8 bw8Reference, EROIBW8* pReference, EROIBW8*
pDst, BOOL bMultiplicative= TRUE);
void ImgUniformize(EROIBW16* pSrc, EBW16 bw16Reference, EROIBW16* pReference,
EROIBW16* pDst, BOOL bMultiplicative= TRUE);
116
Line scan
void ImgUniformize(EROIBW8* pSrc, EBW8 bw8LightReference, EBW8Vector*
pLightReference, EBW8 bw8DarkReference, EBW8Vector* pDarkReference, EROIBW8* pDst);
void ImgUniformize(EROIBW16* pSrc, EBW16 bw16LightReference, EBW16Vector*
pLightReference, EBW16 bw16DarkReference, EBW16Vector* pDarkReference, EROIBW16*
pDst);
void ImgUniformize(EROIBW8* pSrc, EBW8 bw8Reference, EBW8Vector* pReference,
EROIBW8* pDst, BOOL bMultiplicative= TRUE);
void ImgUniformize(EROIBW16* pSrc, EBW16 bw16Reference, EBW16Vector* pReference,
EROIBW16* pDst, BOOL bMultiplicative= TRUE);
Color
Area scan
void ImgUniformize(EROIC24* pSrc, EC24 c24Reference, EROIC24* pReference, EROIC24*
pDst, BOOL bMultiplicative= TRUE);
void ImgUniformize(EROIC24* pSrc, EC24 c24LightReference, EROIC24* pLightReference,
EC24 c24DarkReference, EROIC24* pDarkReference, EROIC24* pDst);
Line scan
void ImgUniformize(EROIC24* pSrc, EC24 c24Reference, EC24Vector* pReference,
EROIC24* pDst, BOOL bMultiplicative= TRUE);
void ImgUniformize(EROIC24* pSrc, EC24 c24LightReference, EC24Vector*
pLightReference, EC24 c24DarkReference, EC24Vector* pDarkReference, EROIC24* pDst);
Shading correction is the process of transforming the gray or color component values of an image,
using one or two reference images or vectors. The intent is to compensate for non-uniform lighting or
sensor response non-uniformity by providing images of the background with no foreground object
present.
In the case of area-scan cameras, the illumination can change anywhere in the field of view, requiring
2D compensation. In the case of line-scan cameras imaging moving parts, illumination remains
constant across image rows. Only 1D compensation is required. In this case, the reference illumination
is specified as a vector, which is replicated across all image rows.
When a single reference image is used, the transform is analog to an adaptive (space-variant) gain or
offset (Gain * Intensity or Intensity + Offset); the transform lets the reference image(s) become a
specified constant value, i.e. flat field illumination.
When two reference images are used, the transform is analog to adaptive gain and offset (Gain *
Intensity + Offset); the transform let both reference images become specified constants, i.e. flat field
illumination with a correct black reference.
Note. The reference image(s) should be chosen such that they contain no saturated pixel values
(remain in the linear domain) and little (filtered out) noise. End of note.
Parameters
pSrc
pointer to the source image/ROI.
bw8(bw16 or c24)LightReference
constant value to transform the light reference image or vector into.
bw8(bw16 or c24)Reference constant value to transform the reference image or vector into.
pLightReference
pointer to the light reference source image/ROI or vector.
pReference
pointer to the reference source image/ROI or vector.
117
bw8(bw16 or c24)DarkReference
constant value to transform the dark reference image/ROI or vector into.
pDarkReference
pointer to the dark reference source image/ROI or vector.
pDst
pointer to the destination image/ROI.
bMultiplicative
True, if the transform is multiplicative (gain); False, if the transform is
additive (offset) (by default: bMultiplicative=TRUE).
Example
// Transforms the source so that the light reference is mapped to 200
// and the dark reference is mapped to 10
ImgUniformize(&SrcImage, 200, &LightImage, 10, & DarkImage, &DstImage);
Declare using
#include "EImage.h"
3.2
Thresholding
ImgThreshold
void ImgThreshold(EROIBW8* pSrcImage, EROIBW1* pDstImage, UINT32 un32Threshold=
IMG_MIN_RESIDUE_THRESHOLD, FLOAT32 f32RelativeThreshold= 0.5);
INT16 ImgThreshold(EROIBW8* pSrcImage, EROIBW8* pDstImage, UINT32 un32Threshold=
IMG_MIN_RESIDUE_THRESHOLD, UINT8 un8LowValue= 0, UINT8 un8HighValue= 255, FLOAT32
f32RelativeThreshold= 0.5);
void ImgThreshold(EROIBW16* pSrcImage, EROIBW16* pDstImage, UINT32 un32Threshold=
IMG_MIN_RESIDUE_THRESHOLD, EBW16 bw16LowValue= 0, EBW16 bw16HighValue= 65535,
FLOAT32 f32RelativeThreshold= 0.5);
Binarizes a gray-level image by setting all pixels below the threshold to a low value and all pixels
above or on the threshold to a high value. Several modes are available: absolute (the threshold value
is given), relative (the threshold value is computed to obtain a desired fraction of the image pixels) or
automatic (using three different criteria).
Parameters
pSrcImage
pDstImage
un32Threshold
un8(bw16)LowValue
un8(bw16)HighValue
f32RelativeThreshold
118
Example
// Absolute
ImgThreshold(&SrcImage, &DstImage, (enum IMG_THRESHOLD_MODES) 100, 10, 245);
// Relative (70 % black, 30 % white)
ImgThreshold(&SrcImage, &DstImage, IMG_RELATIVE_THRESHOLD, 0, 255, 0.7f);
// Automatic (minimum residue by default)
ImgThreshold(&SrcImage, &DstImage);
void ImgThreshold(EROIC24* pSrcImage, EROIBW8* pDstImage, EC24 c24Min, EC24 c24Max,
EColorLookup* pLookup, EBW8 un8RejectValue= 0, EBW8 un8AcceptValue= 255);
void ImgThreshold(EROIC24* pSrcImage, EROIBW8* pDstImage, EC24 c24Min, EC24 c24Max);
Binarizes a color image by setting all pixels whose components are comprised in a range of values
(mininum to maximum) to a constant value (white by default) and the other pixels to another constant
value (black by default) . If a color lookup is specified, it is applied "on the fly" to the color image before
thresholding.
The simpler overload does not support the use of an "on the fly" color lookup table nor Reject/Accept
Value arguments. On the other hand, it has been MMX optimized and will run significantly faster when
the acceptance region is large.
Parameters
pSrcImage
pDstImage
c24Min
c24Max
pLookup
un8RejectValue
un8AcceptValue
Examples
// Threshold in the RGB space
// Keep all pixels with RGB components not farther than 10 units from (45, 100, 20)
ImgThreshold(&SrcImage, &DstImage, EC24(45-10,100-10,20-10),
EC24(45+10,100+10,20+10));
// Threshold in the ISH space
// Use a conversion lookup table
EColorLookup Lookup;
Lookup.ConvertFromRGB(E_COLOR_SYSTEM_ISH);
// Keep all pixels with hue between 0 and 20, and any intensity or saturation
ImgThreshold(&SrcImage, &DstImage, EC24(0,0,0), EC24(255,255,20), &Lookup);
void ImgThreshold(EROIBW8* pSrcImage, EROIBW1* pDstImage, UINT32 un32Threshold);
Binarizes a gray-level image to a bilevel image by setting all pixels below the threshold to zero and all
pixels above the threshold to one.
Parameters
pSrcImage
pDstImage
un32Threshold
119
Example
ImgThreshold(&SrcImage, &DstImage, 100);
void ImgThreshold(EROIBW16* pSrcImage, EROIBW1* pDstImage, UINT32
un32Threshold=IMG_MIN_RESIDUE_THRESHOLD, FLOAT32 f32RelativeThreshold= 0.5);
Binarizes a gray-level image to a bilevel image by setting all pixels below the threshold to zero and all
pixels above the threshold to one. Several modes are available: absolute (the threshold value is given),
relative (the threshold value is computed to obtain a desired fraction of the image pixels) or automatic
(using three different criteria).
Parameters
pSrcImage
pDstImage
un32Threshold
f32RelativeThreshold
Example
ImgThreshold(&SrcImage, &DstImage, IMG_RELATIVE_THRESHOLD, 0.7f);
Declare using
#include "EImage.h"
ImgDoubleThreshold
INT16 ImgDoubleThreshold(EROIBW8* pSrcImage, EROIBW8* pDstImage, UINT32
un32LowThreshold, UINT32 un32HighThreshold, UINT8 un8LowValue=0, UINT8
un8MidValue=127, UINT8 un8HighValue=255);
void ImgDoubleThreshold(EROIBW16* pSrcImage, EROIBW16* pDstImage, UINT32
un32LowThreshold, UINT32 un32HighThreshold, EBW16 bw16LowValue=0, EBW16
bw16MidValue=32767, EBW16 bw16HighValue=65535);
Converts an image by setting all pixels below the low threshold to a low value, all pixels above the high
threshold to a high value, and the remaining pixels to an intermediate value.
Parameters
pSrcImage
pDstImage
un32LowThreshold
un32HighThreshold
un8(bw16)LowValue
un8(bw16)MidValue
un8(bw16)HighValue
Example
ImgDoubleThreshold(&SrcImage, &DstImage, 100, 200, 10, 127, 255);
120
Declare using
#include "EImage.h"
ImgIsodataThreshold
EBW8 ImgIsodataThreshold(EBWHistogramVector* pHistogram, UINT32 un32From= 0, UINT32
un32To= 255);
EBW16 ImgIsodataThresholdBW16(EBWHistogramVector* pHistogram, UINT32 un32From= 0,
UINT32 un32To= 65535);
Computes a suitable threshold value for a gray-level image. The "isodata" rule is used: if one computes
the average gray-level of pixels below the threshold and the average gray-level of pixels above the
threshold, the threshold lies exactly halfway between them. Optionaly, the threshold selection can be
restricted to a range of gray-level values.
Returns the threshold.
Parameters
pHistogram
un32From
un32To
Example
EImageBW8 Image;
EBWHistogramVector Histogram;
UINT32 un32Threshold;
// Compute the image histogram
ImgHistogram(&Image, &Histogram);
// Compute the optimal threshold
un32Threshold = ImgIsodataThreshold(&Histogram);
// Treshold the image
ImgThreshold(&Image, &Image, un32Threshold);
Declare using
#include "EImage.h"
ImgHistogramThreshold
void ImgHistogramThreshold(EBWHistogramVector* pHistogram, UINT32& un32Threshold,
FLOAT32& f32AverageBlack, FLOAT32& f32AverageWhite, FLOAT32 f32RelativeThreshold=
0.5f, UINT32 un32From= 0, UINT32 un32To= 255);
void ImgHistogramThresholdBW16(EBWHistogramVector* pHistogram, UINT32&
un32Threshold, FLOAT32& f32AverageBlack, FLOAT32& f32AverageWhite, FLOAT32
f32RelativeThreshold=0.5f, UINT32 un32From=0, UINT32 un32To=65535);
Determines an appropriate threshold level based on the histogram contents, using an automatic
threshold mode. Additionally, returns the average gray levels in the regions below and above the
threshold. The threshold level can be computed by analysing a range of gray-levels in the histogram.
121
Parameters
pHistogram
un32Threshold
f32AverageBlack
f32AverageWhite
f32RelativeThreshold
un32From
un32To
Example
EImageBW8 Image;
EBWHistogramVector Histogram;
UINT32 un32Threshold;
FLOAT32 f32AverageBlack;
FLOAT32 f32AverageWhite;
// Select the threshold mode
un32Threshold = IMG_MIN_RESIDUE_THRESHOLD;
// Compute the image histogram
ImgHistogram(&Image, &Histogram);
// Compute the threshold
ImgHistogramThreshold(&Histogram, un32Threshold, f32AverageBlack, f32AverageWhite);
// Threshold the image
ImgThreshold(&Image, &Image, un32Threshold);
Declare using
#include "EImage.h"
ImgAutoThreshold
EBW8 ImgAutoThreshold(EROIBW8* pSrc, enum IMG_THRESHOLD_MODES eThresholdMode,
FLOAT32 f32RelativeThreshold= 0.5);
EBW16 ImgAutoThreshold(EROIBW16* pSrc, enum IMG_THRESHOLD_MODES eThresholdMode,
FLOAT32 f32RelativeThreshold= 0.5);
Returns a suitable threshold value for a gray-level image binarization. Several modes are available:
relative (the threshold value is computed to obtain a desired fraction of the image pixels) or automatic
(using three different criteria).
Parameters
pSrc
eThresholdMode
f32RelativeThreshold
122
Example
EImageBW8 Image;
EBW8 un32Threshold;
//Compute the threshold
//Minimum residue
un32Threshold=ImgAutoThreshold(&Image, IMG_MIN_RESIDUE_THRESHOLD);
//Relative(70% black, 30% white)
un32Threshold=ImgAutoThreshold(&Image, IMG_RELATIVE_THRESHOLD, 0.7f);
Declare using
#include "EImage.h"
ImgTwoLevelsMinResidueThreshold
FLOAT32 ImgTwoLevelsMinResidueThreshold(EBWHistogramVector* pHistogram, EBW8&
ebw8FirstWhitePixelValue, FLOAT32& f32AverageBlack, FLOAT32& f32AverageWhite);
Computes the threshold value used to separate the pixels of an image in two classes. This value is
computed using the minimum residue criterion from the histogram of the image.
Parameters
pHistogram
ebw8FirstWhitePixelValue
f32AverageBlack
f32AverageWhite
Remark
Return value: the function returns the minimum residue as per the method. The residue is the Euclidian
distance between the source image and the thresholded image.
Declare using
#include "EImage.h"
ImgThreeLevelsMinResidueThreshold
FLOAT32 ImgThreeLevelsMinResidueThreshold(EBWHistogramVector* pHistogram, EBW8&
ebw8FirstGrayPixelValue, EBW8& ebw8FirstWhitePixelValue, FLOAT32& f32AverageBlack,
FLOAT32& f32AverageGray, FLOAT32& f32AverageWhite);
Computes the two threshold values used to separate the pixels of an image in three classes. These
values are computed using the minimum residue criterion from the histogram of the image.
Parameters
pHistogram
ebw8FirstGrayPixelValue
ebw8FirstWhitePixelValue
f32AverageBlack
f32AverageGray
f32AverageWhite
123
Remark
Return value: the function returns the minimum residue as per the method. The residue is the Euclidian
distance between the source image and the thresholded image.
Declare using
#include "EImage.h"
ImgMultiLevelsMinResidueThreshold
FLOAT32 ImgMultiLevelsMinResidueThreshold(EBWHistogramVector* pHistogram, UINT32
un32NumThreshold, Euresys::eVision::Utils::Vector<EBW8>& FirstPixelValue);
Using a minimum residue criterion, this function provides a list of suitable threshold values for a graylevel image labelization. The number 'un32NumThreshold' of thresholds being given, it computes the
best threshold values to classify the image pixel into 'un32NumThreshold + 1' groups.
Parameters
pHistogram
un32NumThreshold
FirstPixelValue
Example
EImageBW8 Image;
EBW8HistogramVector Histogram;
FLOAT32 f32Residue;
Euresys::eVision::Utils::Vector<EBW8> Threshold
// Compute the image histogram
ImgHistogram( &Image, &Histogram);
// Compute the 4 best thresholds that classify image pixels in 5 classes
f32Residue = ImgMultiLevelsMinResidueThreshold( &Histogram, 4, Threshold);
Declare using
#include "EImage.h"
3.3
ImgOper
Gray Level
BW1
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EBW1 bw1Const, EROIBW1* pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, const EROIBW1* pSrc, EROIBW1*
pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, const EROIBW1* pSrc0, const
EROIBW1* pSrc1, EROIBW1* pDst);
124
BW8
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EBW8 bw8Const, EROIBW8* pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EROIBW8* pSrc, EROIBW8* pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EBW8 bw8Const, EROIBW8* pSrc,
EROIBW8* pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EROIBW8* pSrc, EBW8 bw8Const,
EROIBW8* pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EROIBW8* pSrc0, EROIBW8* pSrc1,
EROIBW8* pDst);
BW16
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EBW16 bw16Const, EROIBW16*
pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EROIBW16* pSrc, EROIBW16*
pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EBW16 bw16Const, EROIBW16*
pSrc, EROIBW16* pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EROIBW16* pSrc, EBW16
bw16Const, EROIBW16* pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EROIBW16* pSrc0, EROIBW16*
pSrc1, EROIBW16* pDst);
Color
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EC24 c24Const, EROIC24* pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EROIC24* pSrc, EROIC24* pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EC24 c24Const, EROIC24* pSrc,
EROIC24* pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EROIC24* pSrc, EC24 c24Const,
EROIC24* pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EROIC24* pSrc0, EROIC24* pSrc1,
EROIC24* pDst);
Mixed
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EROIBW8* pSrc, EROIC24* pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EROIBW8* pSrc0, EROIBW8* pSrc1,
EROIBW16* pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EROIBW8* pSrc0, EROIBW8* pSrc1,
EROIC24* pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EROIBW8* pSrc0, EROIC24* pSrc1,
EROIC24* pDst);
void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EROIC24* pSrc0, EROIBW8* pSrc1,
EROIC24* pDst);
125
Applies the desired arithmetic or logic operator pixel-wise between two images or constants. The
source and destination images may be the same.
When the source operands are two color images/constants, the components are combined pair-wise;
the result is a color image.
When the source operands are a color image and a gray-level image, each color component is
combined with the gray-level component. The result is a color image.
The following combinations are allowed:
C
O
P
Y
I
N
V
E
R
T
S
H
I
F
T
L
O
G
I
C
A
L
S
E
T
O
V
E
R
L
A
Y
x
x
x
x
x
x
x
x
pSrc
pSrc0
pSrc1
bw1Const
126
Parameters
eOperation
O
t
h
e
r
s
bw8Const
bw16Const
c24Const
pDst
gray-level constant.
gray-level constant.
color constant.
pointer to the destination image/ROI.
Example
ImgOper(IMG_MULTIPLY, &SrcGray0, &SrcGray1, &DstGray);
ImgOper(IMG_MULTIPLY, &SrcGray0, 25, &DstGray);
ImgOper(IMG_ADD, &SrcColor, EC24(128,128,128), DstColor);
Declare using
#include "EImage.h"
ImgCopy
void ImgCopy( EROIBW1* pSrc, EROIBW1* pDst);
void ImgCopy( EROIBW8* pSrc, EROIBW8* pDst);
void ImgCopy( EROIBW16* pSrc, EROIBW16* pDst);
void ImgCopy( EROIC24* pSrc, EROIC24* pDst);
void ImgCopy( EROIC15* pSrc, EROIC15* pDst);
void ImgCopy( EROIC16* pSrc, EROIC16* pDst);
Example
EImageBW8 SrcImage, DstImage;
ImgCopy(SrcImage, DstImage);
void ImgCopy( EBW1 bw1Const, EROIBW1* pDst);
void ImgCopy( EBW8 bw8Const, EROIBW8* pDst);
void ImgCopy( EBW16 bw16Const, EROIBW16* pDst);
void ImgCopy( EC24 c24Const, EROIC24* pDst);
void ImgCopy( EC15 c15Const, EROIC15* pDst);
void ImgCopy( EC16 c16Const, EROIC16* pDst);
gray-level constant.
color constant.
pointer to the destination image/ROI.
Example
EImageBW8 DstImage;
ImgCopy(123, DstImage);
127
Declare using
#include "EImage.h"
Returns/Sets the color of the overlay in the destination image when a BW8 Image is used as overlay
source image in functions:
Parameters
c24Color
color of the overlay in the destination image.
Note. When a C24 Image is used as overlay source image, the color of the overlay in destination
image is the same as the one in the overlay source image, thus allowing multi colored overlays. End of
Note.
Declare using
#include "EImage.h"
3.4
ImgConvolKernel
void ImgConvolKernel(EROIBW8* pSrcImage, EROIBW8* pDstImage, EKernel* pKernel);
void ImgConvolKernel(EROIBW16* pSrcImage, EROIBW16* pDstImage, EKernel* pKernel);
void ImgConvolKernel(EROIC24* pSrcImage, EROIC24* pDstImage, EKernel* pKernel);
Declare using
#include "EImage.h"
ImgConvolSymmetricKernel
void ImgConvolSymmetricKernel (EROIBW8* pSrcImage, EROIBW8* pDstImage, EKernel*
pKernel);
128
Performs a convolution in image space, i.e. applies a square symmetric convolution kernel of size 3x3,
5x5 or 7x7.
Parameters
pSrcImage
pDstImage
pKernel
Example
ImgConvolSymmetricKernel(&SrcImage, &DstImage, pKernel);
Remarks
This function is faster than ImgConvolKernel.
Declare using
#include "EImage.h"
ImgConvolHighpass1
void ImgConvolHighpass1(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolHighpass1(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolHighpass1(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
Example
ImgConvolHighpass1(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgConvolHighpass2
void ImgConvolHighpass2(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolHighpass2(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolHighpass2(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
129
Example
ImgConvolHighpass2(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgConvolLaplacianX
void ImgConvolLaplacianX(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolLaplacianX(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolLaplacianX(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
Example
ImgConvolLaplacianX(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgConvolLaplacianY
void ImgConvolLaplacianY(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolLaplacianY(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolLaplacianY(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
130
Example
ImgConvolLaplacianY(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgConvolLaplacian4
void ImgConvolLaplacian4(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolLaplacian4(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolLaplacian4(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
Example
ImgConvolLaplacian4(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgConvolLaplacian8
void ImgConvolLaplacian8(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolLaplacian8(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolLaplacian8(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
Example
ImgConvolLaplacian8(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgConvolLowpass1
void ImgConvolLowpass1(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
131
Example
ImgConvolLowpass1(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgConvolLowpass2
void ImgConvolLowpass2(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolLowpass2(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolLowpass2(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
Example
ImgConvolLowpass2(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgConvolLowpass3
void ImgConvolLowpass3(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolLowpass3(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolLowpass3(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
132
Parameters
pSrcImage
pDstImage
Example
ImgConvolLowpass3(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgConvolGradientX
void ImgConvolGradientX(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolGradientX(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolGradientX(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
Example
ImgConvolGradientX(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgConvolGradientY
void ImgConvolGradientY(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolGradientY(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolGradientY(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
Example
ImgConvolGradientY(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
133
ImgConvolGradient
void ImgConvolGradient(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolGradient(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolGradient(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
Extracts the edges of an image by summing the absolute values of the Gradient X and Gradient Y
derivatives.
Parameters
pSrcImage
pDstImage
Example
ImgConvolGradient(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgConvolPrewittX
void ImgConvolPrewittX(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolPrewittX(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolPrewittX(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
Example
ImgConvolPrewittX(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgConvolPrewittY
void ImgConvolPrewittY(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolPrewittY(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolPrewittY(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
134
Parameters
pSrcImage
pDstImage
Example
ImgConvolPrewittY(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgConvolPrewitt
void ImgConvolPrewitt(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolPrewitt(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolPrewitt(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
Extracts the edges of an image by summing the absolute values of the Prewitt X and Prewitt Y
derivatives.
Parameters
pSrcImage
pDstImage
Example
ImgConvolPrewitt(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgConvolSobelX
void ImgConvolSobelX(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolSobelX(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolSobelX(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
Example
ImgConvolSobelX(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
135
ImgConvolSobelY
void ImgConvolSobelY(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolSobelY(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolSobelY(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
Example
ImgConvolSobelY(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgConvolSobel
void ImgConvolSobel(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolSobel(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolSobel(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
Extracts the edges of an image by summing the absolute values of the Sobel X and Sobel Y
derivatives.
Parameters
pSrcImage
pDstImage
Example
ImgConvolSobel(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgConvolRoberts
void ImgConvolRoberts(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolRoberts(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolRoberts(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);
The Roberts edge extraction filter is based on a 2x2 kernel. It computes the sum of absolute
differences of the pixel values in the diagonal directions.
136
Parameters
pSrcImage
pDstImage
Declare using
#include "EImage.h"
ImgConvolUniform
void ImgConvolUniform(EROIBW8* pSrcImage, EROIBW8* pDstImage = NULL, UINT32
un32HalfWidth=1, UINT32 un32HalfHeight= ~0);
void ImgConvolUniform(EROIBW16* pSrcImage, EROIBW16* pDstImage = NULL, UINT32
un32HalfWidth=1, UINT32 un32HalfHeight= ~0);
void ImgConvolUniform(EROIC24* pSrcImage, EROIC24* pDstImage = NULL, UINT32
un32HalfWidth=1, UINT32 un32HalfHeight= ~0);
Applies strong lowpass filtering to an image by using a uniform rectangular kernel of odd size. This
filter replaces every pixel values by the arithmetic mean of the neighbouring values in a rectangular
window. To handle pixels along edges, the source pixels are replicated outwards as many times as
required.
A very nice feature of this function is that its running time does not depend on the kernel size !
Parameters
pSrcImage
pDstImage
un32HalfWidth
un32HalfHeight
Example
// Average image in 5x5 neighborhoods
ImgConvolUniform(&SrcImage, &DstImage, 2);
Declare using
#include "EImage.h"
ImgConvolGaussian
void ImgConvolGaussian(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL, UINT32
un32Halfwidth= 1, UINT32 un32HalfHeight= ~0);
void ImgConvolGaussian(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL, UINT32
un32Halfwidth= 1, UINT32 un32HalfHeight= ~0);
void ImgConvolGaussian(EROIC24* pSrcImage, EROIC24* pDstImage= NULL, UINT32
un32Halfwidth= 1, UINT32 un32HalfHeight= ~0);
137
pDstImage
un32HalfWidth
un32HalfHeight
Example
// Gaussian filtering in 3x3 neighborhoods
ImgConvolGaussian(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgModulusImage
void ImgModulusImage(EImageBW8* pDst, FLOAT32 f32Gain= 1.f);
void ImgModulusImage(EImageBW16* pDst, FLOAT32 f32Gain= 1.f);
Prepares a lookup-table image for use for gradient magnitude computation. The modulus of the
gradient argument can be adjusted to avoid saturation.
Parameters
pDst
f32Gain
Remarks
ImgModulusImage sets a lookup-table image for use with function ImgGradientScalar, ready to
compute the modulus of the gradient in the source image, i.e. its amplitude (as defined by the
Euclidean norm). The argument will be returned as a value in range 0..255 suitable for storage in an
EImageBW8 or as a value in range 0..65535 suitable for storage in an EImageBW16. A gain
coefficient can be adjusted to avoid saturation (gain = 1 saturates gradient amplitudes larger than 255
in the BW8 case and 65535 in the BW16 one; gain = 1 / Sqrt(2) never saturates).
Declare using
#include "EImage.h"
ImgArgumentImage
void ImgArgumentImage(EImageBW8* pDst, EBW8 bw8Phase= 0, FLOAT32 f32Period= 0);
void ImgArgumentImage(EImageBW16* pDst, EBW16 bw16Phase= 0, FLOAT32 f32Period= 0);
138
f32Period
Remarks
ImgArgumentImage sets a lookup-table image for use with function ImgGradientScalar, ready to
compute the argument of the gradient in the source image, i.e. its direction. The argument will be
returned as a value in range 0..255 suitable for storage in an EImageBW8 or as a value in the range
0..65535 suitable for storage in an EImageBW16. The phase of the argument can be adjusted.
Example
// Argument on a full turn (360),
// starting to the right (phase is 0)
ImgArgumentImage(&Lut);
// Argument on a full turn (360),
// starting downwards (phase is 90, i.e. 64/256 of the period)
ImgArgumentImage(&Lut, 64);
// Argument on a half turn (180),
// starting to the right (period is 180, phase is 0)
ImgArgumentImage(&Lut, 0, 180.f);
Declare using
#include "EImage.h"
ImgGradientScalar
void ImgGradientScalar(EROIBW8* pSrc, EROIBW8* pDst, EROIBW8* pLut);
void ImgGradientScalar(EROIBW16* pSrc, EROIBW16* pDst, EROIBW16* pLut);
Computes the (scalar) gradient image derived from a given source image. The scalar value derived
from the gradient depends on the preset lookup-table image.
Parameters
pSrc
pDst
pLut
Remarks
The gradient of a gray-scale image corresponds to a vector, the components of which are the partial
derivatives of the gray-level signal in the horizontal and vertical direction. A vector can be
characterized by a direction and a length, corresponding to the gradient orientation, here called
argument, and the gradient magnitude, here called magnitude.
Function ImgGradientScalar generates a gradient direction or gradient magnitude map (gray-level
image) from a given gray-level image. For efficiency, a pre-computed lookup-table is used to define the
desired transformation. This lookup-table is stored as a standard EImageBW8/BW16. Use one of
ImgArgumentImage or ImgModulusImage once before calling ImgGradientScalar.
Declare using
#include "EImage.h"
139
3.5
ImgOpenBox
void ImgOpenBox(EROIBW1* pSrc, EROIBW1* pDst= NULL, UINT32 un32HalfWidth= 1, UINT32
un32HalfHeight= ~0);
void ImgOpenBox(EROIBW8* pSrc, EROIBW8* pDst= NULL, UINT32 un32HalfWidth= 1, UINT32
un32HalfHeight= ~0);
void ImgOpenBox(EROIBW16* pSrc, EROIBW16* pDst= NULL, UINT32 un32HalfWidth= 1,
UINT32 un32HalfHeight= ~0);
void ImgOpenBox(EROIC24* pSrc, EROIC24* pDst= NULL, UINT32 un32HalfWidth= 1, UINT32
un32HalfHeight= ~0);
Example
ImgOpenBox(&SrcImage, &DstImage, 3, 2);
Remarks
Box size of half width = 3 and half height = 2:
Declare using
#include "EImage.h"
ImgOpenDisk
void ImgOpenDisk(EROIBW1* pSrc, EROIBW1* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgOpenDisk(EROIBW8* pSrc, EROIBW8* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgOpenDisk(EROIBW16* pSrc, EROIBW16* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgOpenDisk(EROIC24* pSrc, EROIC24* pDst= NULL, UINT32 un32HalfWidth= 1);
140
Parameters
pSrc
pDst
un32HalfWidth
Example
ImgOpenDisk(&SrcImage, &DstImage, 2);
Remarks
Kernel size of half width = 2:
Declare using
#include "EImage.h"
ImgCloseBox
void ImgCloseBox(EROIBW1* pSrc, EROIBW1* pDst= NULL, UINT32 un32HalfWidth= 1, UINT32
un32HalfHeight= ~0);
void ImgCloseBox(EROIBW8* pSrc, EROIBW8* pDst= NULL, UINT32 un32HalfWidth= 1, UINT32
un32HalfHeight= ~0);
void ImgCloseBox(EROIBW16* pSrc, EROIBW16* pDst= NULL, UINT32 un32HalfWidth= 1,
UINT32 un32HalfHeight= ~0);
void ImgCloseBox(EROIC24* pSrc, EROIC24* pDst= NULL, UINT32 un32HalfWidth= 1, UINT32
un32HalfHeight= ~0);
Example
ImgCloseBox(&SrcImage, &DstImage, 1, 2);
Declare using
#include "EImage.h"
141
ImgCloseDisk
void ImgCloseDisk(EROIBW1* pSrc, EROIBW1* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgCloseDisk(EROIBW8* pSrc, EROIBW8* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgCloseDisk(EROIBW16* pSrc, EROIBW16* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgCloseDisk(EROIC24* pSrc, EROIC24* pDst= NULL, UINT32 un32HalfWidth= 1);
Example
ImgCloseDisk(&SrcImage, &DstImage, 2);
Declare using
#include "EImage.h"
ImgDilateBox
void ImgDilateBox(EROIBW1* pSrc, EROIBW1* pDst= NULL, UINT32 un32HalfWidth= 1,
UINT32 un32HalfHeight= ~0);
void ImgDilateBox(EROIBW8* pSrc, EROIBW8* pDst= NULL, UINT32 un32HalfWidth= 1,
UINT32 un32HalfHeight= ~0);
void ImgDilateBox(EROIBW16* pSrc, EROIBW16* pDst= NULL, UINT32 un32HalfWidth= 1,
UINT32 un32HalfHeight= ~0);
void ImgDilateBox(EROIC24* pSrc, EROIC24* pDst= NULL, UINT32 un32HalfWidth= 1,
UINT32 un32HalfHeight= ~0);
Example
ImgDilateBox(&SrcImage, &DstImage, 1, 2);
Declare using
#include "EImage.h"
142
ImgDilateDisk
void ImgDilateDisk(EROIBW1* pSrc, EROIBW1* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgDilateDisk(EROIBW8* pSrc, EROIBW8* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgDilateDisk(EROIBW16* pSrc, EROIBW16* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgDilateDisk(EROIC24* pSrc, EROIC24* pDst= NULL, UINT32 un32HalfWidth= 1);
Performs a dilation on an image (maximum of the gray values in a defined neighborhood) on a quasicircular kernel.
Parameters
pSrc
pDst
un32HalfWidth
Example
ImgDilateDisk(&SrcImage, &DstImage, 2);
Declare using
#include "EImage.h"
ImgErodeBox
void ImgErodeBox(EROIBW1* pSrc, EROIBW1* pDst= NULL, UINT32 un32HalfWidth= 1, UINT32
un32HalfHeight= ~0);
void ImgErodeBox(EROIBW8* pSrc, EROIBW8* pDst= NULL, UINT32 un32HalfWidth= 1, UINT32
un32HalfHeight= ~0);
void ImgErodeBox(EROIBW16* pSrc, EROIBW16* pDst= NULL, UINT32 un32HalfWidth= 1,
UINT32 un32HalfHeight= ~0);
void ImgErodeBox(EROIC24* pSrc, EROIC24* pDst= NULL, UINT32 un32HalfWidth= 1, UINT32
un32HalfHeight= ~0);
Example
ImgErodeBox(&SrcImage, &DstImage, 1, 2);
Declare using
#include "EImage.h"
143
ImgErodeDisk
void ImgErodeDisk(EROIBW1* pSrc, EROIBW1* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgErodeDisk(EROIBW8* pSrc, EROIBW8* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgErodeDisk(EROIBW16* pSrc, EROIBW16* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgErodeDisk(EROIC24* pSrc, EROIC24* pDst= NULL, UINT32 un32HalfWidth= 1);
Performs an erosion on an image (minimum of the gray values in a defined neighborhood) on a quasicircular kernel.
Parameters
pSrc
pDst
un32HalfWidth
Example
ImgErodeDisk(&SrcImage, &DstImage, 2);
Declare using
#include "EImage.h"
ImgWhiteTopHatBox
void ImgWhiteTopHatBox(EROIBW1* pSrc, EROIBW1* pDst, UINT32 un32HalfWidth= 1, UINT32
un32HalfHeight= ~0);
void ImgWhiteTopHatBox(EROIBW8* pSrc, EROIBW8* pDst, UINT32 un32HalfWidth= 1, UINT32
un32HalfHeight= ~0);
void ImgWhiteTopHatBox(EROIBW16* pSrc, EROIBW16* pDst, UINT32 un32HalfWidth= 1,
UINT32 un32HalfHeight= ~0);
void ImgWhiteTopHatBox(EROIC24* pSrc, EROIC24* pDst, UINT32 un32HalfWidth= 1, UINT32
un32HalfHeight= ~0);
Performs a top-hat filtering on an image (source image minus opened image) on a rectangular kernel.
This filter enhances the thin white features.
Parameters
pSrc
pDst
un32HalfWidth
un32HalfHeight
Example
ImgWhiteTopHatBox(&SrcImage, &DstImage, 1, 2);
Declare using
#include "EImage.h"
144
ImgWhiteTopHatDisk
void ImgWhiteTopHatDisk(EROIBW1* pSrc, EROIBW1* pDst, UINT32 un32HalfWidth= 1);
void ImgWhiteTopHatDisk(EROIBW8* pSrc, EROIBW8* pDst, UINT32 un32HalfWidth= 1);
void ImgWhiteTopHatDisk(EROIBW16* pSrc, EROIBW16* pDst, UINT32 un32HalfWidth= 1);
void ImgWhiteTopHatDisk(EROIC24* pSrc, EROIC24* pDst, UINT32 un32HalfWidth= 1);
Performs a top-hat filtering on an image (source image minus opened image) on a quasi-circular
kernel. This filter enhances the thin white features.
Parameters
pSrc
pDst
un32HalfWidth
Example
ImgWhiteTopHatDisk(&SrcImage, &DstImage, 2);
Declare using
#include "EImage.h"
ImgBlackTopHatBox
void ImgBlackTopHatBox(EROIBW1* pSrc, EROIBW1* pDst, UINT32 un32HalfWidth= 1, UINT32
un32HalfHeight= ~0);
void ImgBlackTopHatBox(EROIBW8* pSrc, EROIBW8* pDst, UINT32 un32HalfWidth= 1, UINT32
un32HalfHeight= ~0);
void ImgBlackTopHatBox(EROIBW16* pSrc, EROIBW16* pDst, UINT32 un32HalfWidth= 1,
UINT32 un32HalfHeight= ~0);
void ImgBlackTopHatBox(EROIC24* pSrc, EROIC24* pDst, UINT32 un32HalfWidth= 1, UINT32
un32HalfHeight= ~0);
Performs a top-hat filtering on an image (closed image minus source image) on a rectangular kernel.
This filter enhances the thin black features.
Parameters
pSrc
pDst
un32HalfWidth
un32HalfHeight
Example
ImgBlackTopHatBox(&SrcImage, &DstImage, 1, 2);
Declare using
#include "EImage.h"
145
ImgBlackTopHatDisk
void ImgBlackTopHatDisk(EROIBW1* pSrc, EROIBW1* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgBlackTopHatDisk(EROIBW8* pSrc, EROIBW8* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgBlackTopHatDisk(EROIBW16* pSrc, EROIBW16* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgBlackTopHatDisk(EROIC24* pSrc, EROIC24* pDst= NULL, UINT32 un32HalfWidth= 1);
Performs a top-hat filtering on an image (closed image minus source image) on a quasi-circular kernel.
This filter enhances the thin black features.
Parameters
pSrc
pDst
un32HalfWidth
Example
ImgBlackTopHatDisk(&SrcImage, &DstImage, 2);
Declare using
#include "EImage.h"
ImgMorphoGradientBox
void ImgMorphoGradientBox(EROIBW1* pSrc, EROIBW1* pDst= NULL, UINT32 un32HalfWidth=
1, UINT32 un32HalfHeight= ~0);
void ImgMorphoGradientBox(EROIBW8* pSrc, EROIBW8* pDst= NULL, UINT32 un32HalfWidth=
1, UINT32 un32HalfHeight= ~0);
void ImgMorphoGradientBox(EROIBW16* pSrc, EROIBW16* pDst= NULL, UINT32
un32HalfWidth= 1, UINT32 un32HalfHeight= ~0);
void ImgMorphoGradientBox(EROIC24* pSrc, EROIC24* pDst= NULL, UINT32 un32HalfWidth=
1, UINT32 un32HalfHeight= ~0);
146
Example
// 3 x 5 rectangular kernel
ImgMorphoGradientBox(&SrcImage, &DstImage, 1, 2);
Declare using
#include "EImage.h"
ImgMorphoGradientDisk
void ImgMorphoGradientDisk(EROIBW1* pSrc, EROIBW1* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgMorphoGradientDisk(EROIBW8* pSrc, EROIBW8* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgMorphoGradientDisk(EROIBW16* pSrc, EROIBW16* pDst= NULL, UINT32 un32HalfWidth= 1);
void ImgMorphoGradientDisk(EROIC24* pSrc, EROIC24* pDst= NULL, UINT32 un32HalfWidth= 1);
Example
// Disk of diameter 5 pixels
ImgMorphoGradientDisk(&SrcImage, &DstImage, 2);
Declare using
#include "EImage.h"
ImgMedian
void ImgMedian(EROIBW1* pSrcImage, EROIBW1* pDstImage);
void ImgMedian(EROIBW8* pSrcImage, EROIBW8* pDstImage);
void ImgMedian(EROIBW16* pSrcImage, EROIBW16* pDstImage);
Applies a median filter to an image (median of the gray values in a 3x3 neighborhood).
Parameters
pSrcImage
pDstImage
Example
ImgMedian(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
147
ImgThick
void ImgThick(EROIBW1* pSrcImage, EROIBW1* pDstImage, EKernel* pThickKernel, enum
KERNEL_ROTATION Mode, INT32& n32Iter);
void ImgThick(EROIBW8* pSrcImage, EROIBW8* pDstImage, EKernel* pThickKernel, enum
KERNEL_ROTATION Mode, INT32& n32Iter);
void ImgThick(EROIBW16* pSrcImage, EROIBW16* pDstImage, EKernel* pThickKernel, enum
KERNEL_ROTATION Mode, INT32& n32Iter);
void ImgThick(EROIC24* pSrcImage, EROIC24* pDstImage, EKernel* pThickKernel, enum
KERNEL_ROTATION Mode, INT32& n32Iter);
Applies a thickening operation on an image, using a 3x3 kernel. The thickening kernel coefficients must be
0 (matching black pixel, value 0), 1 (matching non black pixel, value>0) or -1 (don't care). When a match is
found between the kernel coefficients and the neighborhood of a pixel, the pixel value is set to 255.
Parameters
pSrcImage
pDstImage
pThickKernel
Mode
n32Iter
Example
n32Iter = 1;
ImgThick(&SrcImage, &DstImage, &Kernel, ANTICLOCKWISE_ROTATION, n32Iter);
Declare using
#include "EImage.h"
ImgThin
void ImgThin(EROIBW1* pSrcImage, EROIBW1* pDstImage, EKernel* pThinKernel, enum
KERNEL_ROTATION Mode, INT32& n32Iter);
void ImgThin(EROIBW8* pSrcImage, EROIBW8* pDstImage, EKernel* pThinKernel, enum
KERNEL_ROTATION Mode, INT32& n32Iter);
void ImgThin(EROIBW16* pSrcImage, EROIBW16* pDstImage, EKernel* pThinKernel, enum
KERNEL_ROTATION Mode, INT32& n32Iter);
void ImgThin(EROIC24* pSrcImage, EROIC24* pDstImage, EKernel* pThinKernel, enum
KERNEL_ROTATION Mode, INT32& n32Iter);
Applies a thinning operation on an image, using a 3x3 kernel. The thinning kernel coefficients must be 0
(matching black pixel, value 0), 1 (matching non black pixel, value>0) or -1 (don't care). When a match
is found between the kernel coefficients and the neighborhood of a pixel, the pixel value is set to 0.
Parameters
pSrcImage
pDstImage
148
pThinKernel
Mode
n32Iter
Example
n32Iter = 1;
ImgThin(&SrcImage, &DstImage, &Kernel, ANTICLOCKWISE_ROTATION, n32Iter);
Declare using
#include "EImage.h"
ImgDistance
void ImgDistance(EROIBW8* pSrcImage, EImageBW16* pDstImage, INT32 n32ValOut=0);
Computes the morphological distance function on a binary image (0 for black, non 0 for white). So,
each pixel of the destination image will contain, at the end of the processing, the morphological
distance of the corresponding pixel in the source image. The distance function at a given pixel tells
how many erosion passes are required to set it to black.
Parameters
pSrcImage
pDstImage
n32ValOut
Example
ImgDistance(&SrcImage, &DstImage, 0);
Declare using
#include "EImage.h"
3.6
Geometric transforms
ImgRegister
Registration is the process of realigning two misaligned images so that point-to-point comparisons are
possible. The simplest way to achieve this is to accurately locate features in both images (landmarks or
pivots), using pattern matching, point measurement or whatever other technique, and realign one of the
images so that the landmarks are superimposed.
When a single pivot point is used, the registration transform is a simple translation. If interpolation bits are
used, sub-pixel translation is achieved.
When two pivot points are used, the registration is a combination of translation, rotation and optionally
scaling. If scaling is not allowed, the second pivot point will not be matched exactly in general. Anyway, for
most applications scaling should not be used unless it corresponds to a change of lens magnification or
viewing distance.
When three pivot points are used, the registration is a combination of translation, rotation, shearing
correction and optionally scaling. The so-called shear effect can arise when acquiring images with a
misaligned line-scan camera.
To achieve good accuracy, the pivot points should be chosen as far apart as possible.
149
Three pivots registration (translation, rotation, shearing correction and optional scaling)
void ImgRegister(EROIBW8* pSrcImage, EROIBW8* pDstImage, FLOAT32 f32SrcPivot0X,
FLOAT32 f32SrcPivot0Y, FLOAT32 f32SrcPivot1X, FLOAT32 f32SrcPivot1Y, FLOAT32
f32SrcPivot2X, FLOAT32 f32SrcPivot2Y, FLOAT32 f32DstPivot0X, FLOAT32 f32DstPivot0Y,
FLOAT32 f32DstPivot1X, FLOAT32 f32DstPivot1Y, FLOAT32 f32DstPivot2X, FLOAT32
f32DstPivot2Y, INT32 n32InterpolationBits= 0);
void ImgRegister(EROIBW16* pSrcImage, EROIBW16* pDstImage, FLOAT32 f32SrcPivot0X,
FLOAT32 f32SrcPivot0Y, FLOAT32 f32SrcPivot1X, FLOAT32 f32SrcPivot1Y, FLOAT32
f32SrcPivot2X, FLOAT32 f32SrcPivot2Y, FLOAT32 f32DstPivot0X, FLOAT32 f32DstPivot0Y,
FLOAT32 f32DstPivot1X, FLOAT32 f32DstPivot1Y, FLOAT32 f32DstPivot2X, FLOAT32
f32DstPivot2Y, INT32 n32InterpolationBits= 0);
void ImgRegister(EROIC24* pSrcImage, EROIC24* pDstImage, FLOAT32 f32SrcPivot0X,
FLOAT32 f32SrcPivot0Y, FLOAT32 f32SrcPivot1X, FLOAT32 f32SrcPivot1Y, FLOAT32
f32SrcPivot2X, FLOAT32 f32SrcPivot2Y, FLOAT32 f32DstPivot0X, FLOAT32 f32DstPivot0Y,
FLOAT32 f32DstPivot1X, FLOAT32 f32DstPivot1Y, FLOAT32 f32DstPivot2X, FLOAT32
f32DstPivot2Y, INT32 n32InterpolationBits= 0);
Registers an image by realigning one, two or three pivot points to reference positions.
Out-of-image-bounds pixels are black.
Parameters
pSrcImage
pDstImage
f32SrcPivot0X
f32SrcPivot0
f32SrcPivot1X
150
f32SrcPivot1Y
f32SrcPivot2X
f32SrcPivot2Y
f32DstPivot0X
f32DstPivot0Y
f32DstPivot1X
f32DstPivot1Y
f32DstPivot2X
f32DstPivot2Y
n32InterpolationBits
bResize
Example
EImageBW8 Src(512, 512), Dst(512, 512);
// Realign by moving (10, 10) and (520, 520) to image corners
// No interpolation nor scaling
ImgRegister(&Src, &Dst, 10.f, 10.f, 520.f, 520.f, 0.f, 0.f, 511.f, 511.f);
Declare using
#include "EImage.h"
ImgHorizontalMirror
void ImgHorizontalMirror(EROIBW8* pSrcImage);
void ImgHorizontalMirror(EROIBW16* pSrcImage);
void ImgHorizontalMirror(EROIC24* pSrcImage);
Example
EImageBW8 Image;
ImgHorizontalMirror(&Image);
Declare using
#include "EImage.h"
ImgVerticalMirror
void ImgVerticalMirror(EROIBW8* pSrcImage);
void ImgVerticalMirror(EROIBW16* pSrcImage);
void ImgVerticalMirror(EROIC24* pSrcImage);
151
Parameters
pSrcImage
Example
EImageBW8 Image;
ImgVerticalMirror(&Image);
Declare using
#include "EImage.h"
ImgSetCircleWarp
void ImgSetCircleWarp(FLOAT32 f32XCenter, FLOAT32 f32YCenter, INT32 n32NumCircles,
FLOAT32 f32MinRadius, FLOAT32 f32MaxRadius, INT32 n32NumRadii, FLOAT32 f32MinAngle,
FLOAT32 f32MaxAngle, EImageBW16* pWarpXImage, EImageBW16* pWarpYImage);
Prepares suitable warp images for use with function ImgWarp to unwarp a circular ring-wedge shape
into a straight rectangle. Typical use is unwrapping of a text printed around a circle.
Note. A ring-wedge is delimited by two concentric circles and two straight lines passing through the
center. End of note.
Parameters
f32XCenter
f32YCenter
n32NumCircles
f32MinRadius
f32MaxRadius
n32NumRadii
f32MinAngle
f32MaxAngle
pWarpXImage
pWarpYImage
Example
// Source image
EImageBW8 Src(512, 512);
// Warp images
EImageBW16 WarpX(181, 31), WarpY(181, 31);
// Unwarped image
EImageBW8 Dst(181, 31);
// Prepare unwarping images
// Half ring between radii 50 and 80 (31 samples radially)
// Sampling at every degree (181 samples)
ImgSetCircleWarp(256.f, 256.f, 31, 50, 80, 181, 0, 180, &WarpX, &WarpY);
// Unwarp
ImgWarp(&Src, &Dst, &WarpX, &WarpY);
Declare using
#include "EImage.h"
152
ImgWarp
void ImgWarp(EROIBW8* pSrcImage, EROIBW8* pDstImage, EImageW16* pWarpXImage,
EImageBW16* pWarpYImage, INT32 n32ShiftX = 0, INT32 n32ShiftY = 0);
void ImgWarp(EROIC24* pSrcImage, EROIC24* pDstImage, EImageBW16* pWarpXImage,
EImageBW16* pWarpYImage, INT32 n32ShiftX = 0, INT32 n32ShiftY = 0);
Transforms an image so that each pixels are moved to the locations specified in the "warp" images
used as look-up tables. For example, pixel [10,20] moves to location
[WarpXImage[10,20],WarpYImage[10,20]].
Parameters
pSrcImage
pDstImage
pWarpXImage
pWarpYImage
n32ShiftX
n32ShiftY
Example
EImageBW8 ImageSrc, ImageDst;
EImageBW16 Abscissas, Ordinates;
ImgWarp(&ImageSrc, &ImageDst, &Abscissas, &Ordinates);
Declare using
#include "EImage.h"
ImgScaleRotate
void ImgScaleRotate(EROIBW8* pSrcImage, FLOAT32 f32SrcPivotX, FLOAT32 f32SrcPivotY,
FLOAT32 f32DstPivotX, FLOAT32 f32DstPivotY, FLOAT32 f32ScaleX, FLOAT32 f32ScaleY,
FLOAT32 f32Rotation, EROIBW8* pDstImage, INT32 n32InterpolationBits= 0);
void ImgScaleRotate(EROIBW16* pSrcImage, FLOAT32 f32SrcPivotX, FLOAT32 f32SrcPivotY,
FLOAT32 f32DstPivotX, FLOAT32 f32DstPivotY, FLOAT32 f32ScaleX, FLOAT32 f32ScaleY,
FLOAT32 f32Rotation, EROIBW16* pDstImage, INT32 n32InterpolationBits= 0);
void ImgScaleRotate(EROIC24* pSrcImage, FLOAT32 f32SrcPivotX, FLOAT32 f32SrcPivotY,
FLOAT32 f32DstPivotX, FLOAT32 f32DstPivotY, FLOAT32 f32ScaleX, FLOAT32 f32ScaleY,
FLOAT32 f32Rotation, EROIC24* pDstImage, INT32 n32InterpolationBits= 0);
Rescales an image by an arbitrary factor and/or rotates it by an arbitrary angle. For resampling, the
nearest neighbor rule or bilinear interpolation with 4 or 8 bits of accuracy is used.
The pivot point is a given point in the source image which is mapped to a given point in the destination
image. Rotation and scaling are done around the pivot point.
Out-of-image-bounds pixels are black.
Parameters
pSrcImage
f32SrcPivotX
f32SrcPivotY
f32DstPivotX
f32DstPivotY
f32ScaleX
f32ScaleY
f32Rotation
pDstImage
n32InterpolationBits
Example
EImageBW8 Src(512, 512), Dst(512, 512);
// Zoom in by a factor of two, leaving the image center unchanged
ImgScaleRotate(&Src, 255, 255, 255, 255, 2.f, 2.f, 0.f, &Dst, 4);
Declare using
#include "EImage.h"
ImgShrink
void ImgShrink(EROIBW8* pSrcImage, EROIBW8* pDstImage);
void ImgShrink(EROIBW16* pSrcImage, EROIBW16* pDstImage);
void ImgShrink(EROIC24* pSrcImage, EROIC24* pDstImage);
Example
EImageBW8 Src(512, 512), Dst(100, 50);
ImgShrink(&Src, &Dst);
Declare using
#include "EImage.h"
ImgLinearTransform
void ImgLinearTransform(EROIBW8* pSrcImage, FLOAT32 f32Axx, FLOAT32 f32Axy, FLOAT32
f32Ax, FLOAT32 f32Ayx, FLOAT32 f32Ayy, FLOAT32 f32Ay, EROIBW8* pDstImage, INT32
n32InterpolationBits= 0);
void ImgLinearTransform(EROIBW16* pSrcImage, FLOAT32 f32Axx, FLOAT32 f32Axy, FLOAT32
f32Ax, FLOAT32 f32Ayx, FLOAT32 f32Ayy, FLOAT32 f32Ay, EROIBW16* pDstImage, INT32
n32InterpolationBits= 0);
void ImgLinearTransform(EROIC24* pSrcImage, FLOAT32 f32Axx, FLOAT32 f32Axy, FLOAT32
f32Ax, FLOAT32 f32Ayx, FLOAT32 f32Ayy, FLOAT32 f32Ay, EROIC24* pDstImage, INT32
n32InterpolationBits= 0);
Applies a general affine transformation. An affine transformation is an important class of linear 2-D
geometric transformations which maps variables (e.g. pixel intensity values located at position (XSrc ,
YSrc) in an input image) into new variables (e.g. (XDst , YDst) in an output image) by applying a linear
combination of translation, rotation, scaling and/or shearing (i.e. non-uniform scaling in some
directions) operations.
154
Parameters
pSrcImage
pointer to the source image/ROI.
pDstImage
pointer to the destination image/ROI.
f32Axx, f32Axy, f32Ax, f32Ayx, f32Ayy, f32Ay
see formula below.
n32InterpolationBits
number of bits of accuracy for interpolation. Allowed values are 0 (no
interpolation, nearest neighbour), 4 or 8.
Remark
The parameters of the ImgLinearTransform function are the coefficients of the affine equations below:
Declare using
#include "EImage.h"
3.7
Histograms
ImgHistogram
void ImgHistogram (EROIBW8* pSrcImage, EBWHistogramVector* pHistogram);
void ImgHistogram (EROIBW16* pSrcImage, EBWHistogramVector* pHistogram, UINT32
un32MostSignificantBit, UINT32 un32NumUsedBits, BOOL bSaturate = TRUE);
void ImgHistogram (EROIBW32* pSrcImage, EBWHistogramVector* pHistogram, UINT32
un32MostSignificantBit, UINT32 un32NumUsedBits, BOOL bSaturate = TRUE);
Example
EImageBW8 Image;
EBWHistogramVector Histogram;
ImgHistogram(&Image, &Histogram);
Declare using
#include "EImage.h"
155
ImgCumulateHistogram
void ImgCumulateHistogram(EBWHistogramVector* pSrc, EBWHistogramVector* pDst);
Cumulates histogram values in another histogram. Calling this function after ImgHistogram allows you
to compute the cumulative histogram of an image, i. e. the count of pixels below a given threshold
value (instead of the count of pixels with a given gray value, as computed by ImgHistogram).
Parameters
pSrc
pDst
Example
EBWHistogramVector SrcVector, DstVector;
ImgCumulateHistogram(&SrcVector, &DstVector);
Declare using
#include "EImage.h"
ImgAnalyseHistogram
FLOAT32 ImgAnalyseHistogram (EBWHistogramVector* pHistogram, enum
IMG_HISTOGRAM_FEATURE eFeature, INT32 n32MinIndex=0, INT32 n32MaxIndex=255);
FLOAT32 ImgAnalyseHistogramBW16 (EBWHistogramVector* pHistogram, enum
IMG_HISTOGRAM_FEATURE eFeature, INT32 n32MinIndex=0, INT32 n32MaxIndex=65535);
Returns a floating-point statistical parameter extracted from a range of gray levels in an image
histogram (most/least frequent value/frequency, min/max value, count, average, standard deviation).
Parameters
pHistogram
eFeature
n32MinIndex
n32MaxIndex
Example
f32PixelValue = ImgAnalyseHistogram(&HistVect, IMG_MOST_FREQUENT_PIXEL_VALUE, 0,
255);
Declare using
#include "EImage.h"
ImgEqualize
void ImgEqualize(EImageBW8* pSrc, EImageBW8* pDst);
void ImgEqualize(EImageBW16* pSrc, EImageBW16* pDst);
Equalizes an image histogram (the gray-levels are remapped so that the histogram becomes as close
to uniform as possible). This strongly enhances the contrast in dark areas.
Parameters
pSrc
pDst
156
Example
EImageBW8 SrcImage;
EImageBW8 DstImage;
ImgEqualize(&SrcImage, &DstImage);
Declare using
#include "EImage.h"
ImgSetupEqualize
void ImgSetupEqualize(EBWHistogramVector* pHistogram, EBW8Vector* pLookupTable)
Prepares a lookup-table for image equalization, using an image histogram. This function, along with
ImgHistogram and ImgLut, is an alternative to using ImgEqualize.
Parameters
pHistogram
pLookupTable
Example
EImageBW8 Src;
EBWHistogramVector Histogram;
EBW8Vector Lut;
// Compute the image histogram
ImgHistogram(&Src, &Histogram);
// Prepare the equalization lookup table
ImgSetupEqualize(&Histogram, &Lut);
// Equalize
ImgLut(&Src, &Src, &Lut);
Declare using
#include "EImage.h"
3.8
Contouring
ImgContour
void ImgContour(EROIBW8* pImage, enum CONTOUR_MODE eContourMode, INT32 n32StartX,
INT32 n32StartY, enum CONTOUR_THRESHOLD eThresholdMode, UINT32 un32Threshold, enum
CONNEXITY eConnexity, EPathVector* pPath);
void ImgContour(EROIBW8* pImage, enum CONTOUR_MODE eContourMode, INT32 n32StartX,
INT32 n32StartY, enum CONTOUR_THRESHOLD eThresholdMode, UINT32 un32Threshold, enum
CONNEXITY eConnexity, EBW8PathVector* pPath, BOOL bFreeman= FALSE);
void ImgContour(EROIBW16* pImage, enum CONTOUR_MODE eContourMode, INT32 n32StartX,
INT32 n32StartY, enum CONTOUR_THRESHOLD eThresholdMode, UINT32 un32Threshold, enum
CONNEXITY eConnexity, EPathVector* pPath);
void ImgContour(EROIBW16* pImage, enum CONTOUR_MODE eContourMode, INT32 n32StartX,
INT32 n32StartY, enum CONTOUR_THRESHOLD eThresholdMode, UINT32 un32Threshold, enum
CONNEXITY eConnexity, EBW16PathVector* pPath, BOOL bFreeman= FALSE);
When destination vector is a EBW8PathVector or a EBW16PathVector, this vector can contain two
different information. If the bFreeman argument is FALSE, which is the default value, member
m_bw8(16)Pixel in the vector elements contains the gray-level value of the contour pixels. If it is TRUE,
the member instead gives the Freeman code leading from a pixel to next. The freeman codes are
numbered from 0 in the horizontal direction and incremented anticlockwise (as shown below).
Parameters
pImage
eContourMode
n32StartX
n32StartY
eThresholdMode
un32Threshold
eConnexity
pPath
bFreeman
Example
// Get the value at the start pixel
UINT32 un32Threshold= *(UINT8*)Image->GetImagePtr(n32StartX, n32StartY);
// Contour
ImgContour(&Image, IMG_CONTOUR_CLOCKWISE, n32StartX, n32StartY,
IMG_CONTOUR_ABOVE_THRESHOLD, un32Threshold, IMG_CONTOUR_CONNEXITY_8, &Vector);
Declare using
#include "EImage.h"
3.9
Projections
ImgProjectOnAColumn
8/16 Bits Gray Level
Sum
void ImgProjectOnAColumn(EROIBW8* pSrcImage, EBW32Vector* pDstVect);
void ImgProjectOnAColumn(EROIBW16* pSrcImage, EBW32Vector* pDstVect);
Average
void ImgProjectOnAColumn(EROIBW8* pSrcImage, EBW8Vector* pDstVect);
void ImgProjectOnAColumn(EROIBW16* pSrcImage, EBW16Vector* pDstVect);
158
Color
void ImgProjectOnAColumn(EROIC24* pSrcImage, EC24Vector* pDstVect);
Projects an image horizontally onto a column. Pixel gray/color levels are added when projecting into an
EBW32Vector. When projecting into an E BW8/BW16/C24 Vector, pixel values are averaged, instead.
Parameters
pSrcImage
pDstVect
Example
ImgProjectOnAColumn(&SrcImage, &DstVect);
Declare using
#include "EImage.h"
ImgProjectOnARow
8/16 Bits Gray Level
Sum
void ImgProjectOnARow(EROIBW8* pSrcImage, EBW32Vector* pDstVect);
void ImgProjectOnARow(EROIBW16* pSrcImage, EBW32Vector* pDstVect);
Average
void ImgProjectOnARow(EROIBW8* pSrcImage, EBW8Vector* pDstVect);
void ImgProjectOnARow(EROIBW16* pSrcImage, EBW16Vector* pDstVect);
Color
void ImgProjectOnARow(EROIC24* pSrcImage, EC24Vector* pDstVect);
Projects an image vertically onto a row. Pixel gray/color levels are added when projecting into an
EBW32Vector. When projecting into an E BW8/BW16/C24 Vector, pixel values are averaged, instead.
Parameters
pSrcImage
pDstVect
Example
ImgProjectOnARow(&SrcImage, &DstVect);
Declare using
#include "EImage.h"
159
3.10 Statistics
ImgArea
void ImgArea(EROIBW8* pSrcImage, UINT8 un8Threshold, INT32& n32PixelsAbove);
void ImgArea(EROIBW16* pSrcImage, EBW16 bw16Threshold, INT32& n32PixelsAbove);
Counts the pixels whose values are above (or on) a threshold.
Parameters
pSrcImage
un8(bw16)Threshold
n32PixelsAbove
Example
EImageBW8 Image;
INT32 n32Above;
ImgArea(&Image, 127, n32Above);
Declare using
#include "EImage.h"
ImgAreaDoubleThreshold
void ImgAreaDoubleThreshold (EROIBW8* pSrcImage, UINT8 un8LowThreshold, UINT8
un8HighThreshold, INT32& n32PixelsBetween);
void ImgAreaDoubleThreshold (EROIBW16* pSrcImage, EBW16 bw16LowThreshold, EBW16
bw16HighThreshold, INT32& n32PixelsBetween);
Counts the pixels whose values are comprised between (or on) two thresholds.
Parameters
pSrcImage
un8(bw16)LowThreshold
un8(bw16)HighThreshold
n32PixelsBetween
Example
EImageBW8 Image;
INT32 n32Medium;
ImgAreaDoubleThreshold(&Image, 85, 150, n32Medium);
Declare using
#include "EImage.h"
ImgBinaryMoments
void ImgBinaryMoments(EROIBW8* pSrcImage, UINT32 un32Threshold, FLOAT32& f32M,
FLOAT32& f32Mx, FLOAT32& f32My);
void ImgBinaryMoments(EROIBW8* pSrcImage, UINT32 un32Threshold, FLOAT32& f32M,
FLOAT32& f32Mx, FLOAT32& f32My, FLOAT32& f32Mxx, FLOAT32& f32Mxy, FLOAT32& f32Myy);
160
Computes the zero-th, first or second order moments on the binarized image, i.e. with a unit weight for
those pixels with a value above the threshold, and zero otherwise.
Parameters
pSrcImage
un32Threshold
f32M
f32Mx, f32My
f32Mxx, f32Mxy, f32Myy
Example
EImageBW8 Image;
FLOAT32 f32Area, f32SumX, f32SumY, f32SumXX, f32SumXY, f32SumYY;
ImgBinaryMoments(&Image, 128, f32Area, f32SumX, f32SumY, f32SumXX, f32SumXY,
f32SumYY);
Declare using
#include "EImage.h"
ImgWeightedMoments
void ImgWeightedMoments(EROIBW8* pSrcImage, FLOAT32& f32M, FLOAT32& f32Mx, FLOAT32&
f32My);
void ImgWeightedMoments(EROIBW8* pSrcImage, FLOAT32& f32M, FLOAT32& f32Mx, FLOAT32&
f32My, FLOAT32& f32Mxx, FLOAT32& f32Mxy, FLOAT32& f32Myy);
void ImgWeightedMoments(EROIBW8* pSrcImage, FLOAT32& f32M, FLOAT32& f32Mx, FLOAT32&
f32My, FLOAT32& f32Mxx, FLOAT32& f32Mxy, FLOAT32& f32Myy, FLOAT32& f32Mxxx, FLOAT32&
f32Mxxy, FLOAT32& f32Mxyy, FLOAT32& f32Myyy);
void ImgWeightedMoments(EROIBW8* pSrcImage, FLOAT32& f32M, FLOAT32& f32Mx, FLOAT32&
f32My, FLOAT32& f32Mxx, FLOAT32& f32Mxy, FLOAT32& f32Myy, FLOAT32& f32Mxxx, FLOAT32&
f32Mxxy, FLOAT32& f32Mxyy, FLOAT32& f32Myyy, FLOAT32& f32Mxxxx, FLOAT32& f32Mxxxy,
FLOAT32& f32Mxxyy, FLOAT32& f32Mxyyy, FLOAT32& f32Myyyy);
void ImgWeightedMoments(EROIBW16* pSrcImage, FLOAT32& f32M, FLOAT32& f32Mx, FLOAT32&
f32My);
void ImgWeightedMoments(EROIBW16* pSrcImage, FLOAT32& f32M, FLOAT32& f32Mx, FLOAT32&
f32My, FLOAT32& f32Mxx, FLOAT32& f32Mxy, FLOAT32& f32Myy);
void ImgWeightedMoments(EROIBW16* pSrcImage, FLOAT32& f32M, FLOAT32& f32Mx, FLOAT32&
f32My, FLOAT32& f32Mxx, FLOAT32& f32Mxy, FLOAT32& f32Myy, FLOAT32& f32Mxxx, FLOAT32&
f32Mxxy, FLOAT32& f32Mxyy, FLOAT32& f32Myyy);
void ImgWeightedMoments(EROIBW16* pSrcImage, FLOAT32& f32M, FLOAT32& f32Mx, FLOAT32&
f32My, FLOAT32& f32Mxx, FLOAT32& f32Mxy, FLOAT32& f32Myy, FLOAT32& f32Mxxx, FLOAT32&
f32Mxxy, FLOAT32& f32Mxyy, FLOAT32& f32Myyy, FLOAT32& f32Mxxxx, FLOAT32& f32Mxxxy,
FLOAT32& f32Mxxyy, FLOAT32& f32Mxyyy, FLOAT32& f32Myyyy);
161
Computes the zero-th, first, second, third or fourth order weighted moments on the gray-level image.
The weight of a pixel is its gray-level value.
Parameters
pSrcImage
un32Threshold
f32M
f32Mx, f32My
Example
EImageBW8 Image;
FLOAT32 f32SumValue, f32SumValueX, f32SumValueY, f32SumValueXX, f32SumValueXY,
f32SumValueYY;
ImgWeightedMoments(&Image, f32SumValue, f32SumValueX, f32SumValueY, f32SumValueXX,
f32SumValueXY, f32SumValueYY);
Declare using
#include "EImage.h"
ImgGravityCenter
void ImgGravityCenter(EROIBW8* pSrcImage, UINT32 un32Threshold, FLOAT32&
f32GravityX, FLOAT32& f32GravityY);
void ImgGravityCenter(EROIBW16* pSrcImage, UINT32 un32Threshold, FLOAT32&
f32GravityX, FLOAT32& f32GravityY);
Computes the coordinates of the gravity center of an image, i.e. the average coordinates of the pixels
above (or on) the threshold.
Parameters
pSrcImage
un32Threshold
f32XGravity
f32YGravity
Example
EImageBW8 Image;
FLOAT32 f32X;
FLOAT32 f32Y;
ImgGravityCenter(&Image, 128, f32X, f32Y);
162
Declare using
#include "EImage.h"
ImgCount
UINT32 ImgCount(EROIBW8* pSrcImage, BOOL (* Condition)(EBW8& Pixel));
UINT32 ImgCount(EROIBW16* pSrcImage, BOOL (* Condition)(EBW16& Pixel));
UINT32 ImgCount(EROIC24* pSrcImage, BOOL (* Condition)(EC24& Pixel));
Example
BOOL Odd(EBW8& Pixel){
return (Pixel & 1) > 0;
}
// Count pixels with an odd gray-level value
UINT32 Count= ImgCount(&Image, Odd);
Declare using
#include "EImage.h"
ImgPixelCount
void ImgPixelCount (EROIBW8* pSrcImage, UINT8 un8LowThreshold, UINT8
un8HighThreshold INT32& n32PixelsBelow, INT32& n32PixelsBetween, INT32&
n32PixelsAbove);
void ImgPixelCount (EROIBW16* pSrcImage, EBW16 bw16LowThreshold, EBW16
bw16HighThreshold, INT32& n32PixelsBelow, INT32& n32PixelsBetween, INT32&
n32PixelsAbove);
Counts the pixels in the three value classes separated by two thresholds.
Parameters
pSrcImage
un8(bw16)LowThreshold
un8(bw16)HighThreshold
n32PixelsBelow
n32PixelsBetween
n32PixelsAbove
Example
EImageBW8 Image;
INT32 n32Dark;
INT32 n32Medium;
INT32 n32Light;
ImgPixelCount(&Image, 85, 150, n32Dark, n32Medium, n32Light);
163
Declare using
#include "EImage.h"
ImgPixelAverage
void ImgPixelAverage(EROIBW8* pSrcImage, FLOAT32& f32Average);
void ImgPixelAverage(EROIBW16* pSrcImage, FLOAT32& f32Average);
void ImgPixelAverage(EROIC24* pSrcImage, FLOAT32& f32Mean0, FLOAT32& f32Mean1,
FLOAT32& f32Mean2);
Declare using
#include "EImage.h"
ImgLocalAverage
void ImgLocalAverage (EROIBW8* pSrcImage, EROIBW8* pDstImage, UINT32 un32HalfWidth,
UINT32 un32HalfHeight);
void ImgLocalAverage (EROIBW16* pSrcImage, EROIBW16* pDstImage, UINT32
un32HalfWidth, UINT32 un32HalfHeight);
Computes the average in a rectangular window centered on every pixel. The window dimensions can
be an arbitrary odd integer.
The running time of this function does not depend on the window size.
Parameters
pSrcImage
pDstImage
un32HalfWidth
un32HalfHeight
Example
ImgLocalAverage(&SrcImage, &DstImage, 1, 3);
Declare using
#include "EImage.h"
164
ImgPixelStdDev
void ImgPixelStdDev(EROIBW8* pSrcImage, FLOAT32& f32StdDev, FLOAT32& f32Mean);
void ImgPixelStdDev(EROIBW16* pSrcImage, FLOAT32& f32StdDev, FLOAT32& f32Mean);
void ImgPixelStdDev(EROIC24* pSrcImage, FLOAT32& f32StdDev0, FLOAT32& f32StdDev1,
FLOAT32& f32StdDev2, FLOAT32& f32Correlation01, FLOAT32& f32Correlation12, FLOAT32&
f32Correlation20, FLOAT32& f32Mean0, FLOAT32& f32Mean1, FLOAT32& f32Mean2);
Computes the average gray level or color value in an image, and its standard deviation.
Parameters
pSrcImage
pointer to the source image/ROI.
f32StdDev, f32StdDev0, f32StdDev1, f32StdDev2
reference to the standard deviations (square root of the variances) of the
pixel component values.
f32Correlation01, f32Correlation12, f32Correlation20
reference to the correlation coefficients (covariance over the product of
the standard deviations) of the pairs of pixel component values.
f32Mean, f32Mean0, f32Mean1, f32Mean2
reference to the mean pixel component values.
Example
EImageBW8 Image;
FLOAT32 f32Mean, f32StdDev;
ImgPixelStdDev(&Image, f32StdDev, f32Mean);
Declare using
#include "EImage.h"
ImgLocalDeviation
void ImgLocalDeviation (EROIBW8* pSrcImage, EROIBW8* pDstImage, UINT32
un32HalfWidth, UINT32 un32HalfHeight);
void ImgLocalDeviation (EROIBW16* pSrcImage, EROIBW16* pDstImage, UINT32
un32HalfWidth, UINT32 un32HalfHeight);
Computes the standard deviation in a rectangular window centered on every pixel. The window
dimensions can be an arbitrary odd integer.
The running time of this function does not depend on the window size.
Parameters
pSrcImage
pDstImage
un32HalfWidth
un32HalfHeight
Example
ImgLocalDeviation(&SrcImage, &DstImage, 3, 5);
Declare using
#include "EImage.h"
165
ImgPixelVariance
void ImgPixelVariance(EROIBW8* pSrcImage, FLOAT32& f32Variance, FLOAT32& f32Mean);
void ImgPixelVariance(EROIBW16* pSrcImage, FLOAT32& f32Variance, FLOAT32& f32Mean);
void ImgPixelVariance(EROIC24* pSrcImage, FLOAT32& f32Variance0, FLOAT32&
f32Variance1, FLOAT32& f32Variance2, FLOAT32& f32Covariance01, FLOAT32&
f32Covariance12, FLOAT32& f32Covariance20, FLOAT32& f32Mean0, FLOAT32& f32Mean1,
FLOAT32& f32Mean2);
For a gray-level image, computes the mean and variance of the pixel values.
For a color image, computes the means of the three pixel color components, the variances of the
components and the covariances between pairs of components.
Parameters
pSrcImage
pointer to the source image/ROI.
f32Variance, f32Variance0, f32Variance1, f32Variance2
reference to the variances of the pixel component values.
f32Covariance01, f32Covariance12, f32Covariance20
reference to the covariances of the pairs of pixel component values.
f32Mean, f32Mean0, f32Mean1, f32Mean2
reference to the mean pixel component values.
Example
EImageBW8 Image;
FLOAT32 f32Mean, f32Variance;
ImgPixelVariance(&Image, f32Variance, f32Mean);
Declare using
#include "EImage.h"
ImgPixelMax
void ImgPixelMax(EROIBW8* pSrcImage, UINT8& un8MaxPixVal);
void ImgPixelMax(EROIBW16* pSrcImage, EBW16& bw16MaxPixVal);
Example
EImageBW8 Image;
UINT8 un8Value;
ImgPixelMax(&Image, un8Value);
Declare using
#include "EImage.h"
166
ImgPixelMin
void ImgPixelMin(EROIBW8* pSrcImage, UINT8& un8MinPixVal);
void ImgPixelMin(EROIBW16* pSrcImage, EBW16& bw16MinPixVal);
Example
EImageBW8 Image;
UINT8 un8Value;
ImgPixelMin(&Image, un8Value);
Declare using
#include "EImage.h"
ImgPixelStat
void ImgPixelStat(EROIBW8* pSrcImage, UINT8& un8MinPixVal, UINT8& un8MaxPixVal,
FLOAT32& f32Average);
void ImgPixelStat(EROIBW16* pSrcImage, EBW16& bw16MinPixVal, EBW16& bw16MaxPixVal,
FLOAT32& f32Average);
Computes the minimum, maximum and average gray level values in an image.
Parameters
pSrcImage
un8(bw16)MinPixVal
un8(bw16)MaxPixVal
f32Average
Example
EImageBW8 Image;
UINT8 un8MinValue, un8MaxValue;
FLOAT32 f32Average;
ImgPixelStat(&Image, un8MinValue, un8MaxValue, f32AverageValue);
Declare using
#include "EImage.h"
ImgPixelCompare
UINT32 ImgPixelCompare(EROIBW8* pSrc0Image, EROIBW8* pSrc1Image);
UINT32 ImgPixelCompare(EROIBW16* pSrc0Image, EROIBW16* pSrc1Image);
UINT32 ImgPixelCompare(EROIC24* pSrc0Image, EROIC24* pSrc1Image);
Counts the number of pixels differing between two images.
167
Parameters
pSrc0Image
pSrc1Image
Example
EImageBW8 Left, Right;
// Warn if too many differences
if (ImgPixelCompare(&Left, &Right) > 100)
{ printf("More than 100 differences !\n");
}
Declare using
#include "EImage.h"
168
ImgSignalNoiseRatio
FLOAT32 ImgSignalNoiseRatio(EROIBW8* pSrcImage, EROIBW8* pRefImage, enum
IMG_REFERENCE_NOISE eReferenceNoise= IMG_NOISE_NONE);
FLOAT32 ImgSignalNoiseRatio(EROIBW16* pSrcImage, EROIBW16* pRefImage, enum
IMG_REFERENCE_NOISE eReferenceNoise= IMG_NOISE_NONE);
FLOAT32 ImgSignalNoiseRatio(EROIC24* pSrcImage, EROIC24* pRefImage, enum
IMG_REFERENCE_NOISE eReferenceNoise= IMG_NOISE_NONE);
Computes the signal to noise ratio, in dB, by comparing a given image to a reference image. The
reference image can be noiseless (obtained by suppressing the source of noise) or be affected by a
noise of the same distribution as the given image.
The signal amplitude is defined as the sum of the squared pixel gray-level values while the noise
amplitude is defined as the sum of the squared difference between the pixel gray-level values of the
given image and the reference.
Parameters
pSrcImage
pRefImage
eReferenceNoise
Computes the signal to noise ratio, in dB, by comparing a given image to a reference obtained by
temporal averaging to reduce its noise content. This reference image should be built by summing
several consecutive 8 bit images to a 16 bits accumulator image.
Parameters
pSrcImage
pRefImage
un32Count
eReferenceNoise
Declare using
#include "EImage.h"
ImgSetRecursiveAverageLUT
void ImgSetRecursiveAverageLUT(EBW16Vector* pLUT, FLOAT32 f32Reduction, FLOAT32
f32Width= 0.f);
This function is a companion to ImgRecursiveAverage and is used to precompute the required nonlinear transfer function for noise reduction by recursive temporal averaging.
Parameters
pLUT
f32Reduction
169
f32Width
Declare using
#include "EImage.h"
ImgRecursiveAverage
void ImgRecursiveAverage(EROIBW8* pSrc, EROIBW16* pStore, EROIBW8* pDst,
EBW16Vector* pLUT);
Recursive averaging is a well known process for noise reduction by temporal integration. The principle
is to continuously update a noise-free image by blending it, using a linear combination, with the raw,
noisy, live image stream.
Algorithmically, this amounts to apply the following recurrence:
DstN = a Src + (1 - a) DstN-1
where a is a mixture coefficient. The value of this coefficient can be adjusted so that a prescribed noise
reduction ratio is achieved.
This procedure is effective when applied to still images, but generates a trailing effect on moving
objects because of the transient behaviour of the filter. The larger the noise reduction ratio, the heavier
the trailing effect.
To work around this, a nonlinearity can be introduced in the blending process: small gray level values
variations between successive images are usually caused by noise while large variations correspond
to changes in the signal itself (camera displacement or object movements). Function
ImgRecursiveAverage uses this observation and applies stronger noise reduction to small variations
and conversely. This way, noise is better reduced in still areas and trailing is avoided in moving areas.
For optimal performance, the nonlinearity must be precomputed once for all using function
ImgSetRecursiveAverageLUT.
Parameters
pSrc
pStore
pDst
pLUT
Example
EImageBW8 Noisy(768, 576), Clean(768, 576);
EimageBW16 Store(768, 576);
EBW16Vector LUT;
// Prepare the transfer function (reduction factor 5, width 10)
void ImgSetRecursiveAverageLUT(&LUT, 5, 10);
// Clear the 16 bits work image
ImgOper(IMG_COPY,0,&Store);
// Image acquisition loop
while (TRUE)
{ // Acquire
// Process
ImgRecursiveAverage(&Noisy, &Store, &Clean, &LUT);
}
170
Remarks
Important note: Before the first call to the ImgRecursiveAverage method, the 16 bits work image must
be cleared (all pixel values set to zero).
Declare using
#include "EImage.h"
3.12 Conversions
ImgConvert
171
Turns a 16 bit gray-level image into an 8 bit gray-level image. A right shift can be applied to the 16 bit
data to adjust the magnitude, depending on how the 16 bit data is organized. For instance, if the
source image holds 10 significant bits right justified, a right shift of 2 is required to drop the 2 low order
bits; if the source image holds 12 bits left justified, a right shift of 8 is required and the 4 low order bits
will be truncated.
Parameters
pSrcImage
pDstImage
un32RightShift
Turns an EC15, EC16 or EC24 color image into an EBW8 gray-level image. The three color
components are simply averaged, giving the intensity component of the ISH color system.
Parameters
pSrcImage
pDstImage
Turns an 8 bit gray-level image into a 16 bit gray-level image. A left shift can be applied to the 8 bit
data to adjust the magnitude, depending on how the 16 bit data is organized. For instance, if the
destination image holds 10 significant bits right justified, a shift of 2 is required; if the destination image
holds 12 bits left justified, a shift of 8 is required.
Parameters
pSrcImage
pDstImage
un32LeftShift
172
Parameters
pSrcImage
pDstImage
un32HighValue
Turns an 8 bit gray-level image into a true color equivalent. The color components are all set equal to
the corresponding gray-level value.
Parameters
pSrcImage
pDstImage
Converts between standard and Windows' packing RGB color formats. When converting from a C24
image to a C15 or C16 one, only the 5 (or 6) most significant bits of each color component are
retained.
Parameters
pSrcImage
pDstImage
Converts between RGB 24 bits color image and RGB32 (also known as RGBA) color image. When
converting from C24 to C24A, you can choose to provide or not the alpha component.
On the other hand, when converting from C24A to C24, you can choose to conserve or not the alpha
component.
The alpha component is retrieved and set using an EBW8 image/ROI.
Parameters
pSrcImage
pSrcAlpha
pDstAlpha
pDstImage
Declare using
#include "EImage.h"
173
ImgConvertTo422
void ImgConvertTo422(EROIBW8* pSrcImage, EROIBW16* pDstImage);
Turns an 8 bits gray-level image into a YUV 4:2:2 encoded color image. The Y component is set to the
corresponding gray-level values while the U and V components are set to 128 (achromatic light).
Parameters
pSrcImage
pDstImage
Declare using
#include "EImage.h"
Copies the pixel values along a given line segment (arbitrarily oriented) to a vector. The line segment
must be wholly contained within the image. The vector length is adjusted automatically.
Parameters
pSrcImage
pPath
n32X0, n32Y0
n32X1, n32Y1
Example
EImageBW8 Src;
EBW8Vector Profile;
// Get the image data along segment (10,512)-(500,40)
ImgImageToLineSegment(&Src, &Profile, 10, 512, 500, 40);
Declare using
#include "EImage.h"
ImgLineSegmentToImage
void ImgLineSegmentToImage(EROIBW8* pDstImage, EBW8 bw8Pixel, INT32 n32X0, INT32
n32Y0, INT32 n32X1, INT32 n32Y1);
void ImgLineSegmentToImage(EROIBW8* pDstImage, EBW8Vector* pbw8Path, INT32 n32X0,
INT32 n32Y0, INT32 n32X1, INT32 n32Y1);
174
Copies the pixel values from a vector or a constant to the pixels of a given line segment (arbitrarily
oriented). The line segment must be wholly contained within the image.
Parameters
pDstImage
bw8Pixel
pbw8Path
c24Pixel
pC24Path
n32X0, n32Y0
n32X1, n32Y1
Example
EImageBW8 Src;
EBW8 bw8White= 255;
// Set all image pixels along segment (10,512)-(500,40) to white
ImgLineSegmentToImage (&Src, bw8White, 10, 512, 500, 40);
Declare using
#include "EImage.h"
ImgImageToPath
void ImgImageToPath(EROIBW8* pSrcImage, EBW8PathVector* pPath);
void ImgImageToPath(EROIBW16* pSrcImage, EBW16PathVector* pPath);
void ImgImageToPath(EROIC24* pSrcImage, EC24PathVector* pPath);
Given a path described by coordinates in a path vector, copies the corresponding pixel values into the
same vector.
Parameters
pSrcImage
pPath
Example
EImageBW8 Src;
EBW8PathVector Path;
// Define the path
Path.Empty();
for (int I= 0; I < 100; I++)
{ EBW8Path Pixel;
Pixel.m_n16X= ...;
Pixel.m_n16Y= ...;
Path.AddElement(Pixel);
}
// Get the image data along the path
ImgImageToPath(&Src, &Path);
Declare using
#include "EImage.h"
175
ImgPathToImage
void ImgPathToImage(EROIBW8* pSrcImage, EBW8PathVector* pPath);
void ImgPathToImage(EROIBW16* pSrcImage, EBW16PathVector* pPath);
void ImgPathToImage(EROIC24* pSrcImage, EC24PathVector* pPath);
Given a path described by coordinates in a path vector, copies the pixel values from the path vector to
the corresponding image pixels.
Parameters
pSrcImage
pPath
Example
EImageBW8 Src;
EBW8PathVector Path;
// Define the path
Path.Empty();
for (int I= 0; I < 100; I++)
{ EBW8Path Pixel;
Pixel.m_n16X= ...;
Pixel.m_n16Y= ...;
Pixel.m_bw8Pixel= ...;
Path.AddElement(Pixel);
}
// Set the image data along the path
ImgPathToImage(&Src, &Path);
Declare using
#include "EImage.h"
ImgProfileDerivative
void ImgProfileDerivative(EBW8Vector* pSrc, EBW8Vector* pDst);
Computes the first derivative of a profile extracted from a gray-level image. Taking the derivative
transforms transitions (edges) into peaks.
Note. Since the EBW8 data type only handles unsigned values, the derivative is shifted up by 128.
Values under [above] 128 correspond to negative [positive] derivative (decreasing [increasing] slope).
End of note.
Parameters
pSrc
pDst
Example
EBW8Vector Profile, Derivative;
// Derive
ImgProfileDerivative(&Profile, &Derivative);
Declare using
#include "EImage.h"
176
ImgGetProfilePeaks
void ImgGetProfilePeaks(EBW8Vector* pProfile, EPeaksVector* pPeaks, UINT32
un32LowThreshold= 0, UINT32 un32HighThreshold= 255, UINT32 un32MinAmplitude= 0,
UINT32 un32MinArea= 0);
Detects peaks in a gray-level profile. Maximas as well as minimas are considered. To eliminate false
peaks due to noise, two selection criteria are used.
A peak is the portion of the signal that is above [below] a given threshold. The peak amplitude is
defined to be the difference between the threshold value and the maximum [minimum] signal value.
The peak area is defined to be the surface comprised between the signal curve and the horizontal line
at the given threshold.
The result is stored in a peaks vector.
Parameters
pProfile
pPeaks
un32LowThreshold
un32HighThreshold
un32MinAmplitude
un32MinArea
Example
EBW8Vector Profile;
EPeaksVector Peaks;
// Detect the minimum and maximum peaks whose amplitude is at least 40 units
// The thresholds are 10 units away from the neutral value
ImgGetProfilePeaks(&Profile, &Peaks, 128 - 10, 128 + 10, 40, 0);
Declare using
#include "EImage.h"
ImgConvolUniform
void ImgConvolUniform(EROIBW8* pSrcImage, EROIBW8* pDstImage = NULL, UINT32
un32HalfWidth=1, UINT32 un32HalfHeight= ~0);
void ImgConvolUniform(EROIBW16* pSrcImage, EROIBW16* pDstImage = NULL, UINT32
un32HalfWidth=1, UINT32 un32HalfHeight= ~0);
void ImgConvolUniform(EROIC24* pSrcImage, EROIC24* pDstImage = NULL, UINT32
un32HalfWidth=1, UINT32 un32HalfHeight= ~0);
Applies strong lowpass filtering to an image by using a uniform rectangular kernel of odd size. This
filter replaces every pixel values by the arithmetic mean of the neighbouring values in a rectangular
window. To handle pixels along edges, the source pixels are replicated outwards as many times as
required.
A very nice feature of this function is that its running time does not depend on the kernel size !
Parameters
pSrcImage
pDstImage
177
un32HalfWidth
un32HalfHeight
Example
// Average image in 5x5 neighborhoods
ImgConvolUniform(&SrcImage, &DstImage, 2);
Declare using
#include "EImage.h"
3.14 Frame
ImgGet/SetFrame
void ImgGetFrame(EROIBW8* pSrcImage, EROIBW8* pDstImage, BOOL bOdd);
void ImgGetFrame(EROIBW16* pSrcImage, EROIBW16* pDstImage, BOOL bOdd);
void ImgGetFrame(EROIC24* pSrcImage, EROIC24* pDstImage, BOOL bOdd);
Remark
The size of the destination image is determined as follows:
DstImage_Width = SrcImage_Width
DstImage_Height = ( SrcImage_Height + 1 bOdd ) / 2
Example
EImageBW8 SrcImage(117, 83), DstImage(117, 42);
// Extract the frame of odd lines
ImgGetFrame(&SrcImage, &DstImage, 0);
void ImgSetFrame(EROIBW8* pSrcImage, EROIBW8* pDstImage, BOOL bOdd);
void ImgSetFrame(EROIBW16* pSrcImage, EROIBW16* pDstImage, BOOL bOdd);
void ImgSetFrame(EROIC24* pSrcImage, EROIC24* pDstImage, BOOL bOdd);
178
Remark
The size of the destination image is determined as follows:
DstImage_Width = SrcImage_Width
DstImage_Height = (SrcImage_Height * 2) 1 + bOdd
Example
EImageBW8 SrcImage(117, 42), DstImage(117, 83);
// Replace the frame of odd lines
ImgSetFrame(&SrcImage, &DstImage, 0);
Declare using
#include "EImage.h"
ImgRebuildFrame
When an image is interlaced, the two frames (even and odd lines) are not recorded at the same time. If
there is movement in the scene, a visible artifact can result (the edges of objects exhibit a "comb"
effect).
One cure to this problem is to replace one of the frames by linearly interpolating between the lines of
the other frame.
void ImgRebuildFrame(EROIBW8* pSrcImage, EROIBW8* pDstImage, UINT32 un32FixedRow=
0);
void ImgRebuildFrame(EROIBW16* pSrcImage, EROIBW16* pDstImage, UINT32 un32FixedRow=
0);
void ImgRebuildFrame(EROIC24* pSrcImage, EROIC24* pDstImage, UINT32 un32FixedRow=
0);
Rebuilds one frame of the image by interpolation between the lines of the other frame. If the
destination image differs from the source image, only the rebuilt rows are copied.
Parameters
pSrcImage
pDstImage
un32FixedRow
Example
// Rebuild the frame of odd lines
ImgRebuildFrame(&SrcImage, &DstImage, 0);
Declare using
#include "EImage.h"
ImgRealignFrame
When an image is interlaced, the two frames (even and odd lines) are not recorded at the same time. If
there is movement in the scene, a visible artifact can result (the edges of objects exhibit a "comb"
effect).
When the movement is uniform and horizontal (objects on a conveyor belt), one cure to this problem is
to shift one of the frames horizontally with respect to the other frame. The amplitude of the shift can be
estimated automatically (using ImgMatchFrames).
179
Shifts one frame of the image horizontally. If the destination image differs from the source image, only
the shifted rows are copied.
Parameters
pSrcImage
pDstImage
n32Offset
un32FixedRow
Example
// Shift the frame of odd lines by 5 pixels to the left
ImgRealignFrame(&SrcImage, &DstImage, -5, 0);
Declare using
#include "EImage.h"
ImgMatchFrames
When an image is interlaced, the two frames (even and odd lines) are not recorded at the same time. If
there is movement in the scene, a visible artifact can result (the edges of objects exhibit a "comb"
effect).
When the movement is uniform and horizontal (objects on a conveyor belt), one cure to this problem is
to shift one of the frames horizontally with respect to the other frame (using ImgRealignFrame). The
amplitude of the shift can be estimated automatically.
ImgMatchFrames(EROIBW8* pSrcImage, INT32 n32FixedRow, INT32 n32MinOffset, INT32
n32MaxOffset, INT32& n32BestOffset);
ImgMatchFrames(EROIBW16* pSrcImage, INT32 n32FixedRow, INT32 n32MinOffset, INT32
n32MaxOffset, INT32& n32BestOffset);
ImgMatchFrames(EROIC24* pSrcImage, INT32 n32FixedRow, INT32 n32MinOffset, INT32
n32MaxOffset, INT32& n32BestOffset);
Determines the optimal shift amplitude by comparing two successive lines of the image. These lines
should be chosen such that they cross some edges or non-uniform areas.
Parameters
pSrcImage
un32FixedRow
n32MinOffset
n32MaxOffset
n32BestOffset
180
Example
// Determine the optimal shift amplitude by comparing rows 128 and 129
// The shift is known to be to the right and not larger than 10 pixels
ImgMatchFrames(&SrcImage, 128, 0, 10, n32BestOffset);
// Shift the frame with odd lines accordingly
ImgRealignFrame(&SrcImage, &DstImage, n32BestOffset, 128);
Declare using
#include "EImage.h"
ImgSwapFrames
void ImgSwapFrames(EROIBW8* pSrcImage, EROIBW8* pDstImage);
void ImgSwapFrames(EROIBW16* pSrcImage, EROIBW16* pDstImage);
void ImgSwapFrames(EROIC24* pSrcImage, EROIC24* pDstImage);
Interchanges the even and odd rows of an image. This is helpful when acquisition of an interleaved
image has confused even and odd frames.
Parameters
pSrcImage
pDstImage
Declare using
#include "EImage.h"
3.15 Miscellaneous
ImgFocusing
FLOAT32 ImgFocusing(EROIBW8* pImage);
FLOAT32 ImgFocusing(EROIBW16* pImage);
FLOAT32 ImgFocusing(EROIC24* pImage);
Returns a measure of the focusing of an image by computing the total gradient energy. When this
quantity is maximum for a given image, sharp focusing is achieved.
Parameters
pImage
Declare using
#include "EImage.h"
181
4.
ENUMERATION CONSTANTS
4.1
enum ARITH_LOGIC_OPERATIONS
sheer copy.
complement.
saturated addition.
saturated subtraction.
saturated multiplication.
saturated division.
modulo.
arithmetic left shift (multiplication by a power of 2).
arithmetic right shift (division by a power of 2).
non saturating addition ((left + right) / 2).
non saturating subtraction ((left + complemented right) / 2).
non saturating multiplication (left * right / 256 in the BW8 case and left *
right / 65536 in the BW16 one).
IMG_SCALED_DIVIDE *
non saturating division (256 * left / right in the BW8 case and 65536 *
left / right in the BW16 one).
IMG_BITWISE_AND
bitwise AND.
IMG_BITWISE_OR
bitwise OR.
IMG_BITWISE_XOR
bitwise exclusive OR.
IMG_LOGICAL_AND *
logical AND (nonzero is TRUE).
IMG_LOGICAL_OR *
logical OR (nonzero is TRUE).
IMG_LOGICAL_XOR *
logical exclusive OR (nonzero is TRUE).
IMG_MIN *
minimum.
IMG_MAX *
maximum.
IMG_SET_ZERO
copy the right operand where the left operand is zero.
IMG_SET_NON_ZERO
copy the right operand where the left operand is non zero.
IMG_EQUAL *
equality comparison.
IMG_NOT_EQUAL *
non equality comparison.
IMG_GREATER_OR_EQUAL*
'greater or equal' comparison.
IMG_LESSER_OR_EQUAL
'lesser or equal' comparison.
IMG_GREATER *
'greater' comparison.
IMG_LESSER *
'lesser' comparison.
IMG_COMPARE *
absolute value of the difference.
IMG_OVERLAY *
overlay of one image onto a source image giving a destination image.
(See note at the end of the topic).
IMG_BITWISE_NOT
same as IMG_INVERT.
IMG_AVERAGE *
same as IMG_SCALED_ADD.
* Not applicable for the BW1 images/ROIs.
Note on IMG_OVERLAY. In the overlay image, black pixels (0 valued) are considered as transparent.
182
If a C24 image is used as overlay, all pixels (but the black ones) will be copied to the destination image.
If a BW8 image is used as overlay, all non black pixels will be converted to the color defined by parameter
OverlayColor before copy to the destination image.
The destination image is always a C24 image. If no source image is given (only overlay and destination),
the destination image is considered as the source image. End of note.
4.2
enum CONNEXITY
Contour connexity
IMG_CONTOUR_CONNEXITY_4
IMG_CONTOUR_CONNEXITY_8
4.3
enum CONTOUR_MODE
IMG_CONTOUR_CLOCKWISE_ALWAYS_CLOSED
IMG_CONTOUR_ANTICLOCKWISE
IMG_CONTOUR_ANTICLOCKWISE_CONTINUE_IF_BORDER
IMG_CONTOUR_ANTICLOCKWISE_ALWAYS_CLOSED
4.4
enum CONTOUR_THRESHOLD
4.5
enum IMG_HISTOGRAM_FEATURE
183
IMG_SMALLEST_PIXEL_VALUE
IMG_GREATEST_PIXEL_VALUE
IMG_PIXEL_COUNT
IMG_AVERAGE_PIXEL_VALUE
IMG_PIXEL_VALUE_STD_DEV
4.6
enum IMG_REFERENCE_NOISE
4.7
enum IMG_THRESHOLD_MODES
IMG_RELATIVE_THRESHOLD
IMG_MIN_RESIDUE_THRESHOLD
IMG_MAX_ENTROPY_THRESHOLD
IMG_ISODATA_THRESHOLD
4.8
enum KERNEL_RECTIFIER
Rectification modes
DO_NOT_RECTIFY
RECTIFY_KEEP_NEGATIVE
RECTIFY_KEEP_POSITIVE
RECTIFY_ABSOLUTE
184
no rectification.
negative becomes positive, positive becomes zero.
negative becomes zero.
negative becomes positive.
4.9
enum KERNEL_ROTATION
185
5.
SAMPLE PROGRAMS
The available sample programs dedicated to the EasyImage library are the following:
ImgProjection: performs a vertical projection of an image and plots the resulting graph.
Shows how to use vectors and draw lines.
ImgRingWarp: reads the marking printed around the center of a CD by first retrieving the
position of the center of the CD, unwarping the marking and then performing the read.
ImgStatistics: plots the histogram and computes statistical parameters over a region of
interest. Shows how colors can be used to plot graphs.
Remarks
The corresponding projects for Microsoft Visual C++ can be found in the eVision\MsVc Samples subfolder, while the projects for Borland C++ Builder are located in the eVision\BcB Samples sub-folder.
186
1.
EASYCOLOR: INTRODUCTION
colorimetric systems support: the perception of color is much harder to describe than that of
gray-levels. For this reason, several systems or colorimetric spaces have been developed.
EasyColor provides ways to use these systems for their respective advantages and to convert
images between them;
color image processing: many image processing operations can be generalized to color images.
For uniformity, these functions are considered to belong to the relevant eVision component.
Currently, color images are supported by EasyImage (arithmetic operations, convolutions,
morphology...) and EasyObject (object segmentation by color thresholding).
Using these features, you can easily enhance the contrast between colored elements, calibrate color
measurements, remove the effect of illumination and shadows, separate objects from the background
using elaborate thresholding or perform colorimetry.
EasyColor deals with color images rather than gray scale images. The C++ classes related to EasyColor
are
EImageC24: True Color image with three times eight bits per pixel (red, green, blue channels);
189
What is color?
The human eye is sensitive to the intensity of light (dark areas opposed to bright areas) that is captured
by gray-level images. It is also sensitive, to some extent, to the spectral composition of light, i.e. the
superposition of different wavelengths. Lab experiments have shown that any colored sensation can be
described as the mixture, in given proportions, of three well chosen primary colors, such as red, green and
blue; this is known as the tristimulus theory.
We give names to the different colors we perceive: orange, indigo, purple, olive green... These correspond
to different hues. Furthermore, colors can be seen as more or less pure. This property is called the
saturation: the more saturated a color is, the more vivid it appears; the less saturated it is, the closer it
comes to gray.
If the proportions of each color components, or "channels", are coded on eight bits, one obtains a 24-bitsper-pixel representation, often referred to as "True Color" images. This format is very often used in image
processing because it allows representing nearly as many colors as the eye can distinguish.
A color image is three times as large as a gray-level image in terms of storage requirements and requires
at least three times more processing.
Color Systems
Though the RGB representation is well suited for color reproduction (a color monitor screen works by
displaying a mixture of red, green and blue light), many other representations have been devised for
various purposes.
Three families of can be distinguished:
the "mixture" systems give the proportions of the three primaries to be combined;
the "luma/chroma" systems separate the achromatic (black and white) sensation and the
chromatic sensation (using two independent components). These systems are convenient when a
black and white image is required as well;
190
the XYZ primaries, that have been designed by the "Commission Internationale de lEclairage",
have become a universal standard for device independent color representation;
the YUV primaries have been introduced by the broadcast industry to allow efficient transmission
of color images by compressing the chrominance information.
Since no color system can fulfill all purposes, EasyColor supports a wide range of them, with additional
variants. The following table summarizes the color systems that are available:
RGB based
XYZ based
YUV based
Mixture
RGB
XYZ
Luma/Chroma
L*a*b*, L*u*v*
YUV, YIQ
Intensity/Saturation/Hue
LCH
YSH
EasyColor uses the RGB system as the preferred internal representation (only RGB images can be
displayed directly). The format used is compatible with the 24-bit Windows Bitmap requirements.
component extraction: very often, the best way to handle a color image is to extract from the triple
color information the most relevant feature, to reduce the amount of data. For instance, different
object in the field of view may be distinguished by their hue alone. So, as a preprocessing step,
the color image can be transformed to a gray-level one containing only the hue values. The latter
can be processed as usual. See function ClrGetComponent;
de-coupled transformation: some operations can be done separately on each color components.
For instance, adding two images together means that you sum the corresponding red, green and
blue component images. The result is stored channel by channel in a resulting color image;
coupled transformation: in the most complex case, all three color components are combined to
produce three derived components. Think of the conversion between the YIQ representation that
might be provided from a color camera to the RGB representation desired for display or further
processing. See function ClrTransform.
191
Given that a color pixel can take 224 (16 777 216) different values, a full color lookup table should include
as many entries, and would occupy 50 MB of memory. The EColorLookup object incorporates an
interpolation mechanism such that only 4 096, 32 768 or 262 144 entries are stored while accuracy is
preserved.
The lookup table device can be used to convert an image from one color system to another. It can also be
programmed to apply any user-defined transformation.
Further, some operations use the lookup table "on the fly" and avoid the need to store the transformed
image. For instance, it is possible to alter the U (of YUV) component of an image while the image remains
stored in RGB format.
Color thresholding
Thresholding is the basic mechanism for segmentation (separation of objects from the image background
and/or between contrasted objects). In the case of color images, additional freedom is available to specify
the range of values to be considered as the object of interest.
Combined with the color lookup device, one can for instance accept all pixels with saturated cyan color, at
any lightness level, and reject the others.
Declare using
#include "EColor.h"
192
2.
2.1
EColorLookup
2.1.1
EColorLookup: Overview
When color transforms need to be applied, they can be highly time-consuming. For instance, computing
the L*a*b* components (which have the nice property to define a "perceptually uniform" color space) is a
complex, non-linear operation. Applying this transform to all pixels of an image is just unacceptable.
To circumvent this difficulty, EasyColor provides a powerful lookup table mechanism: a lookup table is an
array of values that tells what output corresponds to a given input. If the lookup table can be precomputed, applying the transform becomes virtually instantaneous.
Given that a color pixel can take 16 777 216 (24th power of 2) different values, a full color lookup table
should include as many entries, and would occupy 50 MB of memory. The EColorLookup object
incorporates an interpolation mechanism such that only 4 096, 32 768 or 262 144 entries are stored while
accuracy is preserved.
The lookup table device can be used to convert an image from one color system to another. It can also be
programmed to apply any user-defined transformation.
Further, some operations use the lookup table "on the fly" and avoid the need to store the transformed
image. For instance, it is possible to alter the U (of YUV) component of an image while the image remains
stored in RGB format.
To apply some transform to a color image, you initialize a color lookup once for all and use it at will in a
transformation operation such as EColorLookup::Transform. Several types of transformations are
available:
Contrast and intensity
Balancing
Conversion
Calibration
General transform
SetTransform
Declare using
#include "EColor.h"
193
2.1.2
2.1.2.1
Construction
EColorLookup Construction
EColorLookup(UINT32 un32IndexBits= 5, BOOL bInterpolation= FALSE);
2.1.2.2
Interpolation mode
EColorLookup::Get/SetInterpolation
BOOL GetInterpolation();
Interpolation mode.
Remarks
When applying a lookup table to transform pixel values, trilinear interpolation can be used:
when interpolation is not used, the table is looked up at the entry closest to the pixel value.
This gives an accuracy equal to the value of the IndexBits parameter. On the other hand, table
lookup is very fast;
when interpolation is used, the table is looked up at eight neighboring entries and an adequate
average is computed. This gives full accuracy (8 bits) if the transformation is smooth enough.
On the other hand, table lookup is slower.
Note. The interpolation mode may be modified at any time without the need to reinitialize the lookup
table. End of note.
2.1.2.3
Index bits
EColorLookup::Get/SetIndexBits
UINT32 GetIndexBits();
Returns the number of bits used for indexing the lookup table.
void SetIndexBits(UINT32 un32IndexBits);
Sets the number of bits used for indexing the lookup table.
194
Parameters
un32IndexBits
Remarks
Before filling in a lookup table, it is necessary to decide how many table entries it requires. The
IndexBits parameter indicates how many (high order) bits of the input components are used. The
relation between IndexBits, the number of table entries and the corresponding table size are given
below:
IndexBits
Number of entries
2(3x4) = 4096
14739
(3x5)
= 32768
107811
2(3x6) = 262144
823875
2.1.2.4
Color systems
EColorLookup::GetColorSystemIn
enum E_COLOR_SYSTEM GetColorSystemIn();
195
2.1.2.5
Color transformation
EColorLookup::Transform
void Transform(EC24 SrcColor, EC24& DstColor);
void Transform(EROIC24* SrcImage, EROIC24* DstImage);
Transforms a quantized color image/pixel to another quantized color image/pixel, using the previously
initialized color lookup table.
Parameters
SrcColor
DstColor
SrcImage
DstImage
2.1.2.6
input color
output color
input color image
output color image
Initialization
EColorLookup::AdjustGainOffset
void AdjustGainOffset(enum E_COLOR_SYSTEM eColorSystem, FLOAT32 f32Gain0= 1.f,
FLOAT32 f32Offset0= 0.f, FLOAT32 f32Gain1= 1.f, FLOAT32 f32Offset1= 0.f, FLOAT32
f32Gain2= 1.f, FLOAT32 f32Offset2= 0.f);
Sets a color transformation such that a gain and offset is applied separately to each color component
of a target color system. The input and output color systems are both E_COLOR_SYSTEM_RGB.
Parameters
eColorSystem
f32Gain0
f32Offset0
f32Gain1
f32Offset1
f32Gain2
f32Offset2
Example
The following call prepares a lookup table to increase (double) the lightness, set a constant saturation
(50%) while maintaining the hue - the image remains described by RGB triplets:
Lookup.AdjustGainOffset(E_COLOR_SYSTEM_HSL, 2.f, 0.f, 0.f, 0.5f, 1.f, 0.f);
196
EColorLookup::ConvertToRGB
void ConvertToRGB(enum E_COLOR_SYSTEM eColorSystem);
Sets a color transformation from any color system, as defined by enum E_COLOR_SYSTEM, to the
E_COLOR_SYSTEM_RGB representation. The input and output color systems are respectively
eColorSystem and E_COLOR_SYSTEM_RGB.
Parameters
eColorSystem
Remarks
To apply some transform to a color image, you initialize a color lookup once for all and use it at will in a
transformation operation such as EColorLookup::Transform.
EColorLookup::ConvertFromRGB
void ConvertFromRGB(enum E_COLOR_SYSTEM eColorSystem);
Remarks
To apply some transform to a color image, you initialize a color lookup once for all and use it at will in a
transformation operation such as EColorLookup::Transform.
EColorLookup::Calibrate
void Calibrate(EC24 Color0, FLOAT32 f32X0, FLOAT32 f32Y0, FLOAT32 f32Z0,EC24 Color1,
FLOAT32 f32X1, FLOAT32 f32Y1, FLOAT32 f32Z1, EC24 Color2, FLOAT32 f32X2, FLOAT32
f32Y2, FLOAT32 f32Z2);
void Calibrate(EC24 Color0, FLOAT32 f32X0, FLOAT32 f32Y0, FLOAT32 f32Z0, EC24
Color1, FLOAT32 f32X1, FLOAT32 f32Y1, FLOAT32 f32Z1, EC24 Color2, FLOAT32 f32X2,
FLOAT32 f32Y2, FLOAT32 f32Z2, EC24 Color3, FLOAT32 f32X3, FLOAT32 f32Y3, FLOAT32
f32Z3);
197
Parameters
Color0
f32X0, f32Y0, f32Z0
Color1
f32X1, f32Y1, f32Z1
Color2
f32X2, f32Y2, f32Z2
Color3
f33X3, f33Y3, f33Z3
Remarks
To apply some transform to a color image, you initialize a color lookup once for all and use it at will in a
transformation operation such as EColorLookup::Transform.
EColorLookup:: SetTransform
void SetTransform(void (*Transform)(EColor SrcColor, EColor& DstColor), enum
E_COLOR_SYSTEM eSystemIn= E_COLOR_SYSTEM_RGB, enum E_COLOR_SYSTEM eSystemOut=
E_COLOR_SYSTEM_RGB);
Remarks
To apply some transform to a color image, you initialize a color lookup once for all and use it at will in a
transformation operation such as EColorLookup::Transform.
EColorLookup::WhiteBalance
void WhiteBalance(FLOAT32 f32Gain= 1, FLOAT32 f32Gamma= 1, FLOAT32 f32BalanceRed=
255, FLOAT32 f32BalanceGreen= 255, FLOAT32 f32BalanceBlue= 255);
Initialize a color lookup table that can be used for color adjustment, including a global gain, gamma
pre-compensation [cancellation] and white balancing.
Parameters
f32Gain
f32Gamma
198
f32Balance Red/Green/Blue
Remarks
To apply some transform to a color image, you initialize the color lookup once for all and use it at will
with EColorLookup::Transform or ClrTransformBayer operation.
2.2
2.2.1
EPseudoColorLookup
EPseudoColorLookup Class Members
EPseudoColorLookup::SetShading
void EPseudoColorLookup::SetShading(EC24 c24Black, EC24 c24White, enum
E_COLOR_SYSTEM eColorSystem, BOOL bWrap= TRUE);
Sets up a pseudo-color mapping such that gray level 0 corresponds to color c24Black, gray level 255
corresponds to color c24White, and intermediate values are interpolated linearly between these two
extremes. Furthermore, interpolation is performed in the designated color system.
Parameters
c24Black
c24White
eColorSystem
bWrap
Remarks
Even though interpolation is performed in an arbitrary color system, the extreme colors are specified in
the RGB space.
To obtain interesting shades of colors, it is recommended to interpolate on the hue component alone.
199
3.
FUNCTIONS
3.1
Color Conversions
To RGB
void ClrXYZToRGB(EC24 In, EC24& Out);
void ClrYUVToRGB(EC24 In, EC24& Out);
void ClrYIQToRGB(EC24 In, EC24& Out);
void ClrLSHToRGB(EC24 In, EC24& Out);
void ClrVSHToRGB(EC24 In, EC24& Out);
void ClrISHToRGB(EC24 In, EC24& Out);
void ClrYSHToRGB(EC24 In, EC24& Out);
void ClrLABToRGB(EC24 In, EC24& Out);
void ClrLCHToRGB(EC24 In, EC24& Out);
void ClrLUVToRGB(EC24 In, EC24& Out);
input color.
output color.
From RGB
void ClrRGBToXYZ(EC24 In, EC24& Out);
void ClrRGBToYUV(EC24 In, EC24& Out);
void ClrRGBToYIQ(EC24 In, EC24& Out);
void ClrRGBToLSH(EC24 In, EC24& Out);
void ClrRGBToVSH(EC24 In, EC24& Out);
void ClrRGBToISH(EC24 In, EC24& Out);
void ClrRGBToYSH(EC24 In, EC24& Out);
void ClrRGBToLAB(EC24 In, EC24& Out);
void ClrRGBToLCH(EC24 In, EC24& Out);
void ClrRGBToLUV(EC24 In, EC24& Out);
200
input color.
output color, as defined by the corresponding structure.
Miscellaneous
void ClrXYZToLAB(EC24 In, EC24& Out);
void ClrLABToXYZ(EC24 In, EC24& Out);
void ClrXYZToLUV(EC24 In, EC24& Out);
void ClrLUVToXYZ(EC24 In, EC24& Out);
void ClrRGBToReducedXYZ(EC24 In, EC24& Out);
Convert a quantized color from one system to another, including the xyz variant (reduced XYZ).
Parameters
In
Out
input color.
output color.
Declare using
#include "EColor.h"
To RGB
void ClrISHToRGB(EISH In, ERGB& Out);
void ClrLABToRGB(ELAB In, ERGB& Out);
void ClrLCHToRGB(ELCH In, ERGB& Out);
void ClrLSHToRGB(ELSH In, ERGB& Out);
void ClrLUVToRGB(ELUV In, ERGB& Out);
void ClrVSHToRGB(EVSH In, ERGB& Out);
void ClrXYZToRGB(EXYZ In, ERGB& Out);
void ClrYIQToRGB(EYIQ In, ERGB& Out);
void ClrYSHToRGB(EYSH In, ERGB& Out);
void ClrYUVToRGB(EYUV In, ERGB& Out);
From RGB
void ClrRGBToISH(ERGB In, EISH& Out);
void ClrRGBToLAB(ERGB In, ELAB& Out);
void ClrRGBToLCH(ERGB In, ELCH& Out);
void ClrRGBToLSH(ERGB In, ELSH& Out);
void ClrRGBToLUV(ERGB In, ELUV& Out);
void ClrRGBToVSH(ERGB In, EVSH& Out);
void ClrRGBToXYZ(ERGB In, EXYZ& Out);
void ClrRGBToYIQ(ERGB In, EYIQ& Out);
void ClrRGBToYSH(ERGB In, EYSH& Out);
void ClrRGBToYUV(ERGB In, EYUV& Out);
input color.
output color, as defined by the corresponding structure.
Miscellaneous
void ClrXYZToLAB(EXYZ In, ELAB& Out);
void ClrLABToXYZ(ELAB In, EXYZ& Out);
void ClrLUVToXYZ(ELUV In, EXYZ& Out);
void ClrXYZToLUV(EXYZ In, ELUV& Out);
void ClrRGBToReducedXYZ(ERGB In, EXYZ& Out);
Convert an unquantized color from one system to another, including the xyz variant (reduced XYZ).
Parameters
In
Out
input color.
output color.
Declare using
#include "EColor.h"
3.2
ClrQuantize
void ClrQuantize(EISH Src, EC24& Dst);
void ClrQuantize(ELAB Src, EC24& Dst);
void ClrQuantize(ELCH Src, EC24& Dst);
void ClrQuantize(ELSH Src, EC24& Dst);
202
Remarks
Quantization is the process that transforms a continuous value, usually represented as a floating-point
value in the [0..1] interval, into a discrete one, usually represented as an integer in the [0..255] interval.
Dequantization is the reverse process.
Declare using
#include "EColor.h"
ClrDequantize
void ClrDequantize(EC24 Src, EISH& Dst);
void ClrDequantize(EC24 Src, ELAB& Dst);
void ClrDequantize(EC24 Src, ELCH& Dst);
void ClrDequantize(EC24 Src, ELSH& Dst);
void ClrDequantize(EC24 Src, ELUV& Dst);
void ClrDequantize(EC24 Src, ERGB& Dst);
void ClrDequantize(EC24 Src, EVSH& Dst);
void ClrDequantize(EC24 Src, EXYZ& Dst);
void ClrDequantize(EC24 Src, EYIQ& Dst);
void ClrDequantize(EC24 Src, EYSH& Dst);
void ClrDequantize(EC24 Src, EYUV& Dst);
203
Remarks
Quantization is the process that transforms a continuous value, usually represented as a floating-point
value in the [0..1] interval, into a discrete one, usually represented as an integer in the [0..255] interval.
Dequantization is the reverse process.
Declare using
#include "EColor.h"
3.3
ClrCompose
void ClrCompose(EROIBW8* pC0Src, EROIBW8* pC1Src, EROIBW8* pC2Src, EROIC24*
pColorDst, EColorLookup* pLookup= NULL);
Combines three gray level images, considered as three color planes, into a color image. If a color
lookup is used, the resulting image undergoes the corresponding color transform. This way, it is
possible to build an RGB image from the color planes of another system, or conversely.
Parameters
pC0Src, pC1Src, pC2Src
pColorDst
pLookup
Remarks
A color image can be seen as a set of three color planes, each corresponding to a color component.
The color planes are themselves continuous tone images. An EImageC24 contains three EImageBW8.
Declare using
#include "EColor.h"
ClrDecompose
void ClrDecompose(EROIC24* pColorSrc, EROIBW8* pC0Dst, EROIBW8* pC1Dst, EROIBW8*
pC2Dst, EColorLookup* pLookup= NULL);
Extracts the three color planes, considered as gray level images, from a color image. If a color lookup
is used, the source image undergoes the corresponding color transform. This way, it is possible to get
the RGB components from an image of another system, of conversely.
Parameters
pColorSrc
pC0Dst, pC1Dst, pC2Dst
pLookup
Remarks
A color image can be seen as a set of three color planes, each corresponding to a color component.
The color planes are themselves continuous tone images. An EImageC24 contains three EImageBW8.
Declare using
#include "EColor.h"
204
ClrGetComponent
void ClrGetComponent(EROIC24* pColorSrc, EROIBW8* pBWDst, UINT32 un32Component,
EColorLookup* pLookup= NULL);
Extracts one color plane, considered as a gray level image, from a color image. If a color lookup is
used, the source image undergoes the corresponding color transform. This way, it is possible to get an
RGB component from an image of another system, of conversely.
Parameters
pColorSrc
pBWDst
un32Component
pLookup
Remarks
A color image can be seen as a set of three color planes, each corresponding to a color component.
The color planes are themselves continuous tone images. An EImageC24 contains three EImageBW8.
Declare using
#include "EColor.h"
ClrSetComponent
void ClrSetComponent(EROIBW8* pBWSrc, EROIC24* pColorDst, UINT32 un32Component);
Sets a color plane of a color image by using a gray level image as component.
Parameters
pBWSrc
pColorDst
un32Component
Remarks
A color image can be seen as a set of three color planes, each corresponding to a color component.
The color planes are themselves continuous tone images. An EImageC24 contains three EImageBW8.
Declare using
#include "EColor.h"
ClrRegisterPlanes
void ClrRegisterPlanes(EROIC24* pSrc, EROIC24* pDst, INT32 n32RShiftX= 0, INT32
n32GShiftX= 0, INT32 n32BShiftX= 0, INT32 n32RShiftY= 0, INT32 n32GShiftY= 0, INT32
n32BShiftY= 0);
Sets a color plane of a color image by using a gray level image as component.
Parameters
pSrc
pDst
n32RShiftX
205
n32GShiftX
n32BShiftX
n32RShiftY
n32GShiftY
n32BShiftY
horizontal shifting of the second plane (the green one in case of an RGB
image), expressed in pixels.
horizontal shifting of the third plane (the blue one in case of an RGB
image), expressed in pixels.
vertical shifting of the first plane (the red one in case of an RGB image),
expressed in pixels.
vertical shifting of the second plane (the green one in case of an RGB
image), expressed in pixels.
vertical shifting of the third plane (the blue one in case of an RGB image),
expressed in pixels.
Remarks
A color image can be seen as a set of three color planes, each corresponding to a color component.
The color planes are themselves continuous tone images. An EImageC24 contains three EImageBW8.
Declare using
#include "EColor.h"
3.4
ClrTransform
void ClrTransform(EROIC24* pSrcImage, EROIC24* pDstImage, EColorLookup* pLookup);
Applies to an image the color transformation defined by a color lookup (also see color lookup
initialization).
Parameters
pSrcImage
pDstImage
pLookup
Applies to an image a user-defined quantized color transformation. No intermediate color lookup table
is used.
Parameters
pSrcImage
pDstImage
pLookup
eSystemIn
eSystemOut
206
Parameters
pSrcImage
pDstImage
pLookup
eSystemIn
eSystemOut
Remarks
A color image can be seen as a set of three color planes, each corresponding to a color component.
The color planes are themselves continuous tone images. An EImageC24 contains three EImageBW8.
Declare using
#include "EColor.h"
ClrTransformBayer
void ClrTransformBayer(EROIBW8* pSrcImage, EROIBW8* pDstImage, EColorLookup*
pLookup, BOOL bEvenCol= TRUE, BOOL bEvenRow= TRUE);
Converts an image using the color transform defined by a color lookup table. By contrast with
ClrTransform, the transform is applied directly to Bayer-encoded data. This allows efficient processing
to take place before conversion to the C24 format.
Parameters
pSrcImage
pDstImage
pLookup
bEvenCol
bEvenRow
pointer to the source image/ROI. This image must be encoded using the
Bayer color pattern.
pointer to the destination image/ROI.This image must be encoded using
the Bayer color pattern.
pointer to the color lookup table holding the color adjustment transform.
The lookup table must be previously set up by WhiteBalance method (no
other transforms are supported).
TRUE if the leftmost destination image column cant contain blue pixels.
TRUE if the topmost destination image row cant contain red pixels.
Declare using
#include "EColor.h"
3.5
Pseudo Coloring
ClrPseudoColor
void ClrPseudoColor(EROIBW8* pSrc, EROIC24* pDst, EPseudoColorLookup* pLookup);
Applies the mapping defined by the pseudo-color lookup table to transform a gray-level image into a
color image.
Parameters
pSrc
pDst
pLookup
207
Remarks
Pseudo-coloring is a convenient way to display gray-level images with enhanced contrast: a shade of
colors is associated to the shade of gray-level values. A simple way to define the shade of colors is to
specify a path in color space.
In order to use pseudo-coloring, a special lookup table is used: EPseudoColorLookup. It handles the
mapping between the gray-level and color values.
Declare using
#include "EColor.h"
3.6
ClrGet/SetSrcQuantization
enum E_COLOR_QUANTIZATION ClrGetSrcQuantization();
Returns the quantization mode for input values, as defined by enum E_COLOR_QUANTIZATION.
void ClrSetSrcQuantization(enum E_COLOR_QUANTIZATION eQuantization);
Remarks
These settings remain permanent and influence the relevant quantized and unquantized color
conversions (during lookup table initialization or image color transformation).
Declare using
#include "EColor.h"
ClrGet/SetRGBStandard
enum E_RGB_STANDARD ClrGetRGBStandard();
Returns the RGB definition to be used when converting between RGB and other color systems, as
defined by enum E_RGB_STANDARD.
void ClrSetRGBStandard(enum E_RGB_STANDARD eStandard);
Sets the RGB definition to be used when converting between RGB and other color systems.
Parameters
eStandard
Remarks
Some variant of the color systems can be used. The ClrSetSrcQuantization and ClrSetDstQuantization
functions are used to activate them.
These settings remain permanent and influence the relevant quantized and unquantized color
conversions (during lookup table initialization or image color transformation).
Declare using
#include "EColor.h"
208
ClrGet/SetDstQuantization
enum E_COLOR_QUANTIZATION ClrGetDstQuantization();
Returns the quantization mode for output values, as defined by enum E_COLOR_QUANTIZATION.
void ClrSetDstQuantization(enum E_COLOR_QUANTIZATION eQuantization);
Remarks
These settings remain permanent and influence the relevant quantized and unquantized color
conversions (during lookup table initialization or image color transformation).
Declare using
#include "EColor.h"
3.7
YUV Conversions
ClrFormat422To444
void ClrFormat422To444(EROIBW16* pSrcImage, EROIC24* pDstImage, BOOL bYFirst);
pointer to the input image/ROI, stored using the 16 bits per pixel format.
pointer to the output image/ROI.
flag indicating if the format is YUYVYUYV (TRUE) or UYVYUYVY (FALSE).
Remarks
In the YUV system, it has been established that sub-sampling the chroma components does not
degrade the visual image quality. The 4:4:4 format uses three bytes of information by pixel. The 4:2:2
format is such that only the U and V chroma of the even pixels are kept and they are stored with the
even and odd luma, as follows:
Y[even] U[even] Y[odd] V[even]
Thus, only two bytes per pixel are required.
Declare using
#include "EColor.h"
ClrFormat444To422
void ClrFormat444To422(EROIC24* pSrcImage, EROIBW16* pDstImage, BOOL bYFirst);
209
Remarks
In the YUV system, it has been established that sub-sampling the chroma components does not
degrade the visual image quality. The 4:4:4 format uses three bytes of information by pixel. The 4:2:2
format is such that only the U and V chroma of the even pixels are kept and they are stored with the
even and odd luma, as follows:
Y[even] U[even] Y[odd] V[even]
Thus, only two bytes per pixel are required.
Declare using
#include "EColor.h"
3.8
Bayer Conversions
ClrBayerToC24
void ClrBayerToC24(EROIBW8* pSrcImage, EROIC24* pDstImage, BOOL bEvenCol= TRUE, BOOL
bEvenRow= TRUE, BOOL bInterpolate= TRUE, BOOL bImproved= FALSE);
Converts a Bayer pattern encoded image into a color image. The conversion process needs to supply
missing component values; these can be obtained by mere duplication (nearest neighbor technique) or
by linear interpolation.
The pattern can be shifted by one pixel horizontaly and verticaly as needed to deal with a non standard
pattern origin.
Parameters
PSrcImage
PDstImage
bEvenCol
bEvenRow
bInterpolate
bImproved
pointer to the Bayer pattern input image/ROI, stored using the 8 bits per
pixel format.
pointer to the color output image/ROI.
TRUE if the leftmost image column contains no blue pixels.
TRUE if the topmost image row contains no red pixels.
interpollation mode to be used for pixel reconstruction. When FALSE, the
missing color components are merely copied from northern/western
pixels; when TRUE, they are computed by averaging from relevant
neighbors. By default, interpolation is used.
provides an access to an improved interpolation mode that reduces visible
artifacts along object edges. The running time of the improved method is
longer. By default, it is not used.
Remarks
The Bayer pattern is a special color image encoding format that allows to capture color information
from a single sensor. A color filter with a specific layout is placed in front of the sensor so that part of
the pixels receive red light only, while others receive green or blue only. An image encoded after the
Bayer pattern has the same format as a gray level image and conveys three times less information.
The true horizontal and vertical resolutions are smaller than those of a true color image.
The pattern is arranged as follow.
210
ClrC24ToBayer
void ClrC24ToBayer(EROIC24* pSrcImage, EROIBW8* pDstImage, BOOL bEvenCol= TRUE, BOOL
bEvenRow= TRUE);
Converts a color image into a Bayer pattern encoded image. The pattern can be shifted by one pixel
horizontally and vertically as needed to deal with a non standard pattern origin.
Parameters
PSrcImage
PDstImage
bEvenCol
bEvenRow
Remarks
The Bayer pattern is a special color image encoding format that allows to capture color information
from a single sensor. A color filter with a specific layout is placed in front of the sensor so that part of
the pixels receive red light only, while others receive green or blue only. An image encoded after the
Bayer pattern has the same format as a gray level image and conveys three times less information.
The true horizontal and vertical resolutions are smaller than those of a true color image.
The pattern is arranged as follow.
211
3.9
ClrAssignNearestClass
void ClrAssignNearestClass(EROIC24* pSrcImage, EROIBW8* pDstImage, EC24Vector*
pClassCenters);
Assign to every pixel of the source image the nearest class index plus one and stores its value in the
destination image. This generates a labeled gray-level image for use with EasyObject (See
BuildLabeledRuns and BuildLabeledObjects). Note that the class index plus one is stored instead of
the class index because EasyObject will never code class 0 objects.
Parameters
pSrcImage
pDstImage
pClassCenters
Remarks
Color image segmentation allows you to decompose a color image in different regions by assigning a
"class" (integer index) to every pixel. The nearest neighbor method is used, i.e. for each class a
representative center is specified, and a given pixel is associated to the class with the closest center.
Color image segmentation can be used in conjunction with EasyObject to perform blob analysis on the
segmented regions.
To the color segmentation functions, the set of class centers must be specified as a vector of EC24
elements. In this sense, the method is termed supervised clustering . A good way to obtain these
values is to compute the average color in a region of interest.
Unsupervised clustering is also made available by implementing the so called K-means method that
automatically improves an initial choice of class centers.
Declare using
#include "EColor.h"
212
ClrAssignNearestClassCenter
void ClrAssignNearestClassCenter(EROIC24* pSrcImage, EROIC24* pDstImage, EC24Vector*
pClassCenters);
Assign to every pixel of the source image the nearest class center and stores its value in the
destination image. This generates a labeled color image.
Parameters
pSrcImage
pDstImage
pClassCenters
Remarks
Color image segmentation allows you to decompose a color image in different regions by assigning a
"class" (integer index) to every pixel. The nearest neighbor method is used, i.e. for each class a
representative center is specified, and a given pixel is associated to the class with the closest center.
Color image segmentation can be used in conjunction with EasyObject to perform blob analysis on the
segmented regions.
To the color segmentation functions, the set of class centers must be specified as a vector of EC24
elements. In this sense, the method is termed supervised clustering . A good way to obtain these
values is to compute the average color in a region of interest.
Unsupervised clustering is also made available by implementing the so called K-means method that
automatically improves an initial choice of class centers.
Declare using
#include "EColor.h"
ClrImproveClassCenters
void ClrImproveClassCenters(EROIC24* pSrcImage, EC24Vector* pClassCenters);
Redefines the class centers by computing the average color value of the pixels assigned to each class
in the source image. This implements a step of the K-means method for unsupervised clustering.
Parameters
pSrcImage
pClassCenters
Remarks
Color image segmentation allows you to decompose a color image in different regions by assigning a
"class" (integer index) to every pixel. The nearest neighbor method is used, i.e. for each class a
representative center is specified, and a given pixel is associated to the class with the closest center.
Color image segmentation can be used in conjunction with EasyObject to perform blob analysis on the
segmented regions.
Declare using
#include "EColor.h"
ClrClassAverages
void ClrClassAverages(EROIC24* pSrcImage, EC24Vector* pClassCenters, EColorVector*
pAverages);
213
Computes the average source pixel colors for every class separately. This allows measuring the actual
average color of the segmented regions.
Parameters
pSrcImage
pClassCenters
pAverages
Remarks
Color image segmentation allows you to decompose a color image in different regions by assigning a
"class" (integer index) to every pixel. The nearest neighbor method is used, i.e. for each class a
representative center is specified, and a given pixel is associated to the class with the closest center.
Color image segmentation can be used in conjunction with EasyObject to perform blob analysis on the
segmented regions.
To the color segmentation functions, the set of class centers must be specified as a vector of EC24
elements. In this sense, the method is termed supervised clustering . A good way to obtain these
values is to compute the average color in a region of interest.
Unsupervised clustering is also made available by implementing the so called K-means method that
automatically improves an initial choice of class centers.
Declare using
#include "EColor.h"
ClrClassVariances
void ClrClassVariances(EROIC24* pSrcImage, EC24Vector* pClassCenters, EColorVector*
pAverages, EColorVector* pVariances);
Computes the averages and variances of the image pixel colors for every class separately. This allows
quantifying the homogeneity of the segmented regions.
Parameters
pSrcImage
pClassCenters
pAverages
pVariances
Remarks
Color image segmentation allows you to decompose a color image in different regions by assigning a
"class" (integer index) to every pixel. The nearest neighbor method is used, i.e. for each class a
representative center is specified, and a given pixel is associated to the class with the closest center.
Color image segmentation can be used in conjunction with EasyObject to perform blob analysis on the
segmented regions.
To the color segmentation functions, the set of class centers must be specified as a vector of EC24
elements. In this sense, the method is termed supervised clustering . A good way to obtain these
values is to compute the average color in a region of interest.
Unsupervised clustering is also made available by implementing the so called K-means method that
automatically improves an initial choice of class centers.
Declare using
#include "EColor.h"
214
4.
ENUMERATION CONSTANTS
4.1
enum E_COLOR_SYSTEM
eVision supports several color systems. The achromatic ones are related to black and white and gray level
images (EImageBW1 and EImageBW8). The remaining ones apply to color images (EImageC24).
E_COLOR_SYSTEM_NONE
undefined.
Achromatic
E_COLOR_SYSTEM_BILEVEL
binary black & white.
E_COLOR_SYSTEM_GRAY_LEVEL continuous tone black & white.
Luma/chroma family
E_COLOR_SYSTEM_LAB
E_COLOR_SYSTEM_LUV
E_COLOR_SYSTEM_YUV
E_COLOR_SYSTEM_YIQ
Luminance/hue/saturation family
E_COLOR_SYSTEM_ISH
Intensity, Saturation, Hue
E_COLOR_SYSTEM_LSH
Ligthness, Saturation, Hue.
E_COLOR_SYSTEM_VSH
Value, Saturation, Hue.
E_COLOR_SYSTEM_LCH
E_COLOR_SYSTEM_YSH
CCIR Luma, Saturation, Hue.
E_COLOR_SYSTEM_LABELIZED
Labelized.
Also see unquantized and quantized colors for the allowed ranges of values.
4.2
enum E_RGB_STANDARD
The definition of the RGB primaries is not unique. In principle, there is one RGB system for each set of
phosphors used in color monitors. Anyway, the CCIR has defined standard combinations for use in digital
TV broadcast. Before performing a conversion, function ClrSetRGBStandard can be used to specify the
standard used.
E_RGB_STANDARD_NTSC
NTSC primaries with the following CIE XYZ coordinates:
Red: (0.607, 0.299, 0.000),
Green: (0.174, 0.587, 0.066),
Blue: (0.201, 0.114, 1.117)
215
E_RGB_STANDARD_PAL
E_RGB_STANDARD_SMPTE
4.3
enum E_COLOR_QUANTIZATION
When quantizing the color values for the RGB or YIQ/YUV representation, one usually uses the full 0..255
range. Anyway, the CCIR has defined an alternate convention such that some values in this interval are
reserved. Before performing a conversion, functions ClrSetSrcQuantization and ClrSetDstQuantization
can be used to specify the rule used.
E_COLOR_QUANTIZATION_FULL_RANGE
values are quantized in range 0..255
E_COLOR_QUANTIZATION_CCIR_601
values are quantized in range 16..235 for the R, G, B or
Y component, and in range 16..240 for the I, Q, U and y
components.
216
5.
SAMPLE PROGRAMS
The available sample programs dedicated to the EasyColor library are the following:
Remarks
The corresponding projects for Microsoft Visual C++ can be found in the eVision\MsVc Samples subfolder, while the projects for Borland C++ Builder are located in the eVision\BcB Samples sub-folder.
217
1.
EASYOBJECT: INTRODUCTION
The EasyObject library handles image segmentation, i.e. the decomposition of images into connected
blobs of similar gray levels. Various geometric parameters or features, such as area or ellipse of inertia,
can be computed on these blobs.
A systematic process is usually followed.
First, the gray level images are decomposed into homogenous light/medium/dark classes by using two
thresholds. The thresholds can be adaptive, i.e. they can be defined pixel-wise rather than remain
constants over the whole image. The light/medium/dark classes can be assigned a specific index (See
SetWhite/Neutral/Black Class). Setting the same index for two different classes will merge them.
Alternatively, the class information can be obtained from the image itself by considering the pixel values
as class indices (Labeled images).
The contiguous pixels of the same classes are then grouped into runs (horizontal segments). The
contiguous runs of the same class can then be grouped together to form objects (or blobs). The objects
are numbered. (The runs building and object building phases are usually performed in a single function
call, BuildObjects and BuildLabeledObjects) The pixels can be grouped using either the 4-connected or 8connected rule (see parameter Connexity).
In addition, EasyObject also allows to detect holes in objects. The hole construction is optional. It is
always subsequent to the real object construction. Moreover, the user can select the real objects on which
the hole detection has to be performed. When blobs and holes have been built, the inclusion relationship
between all the objects is computed. It is important to note that holes are, just as for real objects, wellformed EasyObject objects. The hole building is performed by a call to the BuildHoles function.
Then, on demand, the desired features are computed on the objects (AnalyseObjects).
When features have been computed, the objects can be sorted by increasing or decreasing feature
values, or they can be selected within feature value ranges.
The library functions fall in the following categories:
- Run construction: thresholding and pixel aggregation into runs;
- Object construction: run aggregation into objects;
- Hole construction: run aggregation into holes;
- Feature computation: geometric parameter computation;
- Selection and sorting: according to some feature value.
All of the required functionality is encapsulated in a single C++ object:
ECodedImage: this class handles runs, objects and features. These entities are stored into three separate
dynamic lists for efficient storage.
Notes.
1. EasyObject allows you to work at the run level for your own purposes.
2. The classes for which the runs and objects are built can be specified. A class receives a class
number. Two classes may receive the same class number so that they are merged. See member
functions SetBlackClass, SetNeutralClass and SetWhiteClass.
End of notes.
Runs
A run is characterized by a starting point (OrgX,OrgY), by a length, a class, a unique identification number
and the number of the object to which they belong.
After the run construction phase, all the runs are gathered in a single dynamic list.
221
Objects
Source image
Graphical representation
of detected objects
An object is characterized by a class, a unique identification number, the number of its constituent runs,
the number of its holes (if the object is a real object, not a hole), a selection flag, an identification flag (real
object or hole) and the list of its constituent runs.
After the object construction phase (real objects and eventually holes), all the objects are gathered in a
single dynamic list. The objects can be accessed by their absolute position in the list as well as by their
identification number.
Note. After a sorting operation, the objects retain their identification number, not their absolute position in
the list. End of Note.
If need be, the list of runs of an object can be traversed by means of the following functions:
GetObjNbRun, GetObjFirstRunPtr, GetObjLastRunPtr.
Features
Source image
Graphical representation of
the gravity center and the ellipse of
inertia of detected objects
222
Lists
A list in EasyObject is a sequence of elements called list items. Each list item contains a pointer to a
memory zone containing the elements data. A dynamic list can be traversed both ways, from "top" to
"bottom" or "bottom" to "top".
A "cursor" maintains the current position within the list. The following member functions are used to
traverse the list: GetFirst...Data, GetPrevious...Data, GetCurrent...Data, GetNext...Data, GetLast...Data
(the ... stand for Run or Obj, depending on the context). They directly return the element data in an
appropriate structure passed as argument.
Alternatively, the lists can be traversed by maintaining explicitly pointers to the list items. The following
functions are relevant: GetFirst...Ptr, GetPrevious...Ptr, GetCurrent...Ptr, GetNext...Ptr, GetLast...Ptr.
A list element can also be directly reached by specifying its absolute position within the list. The top
position is 0. The bottom position is given by GetNb...-1.
Declare using
#include "EObject.h"
223
2.
2.1
ECodedImage
2.1.1
ECodedImage Overview
This complex class handles runs, objects and features. These entities are stored into three separate
dynamic lists for efficient storage.
Declare using
#include "EObject.h"
2.1.2
2.1.2.1
Construction
ECodedImage: Construction
ECodedImage();
2.1.2.2
ECodedImage::Get/SetBlackClass()
INT16 GetBlackClass();
Returns the black class index. Non zero when the black runs (below the lower threshold) are coded.
void SetBlackClass(INT16 n16BlackClass= 1);
Assigns a class index to the black class (below the lower threshold). 0 means "do not code this class".
1 by default.
Parameters
n16BlackClass
ECodedImage::Get/SetNeutralClass
INT16 GetNeutralClass();
Returns the neutral class index. Non zero when the neutral runs (between both thresholds) are coded.
224
Assigns a class index to the neutral class (between both thresholds). 0 means "do not code this class".
2 by default.
Parameters
n16NeutralClass
ECodedImage::Get/SetWhiteClass
INT16 GetWhiteClass();
Returns the white class index. Non zero when the white runs (above the upper threshold) are coded.
void SetWhiteClass(INT16 n16WhiteClass= 3);
Assigns a class index to the white class (above the upper threshold). 0 means "do not code this class".
3 by default.
Parameters
n16WhiteClass
ECodedImage::Get/SetHighThreshold
UINT32 GetHighThreshold();
Sets the value of the upper threshold used for image segmentation. The threshold value is constant
over the whole image.
Parameters
un32HighThreshold
threshold value.
ECodedImage::Get/SetHighColorThreshold
EC24 GetHighColorThreshold();
Sets the value of the upper threshold used for image segmentation. The threshold value is constant
over the whole image.
Parameters
c24HighThreshold
ECodedImage::Get/SetHighImage
EGenericROI* GetHighImage();
Returns the pointer to the image used as an adaptive upper threshold, or NULL.
225
Sets the image used as an adaptive upper threshold. The threshold is adaptive, i.e. is specified pixel
by pixel.
Parameters
pHighImage
ECodedImage::Get/SetLowThreshold
UINT32 GetLowThreshold();
Sets the value of the lower threshold used for gray-level image segmentation. The threshold value is
constant over the whole image.
Parameters
un32LowThreshold
threshold value.
ECodedImage::Get/SetLowColorThreshold
EC24 GetLowColorThreshold();
Sets the value of the lower threshold used for color image segmentation. The threshold value is
constant over the whole image.
Parameters
c24LowThreshold
threshold value(EC24).
ECodedImage::Get/SetLowImage
EGenericROI* GetLowImage();
Returns the pointer to the image used as an adaptive lower threshold, or NULL.
void SetLowImage(EBW8Image* pLowImage);
Sets the value of the lower threshold used for image segmentation. The threshold value is adaptive,
i.e. is specified pixel by pixel.
Parameters
pLowImage
ECodedImage::Get/SetConnexity
enum OBJECT_CONNEXITY GetConnexity();
226
Sets the connexity mode, i.e. how neighboring pixels are considered to belong to the same objects.
Parameters
eConnexity
ECodedImage::Get/SetThreshold
UINT32 GetThreshold();
Sets the threshold mode used for gray-level image segmentation as defined by enum
IMG_THRESHOLD_MODES. By default, the "minimum residue" mode is used to determine the
threshold. The threshold is constant over the whole image.
Parameters
un32Threshold
Remarks
When using a single threshold instead of a low threshold and a high threshold, the neutral class is
ignored. Only the black and white classes are relevant.
ECodedImage::GetTrueThreshold
UINT32 GetTrueThreshold();
Sets the value of the single threshold used for image segmentation. The threshold value is adaptive,
i.e. is specified pixel by pixel.
Parameters
pImage
Remarks
When using a single threshold instead of a low threshold and a high threshold, the neutral class is
ignored. Only the black and white classes are relevant.
227
2.1.2.3
Object construction
ECodedImage::BuildObjects
void ECodedImage::BuildObjects(EROIBW8* pSrcImage);
Segments an image into connected blobs comprised of pixels of the same class.
Converts a gray-level image to white/neutral/black classes, using two thresholds, and extracts the runs
from it. Then, groups the runs to form separate objects, i.e. connected components.
Parameters
pSrcImage
Segments an image into connected blobs comprised of pixels of the same class.
Converts a color image to white/black classes, using two color thresholds, and extracts the runs from it.
Then, groups the runs to form separate objects, i.e. connected components.
Parameters
pSrcImage
Example
CodedImage.BuildObjects(&Image);
void ECodedImage::BuildObjects();
Groups the runs detected by BuildRuns to form separate objects, i.e. connected components.
Example
CodedImage.BuildObjects();
Remarks
Building objects is the process of grouping pixels from an image to form connected blobs. The pixels
are assigned class indices based either on thresholding (BuildObjects) or on the pixel values
themselves (BuildLabeledObjects). A blob is a set of connected pixels of the same class.
ECodedImage::BuildLabeledObjects
void BuildLabeledObjects(EROIBW8* pSrcImage);
Segments an image into connected blobs comprised of pixels of the same class.
Uses EBW8 information for class indices, i.e. 255 possible classes. Class 0 is not coded.
Parameters
pSrcImage
Segments an image into connected blobs comprised of pixels of the same class.
Uses EBW16 information for class indices, i.e. 65535 possible classes. Class 0 is not coded.
Parameters
pSrcImage
228
Example
CodedImage.BuildLabeledObjects(&Image);
Remarks
Building objects is the process of grouping pixels from an image to form connected blobs. The pixels
are assigned class indices based either on thresholding (BuildObjects) or on the pixel values
themselves (BuildLabeledObjects). A blob is a set of connected pixels of the same class.
ECodedImage::Get/Set MaxObjects
UINT32 GetMaxObjects();
Sets the maximum number of objects to look for. After having found that amount of object, the process
will stop and return an error message.
If not set, no maximum value is defined.
Parameters
un32Max
2.1.2.4
Feature computation
ECodedImage::AnalyseObjects
void AnalyseObjects(INT16
n16Feature3 = NULL, INT16
n16Feature6 = NULL, INT16
n16Feature9 = NULL, INT16
After an image segmentation (see BuildObjects), computes the values of given "features", i.e.
geometric parameters.
Parameters
n16Feature# [where # runs from 1 to 10]
feature code, as defined by enum OBJECT_FEATURES.
Example
CodedImage.AnalyseObjects(OBJ_AREA, OBJ_GRAVITY_CENTER_X, OBJ_GRAVITY_CENTER_Y);
ECodedImage::FeatureMinimum
void FeatureMinimum(enum OBJECT_FEATURES eFeature, FLOAT32& f32Minimum);
229
ECodedImage::FeatureMaximum
void FeatureMaximum(enum OBJECT_FEATURES eFeature, FLOAT32& f32Maximum);
ECodedImage::FeatureAverage
void FeatureAverage(enum OBJECT_FEATURES eFeature, FLOAT32& f32Average);
Computes the average of the features of all currently selected objects. This measures the central
tendancy of a population of objects.
Parameters
Feature
f32Average
ECodedImage::FeatureVariance
void FeatureVariance(enum OBJECT_FEATURES eFeature, FLOAT32& f32Average, FLOAT32&
f32Variance);
Computes the average and variance of the features of all currently selected objects. These measure
the central tendency and the dispersion of a population of objects.
Parameters
Feature
f32Average
f32Variance
ECodedImage::FeatureDeviation
void FeatureDeviation(enum OBJECT_FEATURES eFeature, FLOAT32& f32Average, FLOAT32&
f32Deviation);
Computes the average and standard deviation of the features of all currently selected objects.
Parameters
Feature
f32Average
f32Deviation
ECodedImage::ObjectConvexHull
void ObjectConvexHull(EListItem* pObject, EPathVector* pDst);
230
Parameters
pListItem
EPathVector
ECodedImage::Get/Set LimitAngle
void SetLimitAngle(FLOAT32 f32Angle);
Sets the angle of the skewed bounding box feature in the current angle unit.
FLOAT32 GetLimitAngle( );
Returns the angle of the skewed bounding box feature in the current angle unit.
Parameters
f32Angle
2.1.2.5
Object selection
ECodedImage::GetNumSelectedObjects
INT32 ECodedImage::GetNumSelectedObjects();
ECodedImage::IsObjectSelected
INT16 IsObjectSelected(INT32 n32ObjNum, BOOL& bSelected);
231
ECodedImage::SelectAllObjects
void SelectAllObjects();
Selects an object.
Parameters
n32ObjNum
Selects an object.
Parameters
pListItem
ECodedImage::UnselectAllObjects
void UnselectAllObjects();
Deselects an object.
Parameters
n32ObjNum
Deselects an object.
Parameters
pListItem
Remark
Once an object has been unselected, it doesnt allow browsing a list of selected objects anymore
(using GetPreviousObjPtr or GetNextObjPtr).
Example
// Browsing a list of objects while unselecting some of them
ECodedImage Blobs;
BOOL Selected;
232
if (condition)
{
Blobs.UnselectObject(Object);
2.1.2.6
ECodedImage::SelectObjectsUsingFeature
void SelectObjectsUsingFeature(enum OBJECT_FEATURES Feature, Type Min, Type Max,
enum SELECT_OPTIONS Operation);
Remarks
The Min and Max arguments may have types INT8, INT16, INT32, FLOAT32 or FLOAT64, depending
on the feature code.
Example
CodedImage.SelectObjectsUsingFeature(OBJ_PIXEL_MIN, 0, 20, OBJ_INSERT_RANGE);
ECodedImage::SelectObjectsUsingPosition
void SelectObjectsUsingPosition(INT32 n32OrgX, INT32 n32OrgY, INT32 n32Width, INT32
n32Height, enum SELECT_BY_POSITION Operation);
Selects or deselects objects, using a delimiting rectangle. The rectangle coordinates are always
specified with respect to the whole image.
Parameters
n32OrgX
n32OrgY
n32Width
n32Height
Operation
Example
CodedImage.SelectObjectsUsingPosition(100, 100, 200, 200, OBJ_INSERT_IN);
void SelectObjectsUsingPosition(EImage/ROI...* pROI, enum SELECT_OPTIONS Operation);
Example
EROIBW8 Image;
EROIBW8 ROI(&Image, 100, 100, 200, 200);
CodedImage.SelectObjectsUsingPosition(&ROI, OBJ_INSERT_IN);
ECodedImage::SortObjectsUsingFeature
void SortObjectsUsingFeature(enum OBJECT_FEATURES Feature, enum SORT_OPTIONS
Operation);
Example
CodedImage.SortObjectsUsingFeature(OBJ_PIXEL_MIN, OBJ_SORT_ASCENDING);
2.1.2.7
Drawing
ECodedImage::Get/Set DrawDiagonals
BOOL GetDrawDiagonals ();
Specifies whether the limit rectangle diagonals must be drawn or not. If set to TRUE (which is the
default value), diagonals are drawn.
Parameters
bDrawDiagonals
ECodedImage::DrawObjects
void DrawObjects(HDC hDC, enum E_SELECTION_MODE eSelectionMode= E_SELECTED_TRUE,
FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32 f32PanX= 0.f, FLOAT32 f32PanY=
0.f);
234
Draws all objects in solid color. Drawing is done in the device context associated to the desired
window. The current pen is used for all objects (to vary the colors, draw the objects separately using
the DrawObject method instead). Optionally, only the selected or deselected objects can be drawn.
Parameters
hDC
eSelectionMode
f32ZoomX
f32ZoomY
f32PanX
f32PanY
ECodedImage::DrawObjectsFeature
void DrawObjectsFeature(HDC hDC, enum OBJECT_FEATURES eFeature, enum
E_SELECTION_MODE eSelectionMode= E_SELECTED_TRUE, FLOAT32 f32ZoomX= 1.f, FLOAT32
f32ZoomY= 0.f, FLOAT32 f32PanX= 0.f, FLOAT32 f32PanY= 0.f);
Draws a graphical representation of a feature. Drawing is done in the device context associated to the
desired window. The current pen is used for all objects (to vary the colors, draw the objects separately
using the DrawObjectFeature method instead). Optionally, only the selected or deselected objects can
be drawn.
Only the following features can be drawn:
eSelectionMode
f32ZoomX
f32ZoomY
f32PanX
f32PanY
235
ECodedImage::DrawObject
void DrawObject(HDC hDC, INT32 n32ObjectNumber, FLOAT32 f32ZoomX= 1.f, FLOAT32
f32ZoomY= 0.f, FLOAT32 f32PanX= 0.f, FLOAT32 f32PanY= 0.f);
void DrawObject(HDC hDC, EListItem* pObject, FLOAT32 f32ZoomX= 1.f, FLOAT32
f32ZoomY= 0.f, FLOAT32 f32PanX= 0.f, FLOAT32 f32PanY= 0.f);
Draws the designated object in solid color. Drawing is done in the device context associated to the
desired window. The current pen is used. The objects can be specified either by number of by list
pointer.
Parameters
hDC
n32ObjectNumber
pObject
f32ZoomX
f32ZoomY
f32PanX
f32PanY
ECodedImage::DrawObjectFeature
void DrawObjectFeature(HDC hDC, enum OBJECT_FEATURES eFeature, EListItem* pObject,
FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32 f32PanX= 0.f, FLOAT32 f32PanY=
0.f);
void DrawObjectFeature(HDC hDC, enum OBJECT_FEATURES eFeature, INT32
n32ObjectNumber, FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32 f32PanX= 0.f,
FLOAT32 f32PanY= 0.f);
Draws a graphical representation of a feature of the designated object in solid color. Drawing is done in
the device context associated to the desired window. The current pen is used. The objects can be
specified either by number of by list pointer.
If a required feature has not been computed for some object, nothing is drawn and no error message is
issued !
Parameters
hDC
eFeature
n32ObjectNumber
pObject
f32ZoomX
f32ZoomY
f32PanX
f32PanY
236
ECodedImage::Drawn Features
OBJ_GRAVITY_CENTER_X
OBJ_GRAVITY_CENTER_Y
OBJ_LIMIT_CENTER_X
OBJ_LIMIT_CENTER_Y
OBJ_LIMIT_WIDTH
OBJ_LIMIT_HEIGHT
OBJ_LIMIT45_CENTER_X
OBJ_LIMIT45_CENTER_Y
OBJ_LIMIT45_WIDTH
OBJ_LIMIT45_HEIGHT
OBJ_LIMIT22_CENTER_X
OBJ_LIMIT22_CENTER_Y
OBJ_LIMIT22_WIDTH
OBJ_LIMIT22_HEIGHT
OBJ_LIMIT68_CENTER_X
OBJ_LIMIT68_CENTER_Y
OBJ_LIMIT68_WIDTH
OBJ_LIMIT68_HEIGHT
OBJ_FERET_CENTER_X
OBJ_FERET_CENTER_Y
OBJ_FERET_WIDTH
OBJ_FERET_HEIGHT
OBJ_FERET_ANGLE
OBJ_ELLIPSE_WIDTH
OBJ_ELLIPSE_HEIGHT
OBJ_ELLIPSE_ANGLE
OBJ_CENTROID_X
OBJ_CENTROID_Y
2.1.2.8
Object management
ECodedImage::GetCurrentObjData
void GetCurrentObjData(EObjectData* pObjData);
237
ECodedImage::GetFirstObjData
void GetFirstObjData(EObjectData* pObject);
Moves the cursor to the first object and returns the associated data.
Parameters
pObject
ECodedImage::GetLastObjData
void GetLastObjData(EObjectData* pObject);
Moves the cursor to the last object and returns the associated data.
Parameters
pObject
ECodedImage::GetPreviousObjData
void GetPreviousObjData(EObjectData* pObject);
Moves the cursor to the previous object and returns the associated data.
Parameters
pObject
ECodedImage::GetNextObjData
void GetNextObjData(EObjectData* pObject);
Moves the cursor to the next object and returns the associated data.
Parameters
pObject
ECodedImage::GetCurrentObjPtr
EListItem* GetCurrentObjPtr();
238
ECodedImage::GetPreviousObjPtr
EListItem* GetPreviousObjPtr(EListItem* pListItem);
ECodedImage::GetNextObjPtr
EListItem* GetNextObjPtr(EListItem* pListItem);
ECodedImage::GetObjDataPtr
EObjectData* GetObjDataPtr(EListItem* pListItem);
Returns a pointer to the object data associated to an object list item. Also see GetCurrentObjData.
Parameters
pListItem
ECodedImage::GetObjectData
void GetObjectData(EObjectData* pObject, INT32 n32ObjNum);
Moves the cursor to the object with a given identification number and returns the associated data.
Parameters
pObject
n32ObjNum
Returns the object data associated to an object list item. Also see GetCurrentObjData.
Parameters
pObject
pListItem
ECodedImage::GetNumObjects
INT32 ECodedImage::GetNumObjects();
ECodedImage::GetObjPtr
EListItem* GetObjPtr(INT32 n32ObjNum);
ECodedImage::GetObjPtrByCoordinates
EListItem* GetObjPtrByCoordinates(INT32 n32X, INT32 n32Y);
Returns a pointer to the object list item that contains the point of given coordinates, or NULL. This
function is useful for object selection with a mouse.
Parameters
n32X
n32Y
point abscissa.
point ordinate.
ECodedImage::GetObjPtrByPos
EListItem* GetObjPtrByPos(INT32 n32Position);
Returns a pointer to the object list item of given absolute position, or NULL.
Parameters
n32Position
ECodedImage::GetObjLastRunPtr
EListItem* GetObjLastRunPtr(EListItem* pListItem);
ECodedImage::RemoveAllObjects
void RemoveAllObjects();
240
2.1.2.9
Hole construction
ECodedImage::BuildHoles
void ECodedImage::BuildHoles();
pointer to the object list item, for which the holes have to be computed.
Example
EImageBW8 SrcImage;
ECodedImage CodedImage;
// Construct objects
CodedImage.BuildObjects(&SrcImage);
// Construct all holes
CodedImage.BuildHoles();
Remarks
Building holes requires two preliminary steps: the construction of real objects and the selection of
objects on which the hole detection has to be performed.
At the end of the object construction, all the objects are selected.
241
ECodedImage::GetNumHoles
INT32 ECodedImage::GetNumHoles(EListItem* pObject=NULL);
Returns the number of holes related to the specified object. If the parameter is NULL, this function
returns the total number of holes added to the object list.
Parameters
pObject
pointer to the object list item, for which the holes have to be counted.
Example
EImageBW8 SrcImage;
ECodedImage CodedImage;
// Construct objects
CodedImage.BuildObjects(&SrcImage);
// Construct all holes
CodedImage.BuildHoles();
// Count added holes
CodedImage.GetNumHoles();
Remarks
By default, the parameter is set to NULL, meaning that all the holes have to be counted.
After a call to the ECodedImage::BuildHoles function, the ECodedImage::GetNumObjects and
ECodedImage::GetNumSelectedObjects functions return the total number of objects (i.e. real objects +
holes).
ECodedImage::GetFirstHole
EListItem* ECodedImage::GetFirstHole(EListItem* pParentObject);
pointer to the object list item, for which the first hole has to be pointed out.
Remarks
If pParentObject refers to a hole (instead of a real object) or to an object comprising no hole, the
ECodedImage::GetFirstHole function returns NULL.
ECodedImage::GetNextHole
EListItem* ECodedImage::GetNextHole(EListItem* pHole);
Returns a pointer to the hole following the specified hole, in the object list.
Parameters
pHole
pointer to the hole list item, for which the following hole has to be pointed
out.
Remarks
If there is no hole yet in the list, the ECodedImage::GetNextHole function returns NULL
242
ECodedImage::GetHoleParentObject
EListItem* ECodedImage::GetHoleParentObject(EListItem* pHole);
pointer to the hole list item, for which the parent object has to be pointed
out.
ECodedImage::SelectHoles
void ECodedImage::SelectHoles(EListItem* pParentObject=NULL);
Selects the holes related to the specified object. If the parameter is NULL, all the holes are selected.
Parameters
pParentObject
pointer to the object list item, for which the holes have to be selected.
Example
EImageBW8 SrcImage;
ECodedImage CodedImage;
// Construct objects
CodedImage.BuildObjects(&SrcImage);
// Construct all holes
CodedImage.BuildHoles();
// Select added holes
CodedImage.SelectHoles();
Remarks
By default, the parameter is set to NULL, meaning that all the holes have to be selected.
If pParentObject is a hole (instead of a real object) or has no hole, no selection is performed.
ECodedImage::UnselectHoles
void ECodedImage::UnselectHoles(EListItem* pParentObject=NULL);
Unselects the holes related to the specified object. If the parameter is NULL, all the holes are
unselected.
Parameters
pParentObject
pointer to the object list item, for which the holes have to be unselected.
Example
EImageBW8 SrcImage;
ECodedImage CodedImage;
// Construct objects
CodedImage.BuildObjects(&SrcImage);
// Construct all holes
CodedImage.BuildHoles();
// Select added holes
CodedImage.SelectHoles();
// Unselect added holes
CodedImage.UnselectHoles();
243
Remarks
By default, the parameter is set to NULL, meaning that all the holes have to be unselected.
If pParentObject is a hole (instead of a real object) or if pParentObject has no hole, nothing is changed.
ECodedImage::RemoveHoles
void ECodedImage::RemoveHoles(EListItem* pObject=NULL);
Permanently erases, from the object list, holes related to the specified object. If the parameter is NULL,
all the holes are deleted.
Parameters
pObject
pointer to the object list item, for which the holes have to be erased.
Example
EImageBW8 SrcImage;
ECodedImage CodedImage;
// Construct objects
CodedImage.BuildObjects(&SrcImage);
// Construct all holes
CodedImage.BuildHoles();
// Remove all holes
CodedImage.RemoveHoles();
Remarks
By default, the parameter is set to NULL, meaning that all the holes have to be erased from the object
list.
Converts a gray level image to white/neutral/black, using two thresholds, and extracts the runs from it.
Parameters
pSrcImage
Converts a color image to white/black, using two color thresholds, and extracts the runs from it.
Parameters
pSrcImage
Example
CodedImage.BuildRuns(&Image);
Remarks
Building runs is the process of grouping pixels from an image to form horizontal segments. The pixels
are assigned class indices based either on thresholding (BuildRuns) or on the pixel values themselves
(BuildLabeledRuns). A run is a set of horizontally connected pixels of the same class.
244
ECodedImage::BuildLabeledRuns
void BuildLabeledRuns(EROIBW8* pSrcImage);
Extracts the runs from the image by comparing adjacent pixel values.
Uses EBW8 information for class indices, i.e. 255 possible classes. Class 0 is not coded.
Parameters
pSrcImage
Extracts the runs from the image by comparing adjacent pixel values.
Uses EBW16 information for class indices, i.e. 65535 possible classes. Class 0 is not coded.
Parameters
pSrcImage
Example
CodedImage.BuildLabeledRuns(&Image);
Remarks
Building runs is the process of grouping pixels from an image to form horizontal segments. The pixels
are assigned class indices based either on thresholding (BuildRuns) or on the pixel values themselves
(BuildLabeledRuns). A run is a set of horizontally connected pixels of the same class.
Moves the cursor to the first run and returns the associated data.
Parameters
pRun
ECodedImage::GetLastRunData
void GetLastRunData(ERunData* pRun);
Moves the cursor to the last run and returns the associated data.
Parameters
pRun
245
ECodedImage::GetPreviousRunData
void GetPreviousRunData(ERunData* pRun);
Moves the cursor to the previous run and returns the associated data.
Parameters
pRun
ECodedImage::GetNextRunData
void GetNextRunData(ERunData* pRun);
Moves the cursor to the next run and returns the associated data.
Parameters
pRun
ECodedImage::GetCurrentRunPtr
EListItem* GetCurrentRunPtr();
ECodedImage::GetLastRunPtr
EListItem* GetLastRunPtr();
246
ECodedImage::SetLastRunPtr
INT16 SetLastRunPtr(EListItem* pFirstRun, INT32 n32ObjNum);
ECodedImage::GetPreviousRunPtr
EListItem* GetPreviousRunPtr(EListItem* pListItem);
ECodedImage::GetNextRunPtr
EListItem* GetNextRunPtr(EListItem* pListItem);
ECodedImage::GetRunDataPtr
ERunData* GetRunDataPtr(EListItem* pListItem);
Returns a pointer to the run data associated to a run list item. Also see GetCurrentRunData.
Parameters
pListItem
ECodedImage::GetRunData
void GetRunData(ERunData* pRun, INT32 n32Position);
Moves the cursor to the run at a given absolute position and returns the associated data.
Parameters
pRun
n32Position
247
Returns the run data associated to a run list item. Also see GetCurrentRunData.
Parameters
pRun
pListItem
ECodedImage::GetNumRuns
INT32 ECodedImage::GetNumRuns();
Returns the total number of hole runs in the list of object runs.
Remarks
After a call to the ECodedImage::BuildHoles function, the ECodedImage::GetNumRuns function
returns the total number of runs (i.e. real object runs + hole runs).
ECodedImage::GetObjFirstRunPtr
EListItem* GetObjFirstRunPtr(INT32 n32ObjNum);
ECodedImage::GetNumObjectRuns
INT32 GetNumObjectRuns(INT32 n32ObjNum);
248
ECodedImage::GetRunPtr
EListItem* GetRunPtr(INT32 n32Position);
Returns a pointer to the run list item of given absolute position, or NULL.
Parameters
n32Position
ECodedImage::GetRunPtrByCoordinates
EListItem* GetRunPtrByCoordinates(INT32 n32X, INT32 n32Y);
Returns a pointer to the run list item that contains the point of given coordinates, or NULL. This
function is useful for run selection with a mouse.
Parameters
n32X
n32Y
point abscissa.
point ordinate.
ECodedImage::RemoveAllRuns
void RemoveAllRuns();
249
Parameters
eFeature
pObject
Result
Remarks
Result can be of type INT8, INT16, INT32, FLOAT32 or FLOAT64.
INT16 GetObjectFeature(enum OBJECT_FEATURES eFeature, INT32 n32ObjNum, Type&
Result);
Remarks
Result can be of type INT8, INT16, INT32, FLOAT32 or FLOAT64.
INT16 GetObjectFeature(EListItem* pCurrentFeature, INT32 n32ObjNum,Type& Result);
Remarks
Result can be of type INT8, INT16, INT32, FLOAT32 or FLOAT64.
ECodedImage::AddFeat
void AddFeat(EFeatureData* pFeat, INT32 n32NbObj);
ECodedImage::BlankFeatures
void BlankFeatures();
250
ECodedImage::GetFeatDataPtr
EFeatureData* GetFeatDataPtr(EListItem* pCurrentFeature);
Returns a pointer to the EFeatureData struct associated to a given feature list item, or NULL.
Parameters
pCurrentFeature
ECodedImage::GetFeatDataSize
INT32 GetFeatDataSize(INT32 n32Position);
Returns the data size of a feature at an absolute position, as defined by enum DATA_SIZE.
Parameters
n32Position
pObject
ECodedImage::GetFeatDataType
INT32 GetFeatDataType(INT32 n32Position);
Returns the data type of a feature at an absolute position, as defined by enum DATA_TYPE.
Parameters
n32Position
251
ECodedImage::GetFeatNum
INT32 GetFeatNum(INT32 n32Position);
ECodedImage::GetFeatPtrByNum
EListItem* GetFeatPtrByNum(INT32 n32NumFeat);
Returns a pointer to the feature list item for a given feature number, or NULL.
Parameters
n32NumFeat
ECodedImage::GetFeatSize
INT32 GetFeatSize(INT32 n32Position);
Returns the size (number of elements) of the feature array for a feature at an absolute position.
Parameters
n32Position
Returns the size (number of elements) of the feature array for a given feature.
Parameters
pCurrentFeature
ECodedImage::GetNumFeatures
INT32 GetNumFeatures();
252
ECodedImage::SetFeatInfo
void SetFeatInfo(EFeatureData* pFeature, INT16 n16Feature);
Sets the appropriate data size and type for a predefined feature.
Parameters
pFeat
n16Feature
2.1.2.14 Geometry
ECodedImage::GetYOriginOffset
INT32 GetYOriginOffset();
Returns the Y offset between the upper border of the current image and the top of the highest object in
the objects set. In the continuous object building mode, the top of this object is taken as a reference so
that all ordinates remain positive.
253
3.
FUNCTIONS
3.1
Features computation
ObjContourArea
void ObjContourArea(EPathVector* pPathVector, INT32& n32Area);
Declare using
#include "EObject.h"
ObjContourGravityCenter
void ObjContourGravityCenter(EPathVector* pPathVector, INT32& n32Area, FLOAT32&
f32GravityCenterX, FLOAT32& f32GravityCenterY);
Computes the area and gravity center of an object from its contour.
Parameters
pPathVector
n32Area
f32GravityCenterX
f32GravityCenterY
Declare using
#include "EObject.h"
ObjContourInertia
void ObjContourInertia(EPathVector* pPathVector, INT32& n32Area, FLOAT32&
f32GravityCenterX, FLOAT32& f32GravityCenterY, FLOAT32& f32SigmaX, FLOAT32&
f32SigmaY, FLOAT32& f32SigmaXY);
254
4.
ENUMERATION CONSTANTS
4.1
enum OBJECT_CONNEXITY
Contour connexity
OBJ_CONNEXITY_4
OBJ_CONNEXITY_8
4.2
enum OBJECT_FEATURES
255
OBJ_FERET_CENTER_Y
OBJ_FERET_WIDTH
OBJ_FERET_HEIGHT
OBJ_FERET_ANGLE
OBJ_CONTOUR_X
OBJ_CONTOUR_Y
OBJ_PIXEL_MIN
OBJ_PIXEL_MAX
OBJ_SIGMA_X
OBJ_SIGMA_Y
OBJ_SIGMA_XY
OBJ_SIGMA_XX
OBJ_SIGMA_YY
OBJ_ELLIPSE_WIDTH
OBJ_ELLIPSE_HEIGHT
OBJ_ELLIPSE_ANGLE
OBJ_CENTROID_X
OBJ_CENTROID_Y
OBJ_PIXEL_GRAY_AVERAGE
OBJ_PIXEL_GRAY_VARIANCE
Remarks
To compute the features, we adopt the convention that the pixel centers are located at integer
coordinates. For instance, the center of pixel with indices (0,0) has coordinates (0.0,0.0), not (0.5,0.5)
as one could expect.
4.3
enum RUN_TYPE
OBJ_CODE_RUN_WHITE
OBJ_CODE_RUN_NEUTRAL
OBJ_CODE_RUN_BLACK
256
4.4
enum SELECT_OPTIONS
OBJ_INSERT_ALL
OBJ_INSERT_GREATER_OR_EQUAL
OBJ_INSERT_LESSER_OR_EQUAL
OBJ_INSERT_RANGE
4.5
enum SELECT_BY_POSITION
OBJ_INSERT_IN
OBJ_INSERT_TOUCH
OBJ_INSERT_OUT
OBJ_REMOVE_IN
OBJ_REMOVE_TOUCH
OBJ_REMOVE_OUT
OBJ_REMOVE_BORDER
4.6
enum SORT_OPTIONS
OBJ_SORT_ASCENDING
OBJ_SORT_DESCENDING
257
5.
STRUCTURES
5.1
EFeatureData structure
Members
n32Size
n32FeatNum
n32FeatDataType
n32FeatDataSize
hpvStartPtr
hpvEndPtr
5.2
EObjectData structure
Members
n32Class
n32ObjNum
n32ObjNbRun
n32ObjNbHole
un8IsSelected
hpvReserved1
hpvReserved2
bIsHole
hpvParent
258
Class code.
Identification number.
Number of runs.
Number of holes.
Selection flag.
Reserved.
Reserved.
TRUE if the object is a hole, FALSE otherwise.
Pointer to its parent, if the object is a hole.
hpvFirstHole
hpvNextHole
5.3
ERunData structure
Members
n32OrgX
n32OrgY
n32Len
n32Class
n32ObjNum
hpvReserved
5.4
EListItem structure
struct {
struct EListStruct* pPrev;
INT8* pn8Data;
struct EListStruct* pNext;
} EListItem;
Members
pPrev
pn8Data
pNext
259
6.
SAMPLE PROGRAMS
The available sample programs dedicated to the EasyObject library are the following:
ObjInertia: performs segmentation of an image into objects and draws their ellipse of
inertia. Explains how object features can be computed and retrieved.
ObjObjects: performs segmentation of an image into objects and illustrates how to obtain
the runs that constitute a given object.
Remarks
The corresponding projects for Microsoft Visual C++ can be found in the eVision\MsVc Samples subfolder, the projects for Borland C++ Builder are located in the eVision\BcB Samples sub-folder, while
the projects for RedHat are in the /usr/local/euresys/eVision/samples/wxWidgets/ObjObjects subfolder.
260
1.
EASYGAUGE INTRODUCTION
The EasyGauge library contains functions devoted to the accurate measurement of object dimensions.
It relies on a robust algorithm for edge detection. The library includes the following categories of
operations:
Point Location: provides the position of the best transition points along a line segment probe that
crosses one or several objects edges;
Model Fitting: adjusts a predefined geometric model over a portion of the edge of an object. The
models that can be fit are the line segment and the circle arc, the rectangle and the wedge.
Put together, these basic operations virtually allow obtaining any geometric measurement on a part.
All of the required functionality are encapsulated in the following specific C++ objects:
263
2.
2.1
2.1.1
For the sake of conciseness, members that are common to the above EasyGauge classes have been
gathered hereafter.
The gauge position section allows positioning the gauge.
Gauge grouping manages the association of measurement gauges.
The transition parameters allow specifying the type of transition to look for and qualifying the transition
validity.
The Measurement section allows triggering the measurement (a point location or a model fitting) and
setting the sampling and filtering parameters.
Measurement results provide information about the located point or the fitted model.
Graphical interaction handles the drawing and the dragging.
Persistent storage allows saving and loading the measurement context.
Miscellaneous provides information about the measurement context.
Declare using
#include "EGauge.h"
#include "EInspect.h"
2.1.2
2.1.2.1
Gauge copying
EGauge::CopyTo
EPointGauge* EPointGauge::CopyTo(EPointGauge* pGauge, BOOL bRecursive) const;
ELineGauge* ELineGauge::CopyTo(ELineGauge* pGauge, BOOL bRecursive) const;
ECircleGauge* ECircleGauge::CopyTo(ECircleGauge* pGauge, BOOL bRecursive) const;
ERectangleGauge* ERectangleGauge::CopyTo(ERectangleGauge* pGauge, BOOL bRecursive)
const;
EWedgeGauge* EWedgeGauge::CopyTo(EWedgeGauge* pGauge, BOOL bRecursive) const;
Copies all the parameters of the current EGauge object into another EGauge object and returns it.
264
Parameters
pGauge
bRecursive
Example
ELineGauge Line1, Line2;
// Copy Line1 into Line2
Line1.CopyTo(&Line2, FALSE);
Remarks
In case of a NULL pointer, a new EGauge object will be created and returned.
EGauge::Operator=
EPointGauge& EPointGauge::operator=(const EPointGauge& Gauge);
ELineGauge& ELineGauge::operator=(const ELineGauge& Gauge);
ECircleGauge& ECircleGauge::operator=(const ECircleGauge& Gauge);
ERectangleGauge& ERectangleGauge::operator=(const ERectangleGauge& Gauge);
EWedgeGauge& EWedgeGauge::operator=(const EWedgeGauge& Gauge);
Copies all the parameters of the current EGauge object into another EGauge object.
The gauge children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
Gauge
Example
ECircleGauge Circle1, Circle2;
// Copy Circle1 into Circle2
Circle2=Circle1;
Remarks
The EGauge objects are always included in a hierarchy of similar objects.
In this hierarchy, an object owns:
siblings: objects at the same level than the object to be copied (siblings have the same direct
parent).
The object newly copied by the assignment operator has the following properties:
265
2.1.2.2
Gauge position
EGauge::Get/Set Center
EPoint GetCenter();
Remarks
The position of a point location or model fitting gauge is given by the coordinates of its center.
By default, the center coordinate of the nominal gauge is (0, 0).
2.1.2.3
Gauge grouping
EGauge::Attach
void Attach(EShape* pMother);
Remark
When attached to a mother gauge, be aware that daughter gauges are not positioned according to the
nominal mother gauge position, but to its corresponding fitted model.
EGauge::Detach
void Detach();
266
EGauge::GetMother
EShape* GetMother();
EGauge::GetShapeNamed
EShape* GetShapeNamed(const char* pszName);
2.1.2.4
Gauge behavior
EGauge::Get/Set Active
BOOL GetActive();
bDaughters
flag indicating whether the daughters shapes inherit of the same behavior.
Remarks
When complex gauging is required, several gauges can be grouped together. Applying Process to the
mother gauge or shape triggers the measurement of the whole. Only the active gauges will participate
in the process.
By default, the gauge is active (TRUE).
EGauge::Get/Set Labeled
BOOL GetLabeled();
Returns the flag indicating whether the gauge label should be displayed or not.
267
Sets the flag indicating whether the gauge label should be displayed or not.
Parameters
bLabeled
bDaughters
flag indicating whether the gauge label should be displayed (TRUE) or not
(FALSE).
flag indicating whether the daughters shapes inherit of the same behavior.
Remarks
The label consists of the gauge name, its corresponding located point or fitted model position, size and
rotation angle. If the gauge is not active or if any point or model have been found, the label displays the
position, size and rotation angle of the nominal gauge.
By default, the gauge label is not displayed (FALSE).
EGauge::Get/Set OptionalDraw
BOOL GetOptionalDraw();
Returns the flag indicating whether the gauge transition symbol should be displayed or not.
void SetOptionalDraw(BOOL bOptionalDraw, BOOL bDaughters= FALSE);
Sets the flag indicating whether the gauge transition symbol should be displayed or not.
Parameters
bOptionalDraw
bDaughters
Remarks
By default, the gauge transition symbol is displayed (TRUE).
EGauge::Get/Set QuickDraw
BOOL GetQuickDraw();
Returns the flag indicating whether the gauge appearing in a distorted field of view should be drawn
quickly but inaccurately or slowly but exactly.
void SetQuickDraw(BOOL bQuicklDraw, BOOL bDaughters= FALSE);
Sets the flag indicating whether the gauge appearing in a distorted field of view should be drawn
quickly but inaccurately or slowly but exactly.
Parameters
bQuickDraw
bDaughters
Remarks
Get/Set QuickDraw is only relevant when perspective or optical distortion is handled.
By default, the gauges are quickly drawn (TRUE).
268
2.1.2.5
Transition parameters
EGauge::Get/Set TransitionType
enum GGE_TRANSITION_TYPE GetTransitionType();
Remarks
The type of a transition tells whether it crosses increasing or decreasing gray level values. This helps
discriminate between nearby edges of an object.
By default, the searched transition type is indifferently a black to white or a white to black transition
(GGE_BW_OR_WB)
EGauge::Get/Set TransitionChoice
enum GGE_TRANSITION_CHOICE GetTransitionChoice();
Remarks
Several peaks may be detected along a point location gauge. This parameter helps to select the
appropriate transition. In case of GGE_NTH_FROM_BEGIN or GGE_NTH_FROM_END transition
choice, use SetTransitionIndex to specify the desired transition.
By default, the selected transition corresponds to the one with the largest amplitude
(GGE_LARGEST_AMPLITUDE).
EGauge::Get/Set TransitionIndex
UINT32 GetTransitionIndex();
Returns the index (from 0 on) of the transition to be retained when the transition choice parameter is
set to GGE_NTH_FROM_BEGIN or GGE_NTH_FROM_END.
void SetTransitionIndex(UINT32 un32Index);
Sets the index (from 0 on) of the transition to be retained when the transition choice parameter is set to
GGE_NTH_FROM_BEGIN or GGE_NTH_FROM_END.
Parameters
un32Index
269
Remarks
Several peaks may be detected along a point location gauge. This parameter helps to select the
desired transition.
By default, the first transition is retained (the index value is 0).
EGauge::Get/Set Threshold
UINT32 GetThreshold();
Returns the threshold level used to delimit significant peaks in the data profile.
void SetThreshold(UINT32 un32Threshold);
Sets the threshold level used to delimit significant peaks in the data profile.
Parameters
un32Threshold
threshold level used to delimit significant peaks in the data profile. The
default value is 20.
Remarks
When analyzing a derivative profile, a peak is made up of consecutive pixel values above the
Threshold. To detect weak [strong] transitions, lower [raise] the threshold value.
To avoid interference of noise, an additional parameter is provided. The "MinAmplitude" parameter is
an offset added to the Threshold when a peak is to be detected.
When the pixel values of the derivative profile do not reach Threshold + MinAmplitude, the peak is not
taken into account. Anyway, when a peak is taken into account, all the pixels with values above
Threshold are considered (for more accuracy). Setting the MinAmplitude value to 0 merely cancels its
effect.
EGauge::Get/Set MinAmplitude
UINT32 GetMinAmplitude();
offset added to the Threshold value to improve the noise immunity. The
default value is 10.
Remarks
When analyzing a derivative profile, a peak is made up of consecutive pixel values above the
Threshold. To detect weak [strong] transitions, lower [raise] the Threshold value.
To avoid interference of noise, an additional parameter is provided. The "MinAmplitude" parameter is
an offset added to the Threshold when a peak is to be detected.
When the pixel values of the derivative profile do not reach Threshold + MinAmplitude, the peak is not
taken into account. Anyway, when a peak is taken into account, all the pixels with values above
Threshold are considered (for more accuracy). Setting the MinAmplitude value to 0 merely cancels its
effect.
270
EGauge::Get/Set MinArea
UINT32 GetMinArea ();
the minimum area between the peak curve and the horizontal at the
"Threshold" level to validate the transition. The default value is 0.
Remarks
A transition is detected if its derivative peak reaches the Threshold (+MinAmplitude) value, and then
declared valid if the area between the peak curve and the horizontal at level "Threshold" reaches the
MinArea value.
EGauge::Get/Set Thickness
UINT32 GetThickness();
Returns the number of parallel segments used to extract the data profile.
void SetThickness(UINT32 un32Thickness);
Sets the number of parallel segments used to extract the data profile.
Parameters
un32Thickness
number of parallel segments used to extract the data profile. The default
value is 1.
Remarks
To reduce the effect of noise and/or strengthen a transition, several parallel profiles can be
accumulated.
EGauge::Get/Set RectangularSamplingArea
BOOL GetRectangularSamplingArea();
Returns the flag indicating whether the sampling area remains a rectangle when rotated instead of
becoming a parallelogram (Refer to the User's guide for in depth information).
void SetRectangularSamplingArea(BOOL bRectangularSamplingArea);
Sets the flag indicating whether the sampling area remains a rectangle when rotated instead of
becoming a parallelogram (Refer to the User's guide for in depth information).
Parameters
bRectangularSamplingArea flag indicating whether the sampling area remains a rectangle (TRUE) or
becomes a parallelogram (FALSE) when rotated.
Remarks
This method is only useful when the thickness transition parameter is greater than 1. In fact, when
thickness transition parameter is equal to 1, rectangle and parallelogram reduce to the same segment.
By default, this flag is set to TRUE (the sampling area always remains a rectangle).
271
EGauge::Get/Set Smoothing
UINT32 GetSmoothing();
Returns the number of pixels used for the low pass filtering operation.
void SetSmoothing (UINT32 un32Smoothing);
Sets the number of pixels used for the low pass filtering operation.
Parameters
n32Smoothing
Remarks
To reduce the effect of noise, the profile data can be low pass filtered along the point location gauge
direction.
2.1.2.6
Measurement
EGauge::Measure
void Measure(EROIBW8* pSrc);
Remarks
When this method is called, and if not enough valid points are detected, then the method returns
directly, and the measured gauge is set to the nominal parameters.
EGauge::Process
void Process(EROIBW8* pSrc, BOOL bDaughters= TRUE);
Triggers the process pertaining to a shape or gauge and all the daughter gauges attach to it.
Parameters
pSrc
bDaughters
Remarks:
When complex gauging is required, several gauges can be grouped together. Applying Process to the
mother gauge or shape triggers the measurement of the whole. Only the active gauges will participate
in the process.
EGauge::MeasureSample
void EGauge::MeasureSample(EROIBW8* pSrc, UINT32 un32PathIndex);
Computes the sample point along the sample path whose index in the list is given by the
un32PathIndex parameter. This method stores its results into a temporary variable inside the
E...Gauge object.
272
Parameters
pSrc
un32PathIndex
Remarks
As differences exist between EPointGauge and others E...Gauge (see E...Gauge::GetMeasuredPoint),
it is important to note that E...Gauge::MeasureSample is not a method of EPointGauge.
EGauge::Get/Set ActualShape
BOOL GetActualShape();
Returns the flag indicating whether an inquiry returns a result pertaining to the nominal gauge (FALSE,
default) or the fitted model (TRUE).
void SetActualShape (BOOL bActualShape, BOOL bDaughters=FALSE);
Sets the flag indicating whether an inquiry returns a result pertaining to the nominal gauge (FALSE,
default) or the fitted model (TRUE).
Parameters
bActualShape
bDaughters
EGauge::Get/Set SamplingStep
FLOAT32 GetSamplingStep();
Returns the approximate distance between sampled points during a model fitting operation. Irrelevant
in case of a point location operation.
void SetSamplingStep(FLOAT32 f32SamplingStep);
Sets the approximate distance between sampled points during a model fitting operation. Irrelevant in
case of a point location operation.
Parameters
f32SamplingStep
Remarks
To fit a model, a series of point location operations are performed along the model. The point location
gauges spacing is given by the sampling step.
By default, the sampling step is set to 5 which means 5 pixels when the field of view has not been
calibrated and 5 "units" in case of a calibrated field of view.
Be aware that if the sampling step is too large, the number of sampled points along the model will not
be suffisant enough to accurately locate it.
EGauge::Get/Set FilteringThreshold
FLOAT32 GetFilteringThreshold();
Returns the relative filtering threshold, i.e. the fraction of the average distance between the sampled
points and the fitted model above which a point is filtered out. Irrelevant in case of a point location
operation.
273
Sets the relative filtering threshold, i.e. the fraction of the average distance between the sampled points
and the fitted model above which a point is filtered out. Irrelevant in case of a point location operation.
Parameters
f32FilteringThreshold
fraction of the average distance between the sampled points and the fitted
model above which a point is filtered out. The default value is 3.
Remarks
During a model fitting operation, the "filtering" process can be invoked to remove outliers, i.e. points
that were located significantly far away from the fitted model (so that their position is dubious).
EGauge::Get/Set NumFilteringPasses
UINT32 GetNumFilteringPasses();
Returns the number of filtering passes for a model fitting operation. During a filtering pass, the points
that are too distant from the model are discarded. Irrelevant in case of a point location operation.
void SetNumFilteringPasses(UINT32 un32NumFilteringPasses);
Sets the number of filtering passes for a model fitting operation. During a filtering pass, the points that
are too distant from the model are discarded. Irrelevant in case of a point location operation.
Parameters
un32NumFilteringPasses
number of filtering passes for a model fitting operation. The default value
is 0.
Remarks
During a model fitting operation, the "filtering" process can be invoked to remove outliers, i.e. points
that were located significantly far away from the fitted model (so that their position is dubious).
By default (the number of filtering passes is 0) the outhiers rejection process is disable.
EGauge::Get/Set HVConstraint
BOOL GetHVConstraint();
Returns the status of the restriction on the orientation of the point location gauge or model fitting
sample paths.
void SetHVConstraint(BOOL bHVConstraint);
Sets the status of the restriction on the orientation of the point location gauge or model fitting sample
paths.
Parameters
bHVConstraint
Remarks
We call "sample paths" the point location gauges placed along the model to be fitted.
274
EGauge::Get/Set MinNumFitSamples
void E...Gauge::GetMinNumFitSamples(INT32& n32Side0, INT32& n32Side1, INT32&
n32Side2, INT32& n32Side3);
Returns the minimum number of samples required for fitting on each side of the shape. Irrelevant in
case of a point location operation.
void E...Gauge::SetMinNumFitSamples(INT32 n32Side0, INT32 n32Side1= -1, INT32
n32Side2= -1, INT32 n32Side3= -1);
Sets the minimum number of samples required for fitting on each side of the shape. Irrelevant in case
of a point location operation.
Parameters
The meaning of the parameters is different among the available gauges:
ELineGauge:
n32Side0
required number of samples to correctly fit the line. The default value is 2.
It is the only parameter taken into account.
ECircleGauge:
n32Side0
required number of samples to correctly fit the circle. The default value is
3. It is the only parameter taken into account.
ERectangleGauge:
n32Side0
minimum number of samples on the top side of the rectangle. The default
value is 2.
n32Side1
minimum number of samples on the left side of the rectangle. If this value
is not specified, it is equal to n32Side0. The default value is 2.
n32Side2
minimum number of samples on the bottom side of the rectangle. If this
value is not specified, it is equal to n32Side0. The default value is 2.
n32Side3
minimum number of samples on the right side of the rectangle. If this
value is not specified, it is equal to n32Side1. The default value is 2.
EWedgeGauge:
n32Side0
minimum number of samples on the outer circle of the wedge. The
default value is 3.
n32Side1
minimum number of samples on the original border of the wedge. If this
value is not specified, it is equal to n32Side0. The default value is 2.
n32Side2
minimum number of samples on the inner circle of the wedge. If this
value is not specified, it is equal to n32Side0. The default value is 3.
n32Side3
minimum number of samples on the end border of the wedge. If this
value is not specified, it is equal to n32Side1. The default value is 2.
Remarks
When the Measure method is called, and if not enough valid points are detected, then the method
returns directly, and the measured gauge is set to the nominal parameters.
EGauge::AddSkipRange
UINT32 EGauge::AddSkipRange(const UINT32 start, const UINT32 end);
Adds an item to the set of skip ranges and returns the index of the newly added range. The samples
indices between start and end (including the boundaries) will be discarded during the measurement
process.
275
Parameters
start
end
Remarks
The EGauge::AddSkipRange method allows to define skip ranges in an E...Gauge. This means
that, at measure time, samples belonging to these ranges will not be taken into account.
A sample may belong to more than one skip range; to be discarded, a sample has to pertain to at least
one range. Moreover, the skip ranges are allowed to overlap one another.
The range is allowed to be reversed (i.e. end is not required to be greater than start).
Also, start and end are not required to reference valid indices at the time of the call (i.e. the range
may lie outside of the current return value for E...Gauge::GetNumSamples).
It is important to note that these skip ranges are not taken into account for an EPointGauge.
EGauge::GetNumSkipRanges
UINT32 EGauge::GetNumSkipRanges() const;
After a call to EGauge::AddSkipRange, returns the number of skip ranges in this gauge.
EGauge::GetSkipRange
void EGauge::GetSkipRange(const UINT32 index, UINT32& start, UINT32& end) const;
Allows to retrieve the start and end values of the skip range corresponding to the given index, if it is
valid (i.e. if it has previously been created by a call to the E...Gauge::AddSkipRange method.
Parameters
index
start
end
Remarks
Start is guaranteed to be smaller or equal to end.
EGauge::RemoveSkipRange
void EGauge::RemoveSkipRange(const UINT32 index);
After a call to EGauge::AddSkipRange, removes the skip range with the given index.
2.1.2.7
Measurement results
EGauge::RemoveAllSkipRanges
void EGauge::RemoveAllSkipRanges();
276
E...Gauge::GetMeasuredPoint
EPoint E...Gauge::GetMeasuredPoint(UINT32 un32Index = ~0);
Returns the coordinates of the point measured along a sample path. These coordinates pertain to the
World space; they are expressed in the reference frame to which the current E...Gauge object belongs.
The gauging process uses a list of sample points to find the shape position and size that best fit a
given image. These sample points are measured along sample paths defined by the gauge geometry.
Differences exist between gauges concerning:
1. The number of sample paths in the gauge: EPointGauge contains only one sample path when
the other gauges contain a list of sample paths. So, it is necessary for all gauges, but
EPointGauge, to specify the sample path along which the point should be measured.
2. The number of sample points per sample path: EPointGauge gives access to a list of sample
points along its unique sample path when other gauges limit the number of point per sample
path to one. So, it is necessary for EPointGauge to specify which sample point should be
returned (along the unique sample path).
So, even though this method is common to all gauges, its behavior is slightly different for
EPointGauge:
EPointGauge::GetMeasuredPoint has to know the point index along the sample path when others
E...Gauge::GetMeasuredPoint methods have to know the sample path index.
The sample point index along a sample path is given by the method parameter un32Index while the
sample path index is implicitly chosen by a call of E...Gauge::MeasureSample.
Thus, more precisely:
EPointGauge::GetMeasuredPoint( UINT32 un32Index = ~0) returns the coordinates of the point,
referenced by un32Index parameter, measured along the sample path defined by the EPointGauge.
Others E.. Gauge::GetMeasuredPoint( UINT32 un32Index = ~0) return the coordinates of the point
measured along the sample path inspected with the last call to E...Gauge::MeasureSample.
Note. After a call to E...Gauge::MeasureSample, E..Gauge::GetMeasuredPoint will return the
computed sample point. In this case, the parameter un32Index has no effect. It is worth noting that
E...Gauge::MeasureSample is not a method of EPointGauge. End of note.
Parameters
un32Index
index of the point among all possible detected points. This parameter is
only used by EPointGauge::GetMeasuredPoint; it has no effect for others
gauges.
The default value for this parameter is ~0 (=0xFFFFFFFF). This value
selects the default point chosen by the transition choice parameter
(managed by EPointGauge::Get/SetTransitionChoice method).
Example 1: EPointGauge
// Performs a point location
PointGauge.Measure();
// Retrieves the number of measured points
un32Num= PointGauge.GetNumMeasuredPoints();
// Verify if there is at least one measured point
If(un32Num > 0))
{
f32X= PointGauge.GetMeasuredPoint(un32Num-1).GetX();
f32Y= PointGauge.GetMeasuredPoint(un32Num-1).GetY();
}
277
Example 2: E...Gauge
// Performs a point location operation along the first sample path
ELineGauge.MeasureSample(0);
// Verify if point was found along the sample path
If(ELineGauge.GetValid())
{
// Get the resulting coordinates
f32X= ELineGauge.GetMeasuredPoint().GetX();
f32Y= ELineGauge.GetMeasuredPoint().GetY();
}
E...Gauge::GetValid
BOOL E...Gauge::GetValid();
Returns TRUE if at least one valid transition has been found. A FALSE value means that no
measurement has been performed.
Just as for E...Gauge::GetMeasuredPoint, differences exist between EPointGauge and others
E...Gauge.
So,
EPointGauge::GetValid() returns TRUE if a valid transition was found along the sample path defined
by the EPointGauge, and thus a point measured.
Others E...Gauge::GetValid() return TRUE if a valid transition was found along the sample path
inspected with the last call to MeasureSample, and thus a point measured.
Example 1: EPointGauge
// Performs a point location
PointGauge.Measure();
// Verify if point was found along the sample path
If(EPointGauge.GetValid())
{
// Get the resulting coordinates
f32X= PointGauge.GetMeasuredPoint().GetX();
f32Y= PointGauge.GetMeasuredPoint().GetY();
}
Example 2: E...GaugeExample
// Performs a point location operation along the first sample path
ELineGauge.MeasureSample(0);
// Verify if point was found along the sample path
If(ELineGauge.GetValid())
{
// Get the resulting coordinates
f32X= ELineGauge.GetMeasuredPoint().GetX();
f32Y= ELineGauge.GetMeasuredPoint().GetY();
}
278
EGauge::GetNumSamples
UINT32 GetNumSamples();
Returns the number of sampled points during the model fitting operation. Irrelevant in case of a point
location operation.
Remarks
After a model fitting operation, a number of points have been fitted along the model. Among them,
some are not reliable because of their Area value. Among the remaining ones, some are filtered out
(NumFilteringPasses, FilteringThreshold).
EGauge::GetNumValidSamples
UINT32 GetNumValidSamples();
Returns the number of valid sample points remaining after a model fitting operation. Irrelevant in case
of a point location operation.
Remarks
After a model fitting operation, a number of points have been fitted along the model. Among them,
some are not reliable because of their Area value. Among the remaining ones, some are filtered out
(NumFilteringPasses, FilteringThreshold).
EGauge::GetAverageDistance
FLOAT32 GetAverageDistance();
Returns the average distance between the sampled points and the fitted model. Irrelevant in case of a
point location operation.
EGauge::GetMeasuredPeak
EPeak GetMeasuredPeak(UINT32 un32Index=0);
Returns information pertaining to the specified derivative peak, such as its area, amplitude, start,
length and center. When fitting a line or a circle, use MeasureSample to choose the sample path along
which the peaks are to be measured. Irrelevant for the rectangle and wedge fitting operation.
Parameters
un32Index
EPoint::Distance
Many EasyGauge members provide measurement result as an EPoint object (see GetCenter,
GetMeasuredPoint, GetPoint, GetOrg, ..). The EPoint class has its own members to retrieve all the
information pertaining to a point. Among them, the Distance member returns the distance between a
point pair or between a point and a line segment, a circle arc or a rectangle.
FLOAT32 Distance(EPoint Point);
Returns the distance between the addressed point and another point.
279
bArcOnly
bEdgesOnly
Examples
// This sample code computes the distance between
// a located point and a fitted line restricted to a segment.
EPointGauge Point;
ELineGauge Line;
Point.Measure(&Src);
Line.Measure(&Src);
f32Distance= Point.GetMeasuredPoint().Distance(Line.GetMeasuredLine(), TRUE);
Circle1.Measure(&Src);
Circle2.Measure(&Src);
Circle1.SetActualShape(TRUE);
Circle2.SetActualShape(TRUE);
f32Distance= Circle1.GetCenter().Distance(Circle2.GetCenter());
2.1.2.8
Graphical interaction
EGauge::Draw
void Draw(HDC hDC, enum INS_DRAWING_MODES eDrawingMode= INS_DRAW_NOMINAL, BOOL
bDaughters= FALSE);
Draws a graphical representation of a point location or model fitting gauge as defined by enum
INS_DRAWING_MODES.
Parameters
hDC
eDrawingMode
bDaughters
280
EGauge::SetCursor
void SetCursor(INT32 n32CursorX, INT32 n32CursorY);
EGauge::HitTest
BOOL HitTest(BOOL bDaughters= TRUE);
Checks whether the cursor is positioned over a handle (TRUE) or not (FALSE).
Parameters
bDaughters
EGauge::GetHitHandle
enum INS_HANDLES GetHitHandle();
Identifies the handle currently under the cursor, as defined by enum INS_HANDLES.
Remarks
When the cursor is over a particular handle, its shape could be changed for feedback.
EGauge::GetHitShape
EShape* GetHitShape();
Moves a handle to a new position and updates the position parameters of the gauge.
Parameters
n32CursorX/Y
EGauge::Plot
void Plot(HDC hDC, enum GGE_PLOT_ITEMS eDrawItems, FLOAT32 f32Width, FLOAT32
f32Height, FLOAT32 f32OrgX= 0.f, FLOAT32 f32OrgY= 0.f);
281
Parameters
hDC
eDrawingItems
f32Width, f32Height
f32OrgX, f32OrgY
Remark
In case of a model fitting, the displayed profile is by default the one along the point location gauge
corresponding to the last located point. To obtain the plot related to another point, specify it by means
of MeasureSample.
EGauge::Get/Set Dragable
BOOL GetDragable();
Returns the flag indicating whether the gauge can be dragged or not.
void SetDragable(BOOL bDragable, BOOL bDaughters= FALSE);
Sets the flag indicating whether the gauge can be dragged or not.
Parameters
bDragable
bDaughters
flag indicating whether the gauge can be dragged (TRUE) or not (FALSE,
default).
flag indicating whether the daughters shapes inherit of the same behavior.
EGauge::Get/Set Rotatable
BOOL GetRotatable();
Returns the flag indicating whether the gauge can be rotated or not.
void SetRotatable(BOOL bRotatable, BOOL bDaughters= FALSE);
Sets the flag indicating whether the gauge can be rotated or not.
Parameters
bRotatable
bDaughters
flag indicating whether the gauge can be rotated (TRUE) or not (FALSE,
default).
flag indicating whether the daughters shapes inherit of the same behavior.
EGauge::Get/Set Resizable
BOOL GetResizable();
Returns the flag indicating whether the gauge can be resized or not.
void SetResizable(BOOL bResizable, BOOL bDaughters= FALSE);
Sets the flag indicating whether the gauge can be resized or not.
282
Parameters
bResizable
bDaughters
flag indicating whether the gauge can be resized (TRUE) or not (FALSE,
default).
flag indicating whether the daughters shapes inherit of the same behavior.
E...Gauge::Get/Set DraggingMode
enum INS_DRAGGING_MODES GetDraggingMode();
Remark
By default, the standard dragging mode is enabled (INS_DRAG_STANDARD)
2.1.2.9
Persistent storage
EGauge::Save
void Save(const char* pszPathName, BOOL bDaughters= FALSE);
Remark
After a Save operation, the results pertaining to the previous measure are not available anymore.
EGauge::Load
void Load(const char* pszPathName, BOOL bDaughters= FALSE);
283
2.1.2.10 Miscellaneous
EGauge::GetType
enum INS_SHAPE_TYPES GetType();
2.2
2.2.1
EPointGauge
EPointGauge overview
Manages a complete point measurement context, i.e. a set of geometric and other parameters required to
perform a measurement.
To perform a point measurement, create a new point measurement context and set the parameters whose
default values are not appropriated. Then, invoke the desired measurement function and get the results
from the measurement context.
When measurements are performed in a calibrated field of view, EasyGauge provides results in physical
units (mm, inch, ) rather than as a number of pixels (for more information about calibration, refer to
EWorldShape).
Point location
When one traverses a linear profile extracted from an image, along a point location gauge, an edge
appears as a transition from a dark zone to a light zone (or vice versa). When plotting the pixel values
along the gauge, this transition appears as an S-shaped curve. The first derivative of this curve exhibits a
peak around the transition point.
284
Measurement Results
After a point location has been performed, using Measure, the coordinates of the measured point are
available through:
GetMeasuredPoint
The reliability of the measurement can be assessed by observing the value of:
GetMeasuredPeak
Declare using
#include "EGauge.h"
#include "EInspect.h"
2.2.2
2.2.2.1
EPointGauge Construction
Default constructor
EPointGauge::EPointGauge();
Constructs a point measurement context. All parameters are initialized to their respective default
values.
Example
// Create an EPointGauge instance with all default values.
EPointGauge Point1;
285
Copy constructor
EPointGauge::EPointGauge(const EPointGauge& Point)
Constructs a point measurement context based on a pre-existing EPointGauge object. The gauge
children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
Point
EPointGauge object.
Example
// Create a copy of an existing EPointGauge object
EPointGauge Point2(& Point1)
2.2.2.2
Gauge Position
EPointGauge::GetTolerance
FLOAT32 GetTolerance();
Sets the half length and the rotation angle of the point location gauge.
Parameters
f32Tolerance
f32Angle
half length of the point location gauge. The default value is 10.
rotation angle of the point location gauge. The default value is 0.
Remarks
By default, the point location gauge length value is 20 (2X10), which means 20 pixels when the field of
view (FOV) is not calibrated and 20 "units" in case of a calibrated FOV.
The sign of the rotation angle depends whether the field of view is calibrated or not.
When the field of view is calibrated, the coordinate system is said to be direct, the abscissa extends
rightwards and the ordinate extends upwards. In this case, an anticlockwise rotation leads to a positive
angle value.
When the field of view is not calibrated, the coordinate system is said to be inverse, the abscissa
extends rightwards and the ordinate extends downwards. In this case, a clockwise rotation leads to a
positive angle value.
EPointGauge::GetToleranceAngle
FLOAT32 GetToleranceAngle();
Remarks
By default, the rotation angle of the point location gauge is 0.
The sign of the rotation angle depends whether the field of view is calibrated or not.
When the field of view is calibrated, the coordinate system is said to be direct, the abscissa extends
rightwards and the ordinate extends upwards. In this case, an anticlockwise rotation leads to a positive
angle value.
When the field of view is not calibrated, the coordinate system is said to be inverse, the abscissa
extends rightwards and the ordinate extends downwards. In this case, a clockwise rotation leads to a
positive angle value.
2.2.2.3
Measurement Results
EPointGauge::GetNumMeasuredPoints
UINT32 GetNumMeasuredPoints();
Returns the number of edge-crossing points along the point location gauge.
2.3
2.3.1
ELineGauge
ELineGauge overview
Manages a complete line measurement context, i.e. a set of geometric and other parameters required to
perform a measurement.
To perform a line measurement, create a new line measurement context and set the parameters whose
default values are not appropriate. Then invoke the desired measurement function and get the results
from the measurement context.
When measurements are performed in a calibrated field of view, EasyGauge provides results in physical
units (mm, inch, ) rather than as a number of pixels (for more information about calibration, refer to
EWorldShape).
Line fitting
Given an approximate initial position of the model, one performs a series of point location operations at
regularly spaced points of the model. The accurately located points on the edge can then be used to
adjust the models parameters using a least squares approach.
To improve the reliability of the process, one can apply a few "filtering" passes during which the outliers
(sample points that lie significantly far away from the model) are eliminated.
The parameters to be set can be grouped as follows:
Center: position of the center of the line;
Length: restriction of the line model to a line segment;
KnownAngle or Angle: approximate direction of the line model;
Tolerance, SamplingStep: spreading of the point location gauges along the line fitting gauge;
NumFilteringPasses, FilteringThreshold: post-filtering of the outliers.
Thickness, Smoothing: pre-filtering of the image data;
Threshold, MinAmplitude: peak detection thresholds;
TransitionType, TransitionChoice, TransitionIndex, MinArea: peak selection options.
Measurement Results
After a line fitting has been performed, using Measure, the information pertaining to the fitted line are
retrieved by means of:
GetMeasuredLine
The reliability of the measurement can be assessed by observing the value of:
GetMeasuredPeak
Declare using
#include "EGauge.h"
#include "EInspect.h"
2.3.2
2.3.2.1
ELineGauge Construction
Default constructor
ELineGauge::ELineGauge();
Constructs a line measurement context. All parameters are initialized to their respective default values.
Example
// Create an ELineGauge instance with all default values.
ELineGauge Line1;
Copy constructor
ELineGauge:: ELineGauge (const ELineGauge& Line)
Constructs a line measurement context based on a pre-existing ELineGauge object. The gauge
children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
288
Parameters
Line
ELineGauge object.
Example
// Create a copy of an existing ELineGauge object
ELineGauge Line2(& Line1)
2.3.2.2
Gauge Position
ELineGauge::Set
void Set(ELine Line);
Sets the nominal position, length and rotation angle of the line fitting gauge according to a known line.
Parameters
Line
Remarks
A Line object is characterized by its center coordinates, its length and its rotation angle. The ELine
class has its own overloaded Set member to set its geometrical parameters, the syntax is the following:
void ELine::Set(EPoint Center, FLOAT32 f32Length, FLOAT32 f32Angle= 0);
void ELine::Set(EPoint Origin, EPoint End);
Parameters
Center
f32Length
f32Angle
Origin
End
center coordinates of the line at its nominal position. The default value is
(0, 0).
nominal length of the line. The default value is 100.
nominal rotation angle of the line. The default value is 0.
origin point coordinates of the line.
end point coordinates of the line.
Remarks
By default, the line nominal length value is 100, which means 100 pixels when the field of view (FOV)
is not calibrated and 100 "units" in case of a calibrated FOV.
ELineGauge::Get/Set Length
FLOAT32 GetLength();
289
Remarks
By default, the line fitting gauge length value is 100, which means 100 pixels when the field of view
(FOV) is not calibrated and 100 "units" in case of a calibrated FOV.
ELineGauge::Get Org/End
Epoint GetOrg();
Remarks
The sign of the rotation angle depends whether the field of view is calibrated or not.
When the field of view is calibrated, the coordinate system is said to be direct, the abscissa extends
rightwards and the ordinate extends upwards. In this case, an anticlockwise rotation leads to a positive
angle value.
When the field of view is not calibrated, the coordinate system is said to be inverse, the abscissa
extends rightwards and the ordinate extends downwards. In this case, a clockwise rotation leads to a
positive angle value.
ELineGauge::Get/Set Tolerance
FLOAT32 GetTolerance();
Returns the searching area half thickness of the line fitting gauge.
void SetTolerance(FLOAT32 f32Tolerance);
Sets the searching area half thickness of the line fitting gauge.
Parameters
f32Tolerance
searching area half thickness of the line fitting gauge. The default value is
10.
Remarks
By default, the line fitting gauge searching area thickness value is 20 (2X10), which means 20 pixels
when the field of view (FOV) is not calibrated and 20 "units" in case of a calibrated FOV.
290
2.3.2.3
Measurement
ELineGauge::Get/Set KnownAngle
BOOL GetKnownAngle();
Returns the flag indicating whether the slope of the line to be fitted is known or not.
void SetKnownAngle(BOOL bKnownAngle);
Sets the flag indicating whether the slope of the to be fitted gauge is known or not.
Parameters
bKnownAngle
by default (FALSE value), the slope of the to be fitted gauge is not known.
Remarks
A line model to be fitted may have a well-known slope. It is possible to impose the value of this slope,
thus removing one degree of freedom. The line fitting gauge slope is set by means of SetAngle.
The sign of the rotation angle depends whether the field of view is calibrated or not.
When the field of view is calibrated, the coordinate system is said to be direct, the abscissa extends
rightwards and the ordinate extends upwards. In this case, an anticlockwise rotation leads to a positive
angle value.
When the field of view is not calibrated, the coordinate system is said to be inverse, the abscissa
extends rightwards and the ordinate extends downwards. In this case, a clockwise rotation leads to a
positive angle value.
ELineGauge::Get/Set ClippingMode
enum GGE_CLIPPING_MODE ELineGauge::GetClippingMode();
Returns the clipping mode, as defined by enum GGE_CLIPPING_MODE. The clipping mode allows to
choose how the fitted segment length and center are computed.
void ELineGauge::SetClippingMode(enum GGE_CLIPPING_MODE eClippingMode);
Remarks
By default, the clipping mode is GGE_CLIPPING_CENTERED_NOMINAL, which corresponds to the
behavior appearing in eVision version 6.4 and before.
2.3.2.4
Measurement Results
ELineGauge::GetMeasuredLine
ELine GetMeasuredLine();
291
Example
// Perform a line fitting
LineGauge.Measure();
// Get the fitted line center coordinates and its orientation angle
f32X= LineGauge.GetMeasuredLine().GetX();
f32Y= LineGauge.GetMeasuredLine().GetY();
f32Angle= LineGauge.GetMeasuredLine().GetAngle();
ELineGauge::GetPoint
EPoint GetPoint(FLOAT32 f32Fraction);
Returns the coordinates of a particular point specify by its location along the line segment.
Parameters
f32Fraction
2.4
2.4.1
point location expresses as a fraction of the line segment (range -1, +1).
ECircleGauge
ECircleGauge Overview
Manages a complete circle measurement context, i.e. a set of geometric and other parameters required to
perform a measurement.
To perform a circle measurement, create a new circle measurement context and set the parameters
whose default values are not appropriate. Then invoke the desired measurement function and get the
results from the measurement context.
When measurements are performed in a calibrated field of view, EasyGauge provides results in physical
units (mm, inch, ) rather than as a number of pixels (for more information about calibration, refer to
EWorldShape).
Circle fitting
Given an approximate initial position of the model, one performs a series of point location operations at
regularly spaced points of the model. The accurately located points on the edge can then be used to
adjust the models parameters using a least squares approach.
To improve the reliability of the process, one can apply a few "filtering" passes during which the outliers
(sample points that lie significantly far away from the model) are eliminated.
The parameters to be set can be grouped as follows:
Center: position of the center of the circle fitting gauge;
Radius, Diameter: approximate radius and diameter of the circle fitting gauge;
Angle, Amplitude: angular origin and amplitude of the circle fitting gauge;
Tolerance, SamplingStep: spreading of the point location gauges along the circle fitting gauge;
NumFilteringPasses, FilteringThreshold: post-filtering of the outliers.
Thickness, Smoothing: pre-filtering of the image data;
Threshold, MinAmplitude: peak detection thresholds;
TransitionType, TransitionChoice, TransitionIndex, MinArea: peak selection options.
Measurement Results
After a circle fitting has been performed, using Measure, the information pertaining to the fitted circle are
retrieved by means of:
GetMeasuredCircle
The reliability of the measurement can be assessed by observing the value of:
GetMeasuredPeak
Declare using
#include "EGauge.h"
#include "EInspect.h"
2.4.2
2.4.2.1
ECircleGauge Construction
Default constructor
ECircleGauge::ECircleGauge();
Constructs a circle measurement context. All parameters are initialized to their respective default
values.
Example
// Create an ECircleGauge instance with all default values.
ECircleGauge Circle1;
Copy constructor
ECircleGauge::ECircleGauge (const ECircleGauge& Circle)
Constructs a circle measurement context based on a pre-existing ECircleGauge object. The gauge
children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
293
Parameters
Circle
ECircleGauge object.
Example
// Create a copy of an existing ECircleGauge object
ECircleGauge Circle2(&Circle1)
2.4.2.2
Gauge Position
ECircleGauge::Set
void Set(ECircle Circle);
Sets the nominal position (center coordinates), diameter, angular origin and amplitude of the circle
fitting gauge according to a known circle.
Parameters
Circle
Remarks
A Circle object is characterized by its nominal position (given by the coordinates of its center), its
nominal diameter, the angular position from where it extents and its angular amplitude. The ECircle
class has its own overloaded Set member to set its geometrical parameters, the syntax is the following:
void ECircle::Set(EPoint Center, FLOAT32 f32Diameter, FLOAT32 f32OrgAngle= 0, BOOL
bDirect= TRUE);
void ECircle::Set(EPoint Center, FLOAT32 f32Diameter, FLOAT32 f32OrgAngle, FLOAT32
f32Amplitude);
void ECircle::Set(EPoint Center, EPoint Origin, BOOL bDirect= TRUE);
void ECircle::Set(EPoint Origin, EPoint Middle, EPoint End, BOOL bFull= TRUE);
Parameters
Center
f32Diameter
f32OrgAngle
f32Amplitude
Origin
End
Middle
bDirect
bFull
center coordinates of the circle at its nominal position. The default value is
(0, 0).
nominal diameter of the circle. The default value is 100.
nominal angular origin of the circle. The default value is 0.
nominal angular amplitude of the circle. The default value is 360.
origin point coordinates of the circle.
end point coordinates of the circle.
middle point coordinates of the circle.
TRUE (default value) means that angles increase anticlockwisely in a
direct coordinate system and clockwisely in an inverse coordinate system.
TRUE (default value) in case of a full turn circle.
In a direct coordinate system, the abscissa extends rightwards and the ordinate extends upwards. The
coordinate system is said to be inverse if the abscissa extends rightwards and the ordinate extends
downwards.
By default, the circle nominal diameter value is 100, which means 100 pixels when the field of view
(FOV) is not calibrated and 100 "units" in case of a calibrated FOV.
294
ECircleGauge::Get/Set Radius
FLOAT32 GetRadius();
Remarks
A circle fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal radius (diameter), the angular position from where it extents, its angular amplitude
and its outline tolerance.
By default, the circle fitting gauge radius value is 50, which means 50 pixels when the field of view
(FOV) is not calibrated and 50 "units" in case of a calibrated FOV.
ECircleGauge::Get/Set Diameter
FLOAT32 GetDiameter();
Remarks
A circle fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal radius (diameter), the angular position from where it extents, its angular amplitude
and its outline tolerance.
By default, the circle fitting gauge diameter is value 100, which means 100 pixels when the field of view
(FOV) is not calibrated and 100 "units" in case of a calibrated FOV.
ECircleGauge::GetArcLength
FLOAT32 GetArcLength();
295
ECircleGauge::GetOrgAngle
FLOAT32 GetOrgAngle();
Returns the angular position from where the circle fitting gauge extents.
Remarks
A circle fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal radius (diameter), the angular position from where it extents, its angular amplitude
and its outline tolerance.
The sign of the rotation angle depends whether the field of view is calibrated or not.
When the field of view is calibrated, the coordinate system is said to be direct, the abscissa extends
rightwards and the ordinate extends upwards. In this case, an anticlockwise rotation leads to a positive
angle value.
When the field of view is not calibrated, the coordinate system is said to be inverse, the abscissa
extends rightwards and the ordinate extends downwards. In this case, a clockwise rotation leads to a
positive angle value.
ECircleGauge::GetApexAngle
FLOAT32 GetApexAngle();
Returns the angular position at the apex of the circle fitting gauge.
Remarks
A circle fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal radius (diameter), the angular position from where it extents, its angular amplitude
and its outline tolerance.
The sign of the rotation angle depends whether the field of view is calibrated or not.
When the field of view is calibrated, the coordinate system is said to be direct, the abscissa extends
rightwards and the ordinate extends upwards. In this case, an anticlockwise rotation leads to a positive
angle value.
When the field of view is not calibrated, the coordinate system is said to be inverse, the abscissa
extends rightwards and the ordinate extends downwards. In this case, a clockwise rotation leads to a
positive angle value.
ECircleGauge::GetEndAngle
FLOAT32 GetEndAngle();
Returns the angular position of the end of the circle fitting gauge.
Remarks
A circle fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal radius (diameter), the angular position from where it extents, its angular amplitude
and its outline tolerance.
The sign of the rotation angle depends whether the field of view is calibrated or not.
When the field of view is calibrated, the coordinate system is said to be direct, the abscissa extends
rightwards and the ordinate extends upwards. In this case, an anticlockwise rotation leads to a positive
angle value.
When the field of view is not calibrated, the coordinate system is said to be inverse, the abscissa
extends rightwards and the ordinate extends downwards. In this case, a clockwise rotation leads to a
positive angle value.
296
ECircleGauge::GetAmplitude
FLOAT32 GetAmplitude();
Returns the angular amplitude of the circle fitting gauge. The default value is 360.
Remarks
A circle fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal radius (diameter), the angular position from where it extents, its angular amplitude
and its outline tolerance.
The sign of the rotation angle depends whether the field of view is calibrated or not.
When the field of view is calibrated, the coordinate system is said to be direct, the abscissa extends
rightwards and the ordinate extends upwards. In this case, an anticlockwise rotation leads to a positive
angle value.
When the field of view is not calibrated, the coordinate system is said to be inverse, the abscissa
extends rightwards and the ordinate extends downwards. In this case, a clockwise rotation leads to a
positive angle value.
ECircleGauge::GetOrg
Epoint GetOrg();
Returns the flag indicating whether the circle fitting gauge is a full circle or not.
By default, TRUE value, the circle fitting gauge is a full circle.
ECircleGauge::GetDirect
BOOL GetDirect();
Returns the flag indicating whether positive angles correspond to a clockwise or an anticlockwise
rotation.
TRUE (default value) means that angles increase anticlockwisely in a direct coordinate system and
clockwisely in an inverse coordinate system.
297
Remarks
When the field of view is calibrated, the coordinate system is said to be direct, the abscissa extends
rightwards and the ordinate extends upwards. When the field of view is not calibrated, the coordinate
system is said to be inverse, the abscissa extends rightwards and the ordinate extends downwards.
ECircleGauge::Get/Set Tolerance
FLOAT32 GetTolerance();
Returns the searching area half thickness of the circle fitting gauge.
void SetTolerance(FLOAT32 f32Tolerance);
Sets the searching area half thickness of the circle fitting gauge.
Parameters
f32Tolerance
searching area half thickness of the circle fitting gauge. The default value
is 10.
Remarks
A circle fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal radius (diameter), the angular position from where it extents, its angular amplitude
and its outline tolerance.
By default, the circle fitting gauge searching area thickness value is 20 (2X10), which means 20 pixels
when the field of view (FOV) is not calibrated and 20 "units" in case of a calibrated FOV.
2.4.2.3
Measurement
ECircleGauge::Get/Set InnerFilteringThreshold
FLOAT32 GetInnerFilteringThreshold();
Returns the sampled point inner filtering threshold. If inner filtering is enabled, the sampled points that
have been found inside the measured circle are filtered in regard of their distance to it. If this distance
is greater than the threshold, the sampled point is set as invalid and removed from the measure. This
distance is in world units.
void SetInnerFilteringThreshold(FLOAT32 f32InnerFilteringThreshold);
Remarks
The inner sampled point filtering is activated as soon as the corresponding threshold is set. To disable
inner filtering, use the DisableInnerFiltering method.
ECircleGauge::DisableInnerFiltering
void DisableInnerFiltering();
Disables inner sampled point filtering. See the Get/Set InnerFilteringThreshold method.
298
Remarks
The inner sampled point filtering is activated as soon as the corresponding threshold is set calling the
SetInnerFilteringThreshold method.
ECircleGauge::IsInnerFilteringEnabled
BOOL IsInnerFilteringEnabled();
Returns TRUE if inner sampled point filtering is enabled. See the Get/Set
InnerFilteringThreshold method.
Remarks
The inner sampled point filtering is activated as soon as the corresponding threshold is set calling the
SetInnerFilteringThreshold method. To disable inner filtering, use the
DisableInnerFiltering method.
2.4.2.4
Measurement Results
ECircleGauge::GetMeasuredCircle
ECircle GetMeasuredCircle();
ECircleGauge::GetPoint
EPoint GetPoint(FLOAT32 f32Fraction);
Returns the coordinates of a particular point specify by its location along the circle arc.
Parameters
f32Fraction
2.5
point location expresses as a fraction of the circle arc (range -1, +1).
ERectangleGauge
2.5.1.1
ERectantgleGauge Overview
Manages a complete rectangle measurement context, i.e. a set of geometric and other parameters
required to perform a measurement.
To perform a rectangle measurement, create a new rectangle measurement context and set the
parameters whose default values are not appropriate. Then invoke the desired measurement function and
get the results from the measurement context.
299
When measurements are performed in a calibrated field of view, EasyGauge provides results in physical
units (mm, inch, ) rather than as a number of pixels (for more information about calibration, refer to
EWorldShape).
Rectangle fitting
Measurement Results
After a rectangle fitting has been performed, using Measure, the information pertaining to the fitted
rectangle are retrieved by means of:
GetMeasuredRectangle
Declare using
#include "EGauge.h"
#include "EInspect.h"
300
2.5.2
2.5.2.1
ERectangleGauge construction
Default constructor
ERectangleGauge::ERectangleGauge();
Constructs a rectangle measurement context. All parameters are initialized to their respective default
values.
Example
// Create an ERectangleGauge instance with all default values.
ERectangleGauge Rectangle1;
Copy constructor
ERectangleGauge::ERectangleGauge (const ERectangleGauge& Rectangle)
ERectangleGauge object.
Example
// Create a copy of an existing ERectangleGauge object
ERectangleGauge Rectangle2(& Rectangle1)
2.5.2.2
Gauge Position
ERectangleGauge::Set
void Set(ERectangle Rectangle);
Sets the nominal position (center coordinates), size and rotation angle of the rectangle fitting gauge
according to a known rectangle.
Parameters
Rectangle
Remarks
A Rectangle object is characterized by its center coordinates, its size and its rotation angle. The
ERectangle class has its own overloaded Set member to set its geometrical parameters, the syntax is
the following:
void ERectangle::Set(EPoint Center, FLOAT32 f32SizeX, FLOAT32 f32SizeY, FLOAT32
f32Angle= 0);
void ERectangle::Set(EPoint Origin, EPoint End);
void ERectangle::Set(EPoint Origin, EPoint Middle, EPoint End);
301
Parameters
Center
f32SizeX, f32SizeY
f32Angle
Origin
End
Middle
By default, the rectangle nominal width and height values are 100, which means 100 pixels when the
field of view (FOV) is not calibrated and 100 "units" in case of a calibrated FOV.
ERectangleGauge::SetSize
void SetSize(FLOAT32 f32SizeX, FLOAT32 f32SizeY);
nominal size X/Y of the rectangle fitting gauge. Both default values are
100.
Remarks
A rectangle fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal size, its rotation angle and its outline tolerance.
By default, the rectangle fitting gauge width and height values are 100, which means 100 pixels when
the field of view (FOV) is not calibrated and 100 "units" in case of a calibrated FOV.
ERectangleGauge::GetSize X/Y
FLOAT32 GetSizeX();
FLOAT32 GetSizeY();
Retrieves the center coordinates of each edge of the rectangle fitting gauge.
Parameters
Px
PX
Py
PY
302
ERectangleGauge::GetCorners
void GetCorners(EPoint& Pxy, EPoint& PXy, EPoint& PxY, EPoint& PXY);
ERectangleGauge::GetEdges
void GetEdges(ELine& Ex, ELine& EX, ELine& Ey, ELine& EY);
ERectangleGauge::Get/Set Angle
FLOAT32 GetAngle();
Remarks
A rectangle fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal size, its rotation angle and its outline tolerance.
The sign of the rotation angle depends whether the field of view is calibrated or not.
When the field of view is calibrated, the coordinate system is said to be direct, the abscissa extends
rightwards and the ordinate extends upwards. In this case, an anticlockwise rotation leads to a positive
angle value.
When the field of view is not calibrated, the coordinate system is said to be inverse, the abscissa
extends rightwards and the ordinate extends downwards. In this case, a clockwise rotation leads to a
positive angle value.
ERectangleGauge::Get/Set Tolerance
FLOAT32 GetTolerance();
Returns the searching area half thickness of the rectangle fitting gauge.
303
Sets the searching area half thickness of the rectangle fitting gauge.
Parameters
f32Tolerance
searching area half thickness of the rectangle fitting gauge. The default
value is 10.
Remarks
A rectangle fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal size, its rotation angle and its outline tolerance.
By default, the rectangle fitting gauge searching area thickness is 20 (2X10), which means 20 pixels
when the field of view (FOV) is not calibrated and 20 "units" in case of a calibrated FOV.
2.5.2.3
Transition Parameters
ERectangleGauge::Get/Set ActiveEdges
UINT32 GetActiveEdges();
Remarks
In the case of a rectangle fitting gauge, each edge can have its own transition detection parameters.
Updating the transition parameters only affect the current active edges. By default, all edges are active.
2.5.2.4
Measurement
ERectangleGauge::Get/Set KnownAngle
BOOL GetKnownAngle();
Returns the flag indicating whether the rotation angle of the rectangle to be fitted is known or not.
void SetKnownAngle(BOOL bKnownAngle);
Sets the flag indicating whether the rotation angle of the rectangle to be fitted is known or not.
Parameters
bKnownAngle
by default (FALSE value), the rotation angle of the rectangle is not known.
Remarks
A rectangle model to be fitted may have a well-known orientation. It is possible to impose the value of
this rotation angle, thus removing one degree of freedom. The rectangle fitting gauge orientation is set
by means of SetAngle.
The sign of the rotation angle depends whether the field of view is calibrated or not.
304
When the field of view is calibrated, the coordinate system is said to be direct, the abscissa extends
rightwards and the ordinate extends upwards. In this case, an anticlockwise rotation leads to a positive
angle value.
When the field of view is not calibrated, the coordinate system is said to be inverse, the abscissa
extends rightwards and the ordinate extends downwards. In this case, a clockwise rotation leads to a
positive angle value.
ERectangleGauge::Get/Set InnerFilteringThreshold
FLOAT32 GetInnerFilteringThreshold();
Returns the sampled point inner filtering threshold. If inner filtering is enabled, the sampled points that
have been found inside the measured rectangle are filtered in regard of their distance to it. If this
distance is greater than the threshold, the sampled point is set as invalid and removed from the
measure. This distance is in world units.
void SetInnerFilteringThreshold(FLOAT32 f32InnerFilteringThreshold);
Remarks
The inner sampled point filtering is activated as soon as the corresponding threshold is set. To disable
inner filtering, use the DisableInnerFiltering method.
ERectangleGauge::DisableInnerFiltering
void DisableInnerFiltering();
Disables inner sampled point filtering. See the Get/Set InnerFilteringThreshold method.
Remarks
The inner sampled point filtering is activated as soon as the corresponding threshold is set calling the
SetInnerFilteringThreshold method.
ERectangleGauge::IsInnerFilteringEnabled
BOOL IsInnerFilteringEnabled();
Returns TRUE if inner sampled point filtering is enabled. See the Get/Set
InnerFilteringThreshold method.
Remarks
The inner sampled point filtering is activated as soon as the corresponding threshold is set calling the
SetInnerFilteringThreshold method. To disable inner filtering, use the
DisableInnerFiltering method.
305
2.5.2.5
Measurement Results
ERectangleGauge::GetMeasuredRectangle
ERectangle GetMeasuredRectangle();
ERectangleGauge::GetPoint
EPoint GetPoint(FLOAT32 f32FractionX, FLOAT32 f32FractionY);
Returns the coordinates of a particular point specified by its location in the rectangle area.
Parameters
f32FractionX/Y
2.6
EWedgeGauge
2.6.1.1
EWedgeGauge Overview
Manages a complete wedge measurement context, i.e. a set of geometric and other parameters required
to perform a measurement.
To perform a wedge measurement, create a new wedge measurement context and set the parameters
whose default values are not appropriate. Then invoke the desired measurement function and get the
results from the measurement context.
When measurements are performed in a calibrated field of view, EasyGauge provides results in physical
units (mm, inch, ) rather than as a number of pixels (for more information about calibration, refer to
EWorldShape).
306
Wedge fitting
Measurement Results
After a wedge fitting has been performed, using Measure, the information pertaining to the fitted wedge
are retrieved by means of:
GetMeasuredWedge
Declare using
#include "EGauge.h"
#include "EInspect.h"
2.6.2
2.6.2.1
EWedgeGauge Constrution
Default constructor
EWedgeGauge::EWedgeGauge();
Constructs a wedge measurement context. All parameters are initialized to their respective default
values.
307
Example
// Create an EWedgeGauge instance with all default values.
EWedgeGauge WedgeGauge1;
Copy constructor
EWedgeGauge::EWedgeGauge (const EWedgeGauge& WedgeGauge)
Constructs a wedge measurement context based on a pre-existing EWedgeGauge object. The gauge
children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
WedgeGauge
EWedgeGauge object.
Example
// Create a copy of an existing EWedgeGauge object
EWedgeGauge WedgeGauge2(&WedgeGauge1)
2.6.2.2
Gauge Position
EWedgeGauge::Set
void EWedgeGauge::Set (EWedge Wedge = EWedge(EPoint(0, 0), 1, 1));
Sets the nominal position (center coordinates), diameter, breadth, angular origin and amplitude of the
wedge fitting gauge according to a known wedge. By default, a wedge positioned at (0, 0), with
diameter of 1 and breadth of 1 is assumed.
Parameters
Wedge
Remarks
An EWedge object is characterized by its nominal position (given by the coordinates of its center), its
nominal diameter, its breadth, the angular position from where it extents and its angular amplitude. The
EWedge class has its own overloaded Set member to set its geometrical parameters, the syntax is as
follows:
void EWedge::Set(EPoint Center, FLOAT32 f32Diameter, FLOAT32 f32Breadth= 0, FLOAT32
f32OrgAngle= 0, BOOL bDirect= TRUE);
void EWedge::Set(EPoint Center, FLOAT32 f32Diameter, FLOAT32 f32Breadth, FLOAT32
f32OrgAngle, FLOAT32 f32Amplitude);
void EWedge::Set(EPoint Center, EPoint Origin, FLOAT32 f32Breadth= 0, BOOL bDirect=
TRUE);
void EWedge::Set(EPoint Origin, EPoint Middle, EPoint End, FLOAT32 f32Breadth= 0,
BOOL bFull= TRUE);
Parameters
Center
f32Diameter
308
center coordinates of the wedge at its nominal position. The default value
is (0, 0).
nominal diameter of the wedge. The default value is 100.
f32Breadth
f32OrgAngle
f32Amplitude
Origin
End
Middle
bDirect
Sets the nominal radius and breadth of the wedge fitting gauge.
Parameters
f32Radius
f32Breadth
Remarks
A wedge fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal radius (diameter), its breadth, the angular position from where it extents, its angular
amplitude and its outline tolerance.
By default, the wedge fitting gauge radius value is 50, which means 50 pixels when the field of view
(FOV) is not calibrated and 50 "units" in case of a calibrated FOV.
EWedgeGauge::SetDiameters
void SetDiameters(FLOAT32 f32Diameter, FLOAT32 f32Breadth);
Sets the nominal inner/outer diameter and breadth of the wedge fitting gauge.
Parameters
f32Diameter
f32Breadth
Remarks
A wedge fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal radius (diameter), its breadth, the angular position from where it extents, its angular
amplitude and its outline tolerance.
By default, the wedge fitting gauge diameter value is 100, which means 100 pixels when the field of
view (FOV) is not calibrated and 100 "units" in case of a calibrated FOV.
309
Returns the inner circle arc length of the wedge fitting gauge.
FLOAT32 GetOuterArcLength();
Returns the outer circle arc length of the wedge fitting gauge.
Remarks
A wedge fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal radius (diameter), its breadth, the angular position from where it extents, its angular
amplitude and its outline tolerance.
310
EWedgeGauge::GetOrgAngle
FLOAT32 GetOrgAngle();
Returns the angular position from where the wedge fitting gauge extents.
Remarks
A wedge fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal radius (diameter), its breadth, the angular position from where it extents, its angular
amplitude and its outline tolerance.
The sign of the rotation angle depends whether the field of view is calibrated or not.
When the field of view is calibrated, the coordinate system is said to be direct, the abscissa extends
rightwards and the ordinate extends upwards. In this case, an anticlockwise rotation leads to a positive
angle value.
When the field of view is not calibrated, the coordinate system is said to be inverse, the abscissa
extends rightwards and the ordinate extends downwards. In this case, a clockwise rotation leads to a
positive angle value.
EWedgeGauge::Get Inner/Outer Apex
EPoint GetInnerApex();
Returns the inner apex point coordinates of the wedge fitting gauge.
EPoint GetOuterApex();
Returns the outer apex point coordinates of the wedge fitting gauge.
Remarks
A wedge fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal radius (diameter), its breadth, the angular position from where it extents, its angular
amplitude and its outline tolerance.
EWedgeGauge::GetApexAngle
FLOAT32 GetApexAngle();
Returns the angular position at the apex of the wedge fitting gauge.
Remarks
A wedge fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal radius (diameter), its breadth, the angular position from where it extents, its angular
amplitude and its outline tolerance.
The sign of the rotation angle depends whether the field of view is calibrated or not.
When the field of view is calibrated, the coordinate system is said to be direct, the abscissa extends
rightwards and the ordinate extends upwards. In this case, an anticlockwise rotation leads to a positive
angle value.
When the field of view is not calibrated, the coordinate system is said to be inverse, the abscissa
extends rightwards and the ordinate extends downwards. In this case, a clockwise rotation leads to a
positive angle value.
311
EWedgeGauge::GetEndAngle
FLOAT32 GetEndAngle();
Returns the inner origin point coordinates of the wedge fitting gauge.
EPoint GetOuterOrg();
Returns the outer origin point coordinates of the wedge fitting gauge.
Remarks
A wedge fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal radius (diameter), its breadth, the angular position from where it extents, its angular
amplitude and its outline tolerance.
312
Returns the inner end point coordinates of the wedge fitting gauge.
EPoint GetOuterEnd();
Returns the outer end point coordinates of the wedge fitting gauge.
Remarks
A wedge fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal radius (diameter), its breadth, the angular position from where it extents, its angular
amplitude and its outline tolerance.
EWedgeGauge::GetDirect
BOOL GetDirect();
Returns the flag indicating whether positive angles correspond to a clockwise or an anticlockwise
rotation.
TRUE (default value) means that angles increase anticlockwisely in a direct coordinate system and
clockwisely in an inverse coordinate system.
Remarks
When the field of view is calibrated, the coordinate system is said to be direct, the abscissa extends
rightwards and the ordinate extends upwards. When the field of view is not calibrated, the coordinate
system is said to be inverse the abscissa extends rightwards and the ordinate extends downwards.
EWedgeGauge::GetMidEdges
void GetMidEdges(EPoint& Pa, EPoint& PA, EPoint& Pr, EPoint& PR);
Retrieves the center coordinates of each edge of the wedge fitting gauge.
Parameters
Pa
PA
Pr
PR
EWedgeGauge::GetCorners
void GetCorners(EPoint& Par, EPoint& PAr, EPoint& PaR, EPoint& PAR);
313
EWedgeGauge::GetEdges
void GetEdges(ELine& Ea, ELine& EA, ECircle& Er, ECircle& ER);
EWedgeGauge::Get/Set Tolerance
FLOAT32 GetTolerance();
Returns the searching area half thickness of the wedge fitting gauge.
void SetTolerance(FLOAT32 f32Tolerance);
Sets the searching area half thickness of the wedge fitting gauge.
Parameters
f32Tolerance
searching area half thickness of the wedge fitting gauge. The default
value is 10.
Remarks
A wedge fitting gauge is fully defined knowing its nominal position (given by the coordinates of its
center), its nominal radius (diameter), its breadth, the angular position from where it extents, its angular
amplitude and its outline tolerance.
By default, the wedge fitting gauge searching area thickness value is 20 (2X10), which means 20
pixels when the field of view (FOV) is not calibrated and 20 "units" in case of a calibrated FOV.
2.6.2.3
Transition Parameters
EWedgeGauge::Get/Set ActiveEdges
UINT32 GetActivesEdges();
Remarks
In the case of a wedge fitting gauge, each edge can have its own transition detection parameters.
Updating the transition parameters only affect the current active edges. By default, all edges are active.
314
2.6.2.4
Measurement Results
EWedgeGauge::GetMeasuredWedge
EWedge GetMeasuredWedge();
EWedgeGauge::GetPoint
EPoint GetPoint(FLOAT32 f32BreadthFraction, FLOAT32 f32AngleFraction);
Returns the coordinates of a particular point specify by its location along the wedge perimeter.
Parameters
f32BreadthFraction
f32AngleFraction
2.7
2.7.1
point location expresses as a fraction of the wedge breadth (range -1, +1).
point location expresses as a fraction of the wedge amplitude (range -1, +1).
EFrameShape
EframeShape Overview
An EFrameShape object is a graphical representation of a coordinate system. Its main goal is to allow the
grouping of several gauges or other frames. Any modification in the position or the orientation of the
mother frame is automatically applied to the attached gauges or daughter frames.
315
Declare using
#include "EInspect.h"
2.7.2
2.7.2.1
Construction
EFrameShape Constructor
EFrameShape();
Create a frame shape measurement context. All parameters are initialized to their respective default
value.
Example
// Create an EFrameShape instance with all default values.
EFrameShape FrameShape1;
EFrameShape:: EFrameShape (const EFrameShape & FrameShape)
Create a copy of an existing EFrameShape object. The gauge children are copied according to the
value of the global flag that can be set using ESetRecursiveCopyBehavior.
Example
// Create a copy of an existing EFrameShape object
EFrameShape FrameShape2(&FrameShape1)
2.7.2.2
Frame Position
EFrameShape::Set
void Set(EPoint Center, FLOAT32 f32Angle= 0);
origin point coordinates of the frame. The default value is (0, 0).
rotation angle of the frame. The default value is 0.
EFrameShape::SetCenter
void SetCenter(EPoint Center);
void SetCenter(FLOAT32 f32CenterX, FLOAT32 f32CenterY);
316
origin point coordinates of the frame. The default value is (0, 0).
abscissa/ordinate of the frame origin point. Both default values are 0.
EFrameShape::SetAngle
void SetAngle(FLOAT32 f32Angle);
EFrameShape::SetSize
void SetSize(FLOAT32 f32SizeX, FLOAT32 f32SizeY= 0);
Remarks
By default, both frame axis value are set to 100, which means 100 pixels when the field of view (FOV)
is not calibrated and 100 "units" in case of a calibrated FOV.
EFrameShape::GetSize X/Y
FLOAT32 GetSizeX();
FLOAT32 GetSizeY();
2.7.2.3
Frame grouping
EFrameShape::Attach
void Attach(EShape* pMother);
EFrameShape::Detach
void Detach();
317
EFrameShape::DetachDaughters
void DetachDaughters();
2.7.2.4
Graphical interaction
EFrameShape::Draw
void draw(HDC hDC, enum INS_DRAWING_MODES eDrawingMode= INS_DRAW_NOMINAL, BOOL
bDaughters= FALSE);
EFrameShape::HitTest
BOOL HitTest(BOOL bDaughters= TRUE);
Checks whether the cursor is positioned over a handle (TRUE) or not (FALSE).
Parameters
BDaughters
318
EFrameShape::Drag
void Drag(INT32 n32CursorX, INT32 n32CursorY);
Moves a handle to a new position and updates the position parameters of the shape.
Parameters
n32CursorX/Y
EFrameShape::Get/Set Dragable
BOOL GetDragable();
Returns the flag indicating whether the shape can be dragged or not.
void SetDragable(BOOL bDragable, BOOL bDaughters= FALSE);
Sets the flag indicating whether the shape can be dragged or not.
Parameters
BDragable
BDaughters
flag indicating whether the shape can be dragged (TRUE) or not (FALSE).
flag indicating whether the daughters shapes inherit of the same behavior.
EFrameShape::Get/Set Rotatable
BOOL GetRotatable();
Returns the flag indicating whether the shape can be rotated or not.
void SetRotatable(BOOL bRotatable, BOOL bDaughters= FALSE);
Sets the flag indicating whether the shape can be rotated or not.
Parameters
BRotatable
BDaughters
flag indicating whether the shape can be rotated (TRUE) or not (FALSE).
flag indicating whether the daughters shapes inherit of the same behavior.
EFrameShape::Get/Set Resizable
BOOL GetResizable();
Returns the flag indicating whether the shape can be resized or not.
void SetResizable(BOOL bResizable, BOOL bDaughters= FALSE);
Sets the flag indicating whether the shape can be resized or not.
Parameters
BResizable
flag indicating whether the shape can be resized (TRUE) or not (FALSE).
BDaughters
flag indicating whether the daughters shapes inherit of the same behavior.
319
3.
ENUMERATION CONSTANTS
3.1
enum GGE_TRANSITION_TYPE
Transition type
GGE_BW
GGE_WB
GGE_ BW_OR_WB
GGE_BWB
GGE_WBW
3.2
black to white.
white to black.
black to white or white to black.
black to white to black.
white to black to white.
enum GGE_TRANSITION_CHOICE
Transition choice
GGE_NTH_FROM_BEGIN
GGE_NTH_FROM_END
GGE_LARGEST_AMPLITUDE
GGE_LARGEST_AREA
GGE_CLOSEST
GGE_ALL
3.3
enum GGE_CLIPPING_MODE
Clipping mode
GGE_CLIPPING_CENTERED_NOMINAL
GGE_CLIPPING_CLIPPED_TO_VALID_SAMPLES
GGE_CLIPPING_CLIPPED_IN_NOMINAL_SHAPE
320
3.4
enum INS_SHAPE_TYPES
Gauge type
INS_POINT_GAUGE
INS_LINE_GAUGE
INS_CIRCLE_GAUGE
INS_RECTANGLE_GAUGE
INS_WEDGE_GAUGE
INS_FRAME_SHAPE
3.5
enum INS_DRAWING_MODES
Drawing modes
INS_DRAW_NOMINAL
INS_DRAW_ACTUAL
INS_DRAW_TOLERANCE
INS_DRAW_SAMPLED_PATHS
INS_DRAW_SAMPLED_PATH
MeasureSample.
INS_DRAW_SAMPLED_POINTS
INS_DRAW_SAMPLED_POINT
INS_DRAW_POINTS_IN_SKIP_RANGE
non-skipped points.
INS_DRAW_INVALID_SAMPLED_POINTS
3.6
enum GGE_PLOT_ITEMS
GGE_PLOT_TRANSITIONS
GGE_PLOT_PEAKS
GGE_PLOT_THRESHOLDS
GGE_PLOT_POINTS
3.7
enum INS_HANDLES
Handle names
INS_HANDLE_NONE
INS_HANDLE_CENTER
INS_HANDLE_ORG
INS_HANDLE_MID
INS_HANDLE_END
No handle hit.
Circle, rectangle or wedge center handle.
Line segment or circle arc origin handle.
Line segment or circle arc middle handle.
Line segment or circle arc end handle.
321
INS_HANDLE_TOL_0
INS_HANDLE_TOL_1
INS_HANDLE_TOL_x0
INS_HANDLE_TOL_x1
INS_HANDLE_TOL_y0
INS_HANDLE_TOL_y1
INS_HANDLE_TOL_X0
INS_HANDLE_TOL_X1
INS_HANDLE_TOL_Y0
INS_HANDLE_TOL_Y1
INS_HANDLE_EDGE_x
INS_HANDLE_EDGE_X
INS_HANDLE_EDGE_y
INS_HANDLE_EDGE_Y
322
INS_HANDLE_TOL_a0
INS_HANDLE_TOL_a1
INS_HANDLE_TOL_A0
INS_HANDLE_TOL_A1
INS_HANDLE_TOL_r0
INS_HANDLE_TOL_r1
INS_HANDLE_TOL_R0
INS_HANDLE_TOL_R1
INS_HANDLE_EDGE_a
INS_HANDLE_EDGE_A
INS_HANDLE_EDGE_r
INS_HANDLE_EDGE_R
323
3.8
enum INS_SHAPE_BEHAVIOR
Shape behavior
INS_VISIBLE
INS_SELECTED
INS_SELECTABLE
INS_DRAGABLE
INS_ROTATABLE
INS_RESIZABLE
INS_LABELED
INS_ACTIVE
INS_PASSED
3.9
enum INS_DRAGGING_MODES
324
4.
SAMPLE PROGRAMS
The available sample programs dedicated to the EasyGauge library are the following:
GgeCircleGauge: Shows how to load a calibration file and a model file. Draws the
corresponding circle gauge and locates circles along it.
GgeGauges: Allows choosing a gauge type and performs the corresponding measurement.
Remarks
The corresponding projects for Microsoft Visual C++ can be found in the eVision\MsVc Samples subfolder, while the projects for Borland C++ Builder are located in the eVision\BcB Samples sub-folder.
325
EasyOCR:
Printed Character Recognition
1.
EASYOCR: INTRODUCTION
EasyOCR is a multi-font, printed, character reader based on a template matching algorithm. In the
learning phase, it is taught a font by giving it samples of all possible characters. Then, it is able to read
any kind of short text (serial numbers, labels, ) such as those found in industrial environments.
Blob analysis functions are used to segment the image and extract the characters constituting the text to
be read. Blobs are elected as characters based on tunable size and shape criteria. Moreover, EasyOCR
is able to deal with characters which are split into several blobs. When the exact position of the characters
in the image is unknown, EasyOCR functions will process the entire image and locate the characters.
All of the required functionality is encapsulated in a single C++ object:
EOCR: manages a complete OCR context, i.e. a set of geometric and other parameters required to
perform a recognition.
Recognition process
EasyOCR follows a few steps in the recognition process.
First, the image is segmented, i.e. threshold and decomposed into objects or blobs (connected
components), in the same way as EasyObject does.
Then the objects are filtered according to the size and possibly grouped together ("repasted") to form
distinct characters. This is called character isolation or segmentation. When several characters touch each
other, they can also be separated. This is called character cutting. (The segmentation step can be
bypassed when the exact position of the characters is known beforehand).
The characters are compared to a set of patterns, called a font. A character is recognized by finding the
best match between a character and the patterns in the font.
Raw image
After segmentation
After recognition
329
Recognition parameters
The recognition process is governed by a few parameters that need to be fine tuned to obtain the most
reliable results.
330
If the character isolation process is bypassed, the following member must be used to specify the
known locations of the characters:
- AddChar, and EmptyChars.
Remarks
1. When objects are larger than MaxWidth, they can be split into as may parts as needed using
vertical cutting lines. This behaviour is corresponds to the option CutLargeChars.
2. A font file stores the learned patterns, as well as the following parameters: NoiseArea, MaxWidth,
MaxHeight, MinWidth, MinHeight, Spacing, TextColor. When a font file is loaded, these
parameters are set to the recorded value.
3. The patterns in a font are stored as a small array of pixels, by default 5 pixels wide and 9 pixels
high. This default size can be changed before learning, using parameters PatternWidth and
PatternHeight.
4. When the character and learnt pattern are compared, the comparison can be made sensitive to a
discrepancy between the aspect ratios (height over width). This enforces the difference between
narrow and wide characters. This corresponds to the option CompareAspectRatio.
5. Two character isolation modes are available. The characters isolated using either method may not
be the same:
OCR_REPASTE_OBJECTS: the blobs are grouped as long as they fit in the outer rectangle
and are not separated by a vertical gap. For this reason, the accents and dots will be
preserved.
Learning
EasyOCR is a multi-font character recognition library. This means that EasyOCR functions are able to
recognize text printed using any character font, once it has been taught. Practically, during the learning
process, characters are presented one by one to the system which analyzes them and builds a database
called a font.
Only a few data are stored for each new character, they represent distinctive features of the characters
shape. This small database may be saved to disk and restored when needed.
During the learning process, each pattern gets an associated numerical value call its code (usually its
ASCII code). A pattern also belongs to a character class. The class information can be used later during
the recognition process to restrict the set of patterns to compare to (see the un32Classes argument of
function ReadText).
331
332
2.
2.1
EOCR
2.1.1
EOCR: Overview
Manages a complete OCR context, i.e. a set of geometric and other parameters required to perform a
recognition.
Declare using
#include "EOCR.h"
2.1.2
2.1.2.1
Construction
EOCR Construction
EOCR();
2.1.2.2
Recognition Parameters
EOCR::Get/SetCharSpacing
INT32 GetCharSpacing();
Returns the spacing that separates characters (when two objects are separated by a vertical gap larger
than the spacing, they are considered to belong to distinct characters).
INT16 SetCharSpacing(INT32 n32Spacing);
Sets the spacing that separates characters (when two objects are separated by a vertical gap larger
than the spacing, they are considered to belong to distinct characters).
Parameters
n32Spacing
Remark
The segmentation parameters MUST be the same for both learning and recognition process.
333
EOCR::Get/SetMaxCharHeight
INT32 GetMaxCharHeight();
Returns the maximum character height (a character larger than the maximum width or higher than the
maximum height is discarded).
INT16 SetMaxCharHeight(INT32 n32Height);
Sets the maximum character height (a character larger than the maximum width or higher than the
maximum height is discarded).
Parameters
n32Height
Remark
The segmentation parameters MUST be the same for both learning and recognition process.
EOCR::Get/SetMaxCharWidth
INT32 GetMaxCharWidth();
Returns the maximum character width (a character larger than the maximum width or higher than the
maximum height is discarded).
INT16 SetMaxCharWidth(INT32 n32Width);
Returns the maximum character width (a character larger than the maximum width or higher than the
maximum height is discarded).
Parameters
n32Width
Remark
The segmentation parameters MUST be the same for both learning and recognition process.
EOCR::Get/SetMinCharHeight
INT32 GetMinCharHeight();
Returns the minimum character height (a character both narrower than the minimum width and lower
than the minimum height is discarded).
INT16 SetMinCharHeight(INT32 n32Height);
Sets the minimum character height (a character both narrower than the minimum width and lower than
the minimum height is discarded).
Parameters
n32Height
Remark
The segmentation parameters MUST be the same for both learning and recognition process.
334
EOCR::Get/SetMinCharWidth
INT32 GetMinCharWidth();
Returns the minimum character width (a character both narrower than the minimum width and lower
than the minimum height is discarded).
INT16 SetMinCharWidth(INT32 n32Width);
Sets the minimum character width (a character both narrower than the minimum width and lower than
the minimum height is discarded).
Parameters
n32Width
Remark
The segmentation parameters MUST be the same for both learning and recognition process.
EOCR::Get/SetRemoveNarrowOrFlat
BOOL GetRemoveNarrowOrFlat();
Setting this property to TRUE means that characters are discarded when either dimension falls below
the minimum value. By default, this feature is disabled (only smaller characters in both height and
width are discarded - the condition could be written Narrow And Flat).
Parameters
bRemoveNarrowOrFlat
Remark
The segmentation parameters MUST be the same for both learning and recognition process.
EOCR::Get/SetNoiseArea
INT32 GetNoiseArea();
Returns the noise area (when a blob has an area smaller than this value, it is ignored).
INT16 SetNoiseArea(INT32 n32Area);
Sets the noise area (when a blob has an area smaller than this value, it is ignored).
Parameters
n32Area
Remark
The segmentation parameters MUST be the same for both learning and recognition process.
335
EOCR::Get/SetCompareAspectRatio
BOOL GetCompareAspectRatio();
Returns TRUE when the character aspect ratio is used to compute the recognition score.
void SetCompareAspectRatio(BOOL bCompareAspectRatio);
Sets the character rating mode. When TRUE, the character aspect ratio is used to compute the
recognition score.
Parameters
bCompareAspectRatio
EOCR::Get/SetSegmentationMode
enum OCRSegmentationMode GetSegmentationMode();
Remark
The segmentation parameters MUST be the same for both learning and recognition process.
EOCR::Get/SetCutLargeChars
BOOL GetCutLargeChars();
Sets the large chars cutting mode. When TRUE, candidate characters larger than MaxWidth are split
into as many parts as required. When FALSE, large characters are discarded.
Parameters
bCutLargeChars
Remark
The segmentation parameters MUST be the same for both learning and recognition process.
EOCR::Get/SetRelativeSpacing
FLOAT32 GetRelativeSpacing();
336
Sets the relative spacing value. This value is the ratio of the width of the spaces between characters
and the character width. For example, characters 25 pixels wide separated by 10 pixels gaps
correspond to a relative spacing of 10/25=0.4. The default value of this parameter is 0, corresponding
to no spacing.
This parameter is relevant only when the CutLargeCharsMode is enabled.
Parameters
f32RelativeSpacing
Remark
The segmentation parameters MUST be the same for both learning and recognition process.
EOCR::Get/SetRemoveBorder
BOOL GetRemoveBorder();
Sets the RemoveBorder mode. When TRUE, all blobs touching the ROI edges are automatically
discarded. By default, this feature is turned on.
Parameters
bRemoveBorder
Remark
The segmentation parameters MUST be the same for both learning and recognition process.
EOCR::Get/SetTextColor
enum OCRColor GetTextColor( );
Remark
The segmentation parameters MUST be the same for both learning and recognition process.
EOCR::Get/SetThreshold
INT32 GetThreshold( );
Returns the threshold mode used for image segmentation, as defined by enum
IMG_THRESHOLD_MODES.
337
Sets the threshold mode used for image segmentation, as defined by enum
IMG_THRESHOLD_MODES. By default, the "minimum residue" method is used to determine the
threshold value.
Parameters
un32Threshold
Remarks
In case of an absolute threshold, this threshold value has to be given as the parameter to the
SetThreshold method.
EOCR::GetTrueThreshold
UINT32 GetTrueThreshold();
Returns the absolute threshold level when using a single threshold. This value is valid only when the
BuildObjects() or ReadText() method has been called beforehand.
EOCR::Get/Set MatchingMode
enum OCR_MATCHING_MODES GetMatchingMode();
Sets the matching mode to use to compare characters to the template. By default, the root-meansquare error method is used.
Parameters
eMatchingMode
Remark
These modes are meant to be used without thresholding, i.e. when one of the
OCR_DARK_ON_LIGHT and OCR_LIGHT_ON_DARK colors are used.
EOCR::Get/Set ShiftXTolerance
UINT32 GetShiftXTolerance();
Returns the horizontal translation tolerance around the nominal position when the character positions
are explicitly specified.
void SetShiftXTolerance(UINT32 un32ShiftX);
Sets the horizontal translation tolerance around the nominal position when the character positions are
explicitly specified. By default, no shifting is allowed (un32ShiftX = 0).
Parameters
un32ShiftX
338
Remark
The tolerance can be used in two ways: either each character is moved individually until the best
match is found, or the set of characters is matched as a whole, until the best average error is reached.
See SetShiftingMode.
EOCR::Get/Set ShiftYTolerance
UINT32 GetShiftYTolerance();
Returns the vertical translation tolerance around the nominal position when the character positions are
explicitly specified.
void SetShiftYTolerance(UINT32 un32ShiftY);
Sets the vertical translation tolerance around the nominal position when the character positions are
explicitly specified. By default, no shifting is allowed (un32ShiftY = 0).
Parameters
un32ShiftY
Remark
The tolerance can be used in two ways: either each character is moved individually until the best
match is found, or the set of characters is matched as a whole, until the best average error is reached.
See SetShiftingMode.
EOCR::Get/Set ShiftingMode
enum OCR_SHIFTING_MODES GetShiftingMode();
2.1.2.3
Recognition
EOCR::EmptyChars
void EmptyChars ();
EasyOCR has a sophisticated built-in procedure to segment the characters from an image, i.e. find
bounding boxes that include each of them. In some cases, when the position of characters is known
beforehand, it can be beneficial to bypass the segmentation step, for efficiency or reliability purposes.
339
To use this feature, simply specify the character positions by successive calls to AddChar. When this
is done, the remainder of the OCR processing steps can take place. To empty the list of known
characters, call EmptyChars.
Parameters
n32OrgX
n32OrgY
n32EndX
n32EndY
EOCR::BuildObjects
INT16 BuildObjects(EROIBW8* pSrcImage);
Segments the source image, i.e. detects and labels the objects. An object is a connected set of pixels
above or below the Threshold (according to TextColor).
Parameters
pSrcImage
EOCR::FindAllChars
INT16 FindAllChars(EROIBW8* pSrcImage);
Locates the characters by filtering the objects according to their size and grouping them if the
SegmentationMode is set to OCR_REPASTE_OBJECTS. The characters are sorted from left to right.
This operation must be performed after a call to BuildObjects and before a call to ReadText.
Parameters
pSrcImage
EOCR::MatchChar
INT16 MatchChar(EROIBW8* pSrcImage, UINT32 un32Classes, INT32& n32Index, INT32
n32ShiftX, INT32 n32ShiftY);
Reads a single character, i.e. finds the best match between the patterns in the font and the given
character; ashift can be apply to the character. This operation can only be performed after a call to
FindAllChars.
Parameters
pSrcImage
un32Classes
n32Index
n32ShiftX
n32ShiftY
EOCR::ReadText
INT16 ReadText(EROIBW8* pSrcImage, INT32 n32MaxChars, UINT32 un32Classes, CHAR*
pszString, BOOL bAutoSegmentation= TRUE);
340
Reads one or more rows of characters, i.e. finds the best match between the patterns in the font and
the segmented characters. This operation can only be performed after a call to FindAllChars.
Parameters
pSrcImage
n32MaxChars
un32Classes
pszString
bAutoSegmentation
Example
INT16 ReadText(EROIBW8* pSrcImage, INT32 n32MaxChars, UINT32* pun32Classes, CHAR*
pszString, BOOL bAutoSegmentation= TRUE);
INT16 ReadText(EROIBW8* pSrcImage, INT32 n32MaxChars, UINT32* pun32Classes, UNICHAR*
pszString, BOOL bAutoSegmentation= TRUE);
Reads one or more rows of characters, i.e. finds the best match between the patterns in the font and
the segmented characters. This operation can only be performed after a call to FindAllChars.
Parameters
pSrcImage
n32MaxChars
pun32Classes
pszString
bAutoSegmentation
EOCR::Recognize
void Recognize(EROIBW8* pSrcImage, INT32 n32MaxChars, UINT32 un32Classes, CHAR*
pszString);
void Recognize(EROIBW8* pSrcImage, INT32 n32MaxChars, UINT32 un32Classes, UNICHAR*
pszString);
void Recognize(EROIBW8* pSrcImage, INT32 n32MaxChars, UINT32* pun32Classes, CHAR*
pszString);
void Recognize(EROIBW8* pSrcImage, INT32 n32MaxChars, UINT32* pun32Classes, UNICHAR*
pszString);
341
This method does the same as a sequence of BuildObjects / FindAllChars / ReadText, achieving all
processing phases (blob analysis, character segmentation and pattern recognition) in a single
operation.
Parameters
pSrcImage
n32MaxChars
un32Classes
pun32Classes
pszString
2.1.2.4
Recognized Characters
EOCR::GetNumChars
INT32 GetNumChars( );
EOCR::CharGetOrgY
INT32 CharGetOrgY(INT32 n32Index);
EOCR::CharGetDstX
INT32 CharGetDstX(INT32 n32Index);
342
EOCR::CharGetDstY
INT32 CharGetDstY(INT32 n32Index);
EOCR::CharGetWidth
INT32 CharGetWidth(INT32 n32Index);
EOCR::CharGetTotalOrgX
INT32 CharGetTotalOrgX(INT32 n32Index);
Returns the abscissa of the upper left corner of a recognized character. The coordinates are computed
with respect to the parent image rather than the ROI.
Parameters
n32Index
EOCR::CharGetTotalOrgY
INT32 CharGetTotalOrgY(INT32 n32Index);
Returns the ordinate of the upper left corner of a recognized character. The coordinates are computed
with respect to the parent image rather than the ROI.
Parameters
n32Index
EOCR::CharGetTotalDstX
INT32 CharGetTotalDstX(INT32 n32Index);
Returns the abscissa of the lower right corner of a recognized character. The coordinates are
computed with respect to the parent image rather than the ROI.
343
Parameters
n32Index
EOCR::CharGetTotalDstY
INT32 CharGetTotalDstY(INT32 n32Index);
Returns the ordinate of the lower right corner of a recognized character. The coordinates are computed
with respect to the parent image rather than the ROI.
Parameters
n32Index
EOCR::GetFirstCharCode
INT32 GetFirstCharCode(INT32 n32Index);
Returns the code of the pattern that matches at best a recognized character.
Parameters
n32Index
EOCR::GetFirstCharDistance
FLOAT32 GetFirstCharDistance(INT32 n32Index);
Computes the degree of similarity between the best matching pattern and a recognized character.
Returns 0 for a perfect match and 1 for a total mismatch.
Parameters
n32Index
EOCR::GetSecondCharCode
INT32 GetSecondCharCode(INT32 n32Index);
Returns the code of the pattern that matches at second best a recognized character.
Parameters
n32Index
EOCR::GetSecondCharDistance
FLOAT32 GetSecondCharDistance(INT32 n32Index);
Computes the degree of similarity between the second best matching pattern and a recognized
character. Returns 0 for a perfect match and 1 for a total mismatch.
Parameters
n32Index
344
EOCR::GetConfidenceRatio
FLOAT32 GetConfidenceRatio(INT32 n32Index);
Returns the degree of confidence in the recognized character. A value of 100% means there is no
difference between the recognized character and the best matching pattern. A value of 0% means
there is no way to distinguish between the best and second best matching pattern.
Parameters
n32Index
Remark
The computation of the confidence ratio is based on the first and second characters distance
parameters (see GetFirstCharDistance and GetSecondCharDistance).
2.1.2.5
Learning
EOCR::AddPatternFromImage
void AddPatternFromImage(EROIBW8* pSrcImage, INT32 n32OrgX, INT32 n32OrgY, INT32
n32Width, INT32 n32Height, INT32 n32Code, UINT32 un32Class = OCR_CLASS_0);
Adds a new pattern to the font. The pattern is extracted from an image by specifying a bounding
rectangle.
Parameters
pSrcImage
n32OrgX
n32OrgY
n32Width
n32Height
n32Code
un32Class
EOCR::HitChar
BOOL HitChar(INT32 n32CursorX, INT32 n32CursorY, UINT32 un32CharIndex, FLOAT32
f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32 f32PanX= 0.f, FLOAT32 f32PanY= 0.f);
Returns TRUE if the cursor is placed over the character specified by un32CharIndex.
Parameters
n32CursorX, n32CursorY
un32CharIndex
f32ZoomX
f32ZoomY
f32PanX
f32PanY
345
Remarks
If zooming and/or panning were used when drawing the ROI, the same values must be used with
HitChar.
EOCR::HitChars
BOOL HitChars(INT32 n32CursorX, INT32 n32CursorY, UINT32& un32CharIndex, FLOAT32
f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32 f32PanX= 0.f, FLOAT32 f32PanY= 0.f);
Returns TRUE if the cursor is placed over a character and sets the un32CharIndex accordingly .
Parameters
n32CursorX, n32CursorY
un32CharIndex
f32ZoomX
f32ZoomY
f32PanX
f32PanY
Remarks
If zooming and/or panning were used when drawing the ROI, the same values must be used with
HitChar.
EOCR::LearnPattern
void LearnPattern(EROIBW8* pSrcImage, UINT32 un32CharIndex, INT32 n32Code, UINT32
un32Class= OCR_CLASS_0, BOOL bAutoSegmentation= TRUE);
Adds a new pattern to the font. The pattern is selected by its index value (un32CharIndex), as
assigned by the FindAllChars process.
Parameters
pSrcImage
un32CharIndex
n32Code
un32Class
bAutoSegmentation
EOCR::LearnPatterns
void LearnPatterns(EROIBW8* pSrcImage, const CHAR* pszString, UINT32 un32Class=
OCR_CLASS_0, BOOL bAutoSegmentation= TRUE);
void LearnPatterns(EROIBW8* pSrcImage, const UNICHAR* pszString, UINT32 un32Class=
OCR_CLASS_0, BOOL bAutoSegmentation= TRUE);
Adds all the patterns from the source image to the font. Patterns are ordered by their index value, as
assigned by the FindAllChars process. All the characters are belonging to the same class(es).
void LearnPatterns(EROIBW8* pSrcImage, const CHAR* pszString, UINT32* pun32Classes,
BOOL bAutoSegmentation= TRUE);
346
Adds all the patterns from the source image to the font. Patterns are ordered by their index value, as
assigned by the FindAllChars process. An array of classes determines the class(es) of each character
in the string.
Parameters
pSrcImage
pszString
pun32Class
bAutoSegmentation
EOCR::RemovePattern
void RemovePattern(UINT32 un32Index);
EOCR::GetNumPatterns
INT32 GetNumPatterns();
EOCR::GetPatternClass
UINT32 GetPatternClass(INT32 n32Index);
EOCR::GetPatternBitmap
EBW8* GetPatternBitmap(INT32 n32Index);
Returns a pointer to the memory area holding the image of the pattern of the given index.
347
Parameters
n32Index
EOCR::Load
INT16 Load(const CHAR* pszPathName);
Loads a new font from a file. This overwrites the previous contents of the font.
Parameters
pszPathName
EOCR::NewFont
INT16 NewFont(UINT32 un32PatternWidth = 5, UINT32 un32PatternHeight = 9);
Empties the contents of the font and sets the size of the pattern array to be used from then on.
A larger pattern array improves the recognition sensitivity, at the expense of increased processing
time.
Parameters
un32PatternWidth
un32PatternHeight
EOCR::GetPatternWidth
UINT32 GetPatternWidth();
Returns the current pattern width, as set at the last NewFont or Load operation.
EOCR::GetPatternHeight
UINT32 GetPatternHeight();
Returns the current pattern height, as set at the last NewFont or Load operation.
EOCR::Save
INT16 Save(const CHAR* pszPathName);
EOCR::Dump
void Dump ( );
Outputs a readable report of the OCR context contents to the standard output console.
348
2.1.2.6
Drawing
EOCR::DrawChar
void DrawChar(HDC hDC, UINT32 un32CharIndex, FLOAT32 f32ZoomX= 1.f, FLOAT32
f32ZoomY= 0.f, FLOAT32 f32PanX= 0.f, FLOAT32 f32PanY= 0.f);
Draws the bounding box of a given character. Drawing is done in the device context associated to the
desired window. The current pen is used.
Parameters
hDC
un32CharIndex
f32ZoomX
f32ZoomY
f32PanX
f32PanY
EOCR::DrawChars
void DrawChars(HDC hDC, FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32
f32PanX= 0.f, FLOAT32 f32PanY= 0.f);
Draws the bounding boxes of all characters in the image. Drawing is done in the device context
associated to the desired window. The current pen is used for all characters (to vary the colors, draw
the objects separately using the DrawChar method instead).
Parameters
hDC
f32ZoomX
f32ZoomY
f32PanX
f32PanY
349
3.
ENUMERATION CONSTANTS
3.1
enum OCRClasses
OCR_DIGIT = OCR_CLASS_0
OCR_UPPERCASE = OCR_CLASS_1
OCR_LOWERCASE = OCR_CLASS_2
OCR_SPECIAL = OCR_CLASS_3
OCR_EXTENDED = OCR_CLASS_4
OCR_CLASS_5
OCR_CLASS_6
OCR_CLASS_7
OCR_CLASS_8
OCR_CLASS_9
OCR_CLASS_10
OCR_CLASS_11
OCR_CLASS_12
OCR_CLASS_13
OCR_CLASS_14
OCR_CLASS_15
OCR_CLASS_16
OCR_CLASS_17
OCR_CLASS_18
OCR_CLASS_19
OCR_CLASS_20
OCR_CLASS_21
OCR_CLASS_22
OCR_CLASS_23
OCR_CLASS_24
OCR_CLASS_25
OCR_CLASS_26
OCR_CLASS_27
OCR_CLASS_28
OCR_CLASS_29
OCR_CLASS_30
OCR_CLASS_31
OCR_ALL_CLASSES
3.2
enum OCRColor
OCR_BLACK_ON_WHITE
OCR_WHITE_ON_BLACK
350
OCR_DARK_ON_LIGHT
OCR_LIGHT_ON_DARK
3.3
enum OCRSegmentationMode
OCR_KEEP_OBJECTS
OCR_REPASTE_OBJECTS
3.4
enum OCR_MATCHING_MODES
OCR_MATCH_RMS
OCR_MATCH_STANDARD
OCR_MATCH_NORMALIZED
3.5
enum OCR_SHIFTING_MODES
OCR_SHIFT_CHARS
OCR_SHIFT_TEXT
351
4.
SAMPLE PROGRAMS
The available sample programs dedicated to the EasyOCR library are the following:
Ocr: lets you read the text in an image, using a predefined font file (a Unicode version of this
sample is available on request please contact the Technical Support).
OcrLearn: lets you build a font file (a Unicode version of this sample is available on request
please contact the Technical Support).
OcrFontExplorer: allows to browse a font and remove patterns from it.
Remarks
The corresponding projects for Microsoft Visual C++ can be found in the eVision\MsVc Samples subfolder, while the projects for Borland C++ Builder are located in the eVision\BcB Samples sub-folder.
352
EasyFind
EasyFind
1.
EASYFIND INTRODUCTION
EasyFind is a library aimed at rapidly locating patterns in an image down to the sub-pixel precision.
In a one-sentence definition: EasyFind finds instances similar to a model in a search field and reports
information about these instances.
Search field: the search field is an image or a part of an image expected to contain a pattern to
find.
Model: the model is a representation of a pattern serving as a reference for the finding function.
Instance: this is a part of a search field reported as very similar to the model. Instance means
case or example.
355
2.
CLASSES
2.1
The "package" name is used here to represent a scope. It can be a class or a namespace in C++.
Regarding the type names, the dot has to be replaced by double colons (::) in C++, in order for a type or a
namespace to access its member (be it a type, a namespace or a property/method).
There are two classes to deal with when using EasyFind:
PatternFinder and
The PatternFinder C++ class represents a finding tool that can learn a gray scale pattern image, and can
then locate occurrences of this pattern in other images.
The FoundPattern object describes an occurrence of a found pattern.
Declare using
#include "EFind.h"
2.2
PatternFinder
2.2.1
PatternFinder Overview
This is the learning and finding tool. It can learn a gray scale model and then locate it in search fields.
Learning and finding parameters are also set in the PatternFinder object
The PatternFinder class can be found in the Euresys::eVision package.
Declare using
#include "EFind.h"
2.2.2
PatternFinder Properties
2.2.2.1
Learning properties
PatternFinder::ForcedThreshold property
UINT32. The forced threshold between [0, 255].
The ForcedThreshold fixes an absolute gray level threshold to help the PatternFinder in the extraction
of regions in the ContrastingRegions pattern type.
A 0 value means that the thresholding is automatically done by EasyFind.
356
EasyFind
Remarks
By default, the ForcedThreshold is set to 0. Once the ForcedThreshold is changed, a new learning
process has to be done to take the ForcedThreshold into account. Note that the ForcedThreshold will
remain to its value even after a new learning process. An efficient way to see the effect of changing the
ForcedThreshold is to use the DrawModel method of the PatternFinder.
PatternFinder::LightBalance property
FLOAT32. The light balance between [-1.0, 1.0]
LightBalance is a learning property which allows the user to compensate for poor lighting conditions of
the model in the ContrastingRegions pattern type.
Remarks
The LightBalance is automatically set to 0.0 after a learning process. Once the LightBalance is
changed, a new learning process has to be done to take the LightBalance into account. An efficient
way to see the effect of changing the LightBalance is to use the DrawModel method of the
PatternFinder.
PatternFinder::PatternType property
Euresys::eVision::EasyFind::PatternType::Type, the pattern type as defined in enum
PatternType::Type
PatternType informs the PatternFinder of the general nature of the model to be learnt.
Remarks
By default, the pattern type is set to Euresys::eVision::EasyFind::PatternType::ConsistentEdges
PatternFinder::Pivot property
Euresys::eVision::Point. The pivot defines the reference point in the model. The coordinates of the
reference point are relative to the upper left corner of the model. The location of an instance
(Coordinates (X, Y)) is the location of its reference point defined in the model.
Remarks
By default, the pivot is set to (0, 0). In that case, the center of the instance is returned.
Euresys::eVision::Point is a structure that contains two x and y FLOAT32 values.
PatternFinder::ThinStructureMode property
Euresys::eVision::EasyFind::ThinStructureMode::Type, the mode for ThinStructure pattern type as
defined in enum ThinStructureMode::Type.
ThinStructureMode informs EasyFind if thin elements in the model are darker or brighter than regions.
Remarks
By default, ThinStructureMode is set to Euresys::eVision::EasyFind::ThinStructureMode::Auto which
detect the best mode between dark or bright.
PatternFinder::TransitionThickness property
UINT32. The transition thickness expressed in pixel.
357
The TransitionThickness defines the tolerance on the location of transitions between regions in the
ContrastingRegions pattern type.
Remarks
By default, the TransitionThickness is set to 6 pixels. An efficient way to see the effect of changing the
TransitionThickness is to use the DrawModel method of the PatternFinder.
2.2.2.2
Finding properties
PatternFinder::AngleBias property
FLOAT32. The angle bias expressed in the current angle unit.
The AngleBias defines the angle offset between the model and the instances.
Remarks
Finding the pattern is performed in range AngleBias +/- AngleTolerance. This range should not exceed
a full turn. By default, the bias value of the angle offset is 0.0.
PatternFinder::AngleTolerance property
FLOAT32. The angle tolerance expressed in the current angle unit.
The AngleTolerance defines the angle allowance of the instances around the AngleBias.
Remarks
Finding the pattern is performed in range AngleBias +/- AngleTolerance. This range should not exceed
a full turn. A null tolerance can be set, in which case the angle bias value is assumed. By default, the
angle tolerance value is 0.0.
PatternFinder::ContrastMode property
Euresys::eVision::EasyFind::Contrast::Type, the instances contrast as defined in enum Contrast::Type
This is a ConsistentEdges pattern type property. It defines the contrast of regions. Contrast can be
normal (as in the model), inverse (Inverse contrast of the model), any (same or inverse contrast of the
model).
Remark
By default, the contrast of the instances is set to Euresys: eVision::EasyFind::Contrast::Normal
PatternFinder::FindExtension property
INT32. The extension value, i.e. the pattern margin size (in pixel) that is allowed to go out of the search
field.
Remark
When a non-null value is attributed to the extension, the detection of instances partially out of the ROI
is allowed. The extension value defines how much the ROI is extended. By default, the value of the
extension is set to 0.
358
EasyFind
PatternFinder::MaxInstances property
UINT32. The maximum number of instances to be found.
The MaxInstances defines the maximum number of instances returned by a finding function.
Remark
By default, the value of MaxInstances is set to 1.
PatternFinder::MinScore property
FLOAT32. The score minimum between [-1.0, 1.0].
The MinScore defines the minimum score of found instances. Instances with a score under the
MinScore will not be returned.
PatternFinder::ScaleBias property
FLOAT32. The scale bias expressed in units (not in percent).
The ScaleBias defines the scale factor between the model and the instances.
Remarks
Finding the pattern is performed in range ScaleBias +/- ScaleTolerance. This range should not exceed
[0.5..2] (50% to 200% scaling). By default, the scale bias value is 1.0 (100%).
PatternFinder::ScaleTolerance property
FLOAT32. The scale tolerance expressed in units (not in percent).
The ScaleTolerance defines the scale allowance of the instances around the ScaleBias.
Remarks
Finding the pattern is performed in range ScaleBias +/- ScaleTolerance. This range should not exceed
[0.5..2] (50% to 200% scaling). A null tolerance can be set, in which case the scale bias value is
assumed. By default, the scale tolerance value is 0.0.
2.2.2.3
Advanced properties
PatternFinder::Interpolate property
BOOL. Whether interpolation is performed when searching for a pattern occurrence.
Remarks
By default (TRUE), sub-pixel accuracy is achieved for all degrees of freedom (translation, rotation and
scaling). Comparing to matching done with a one-pixel precision (FALSE), this leads to an
improvement of the accuracy by a factor of about 10. The added computational cost is low.
PatternFinder::CoarseStage property
UINT32. The coarse stage index. The finest resolution stage is 0.
Remarks
By default, this parameter is set to 9.
Reserved use.
359
PatternFinder::FineStage property
UINT32. The fine stage index.
Remarks
By default, this parameter is set to 0, which means the final search is performed on the original
image/ROI.
Reserved use.
PatternFinder::MaxFeaturePoints property
UINT32. The maximum number of feature points at the fine stage.
Remarks
By default, this parameter is set to 1024.
Reserved use.
PatternFinder::MinFeaturePoints property
UINT32. The minimum number of feature points at the coarse stage.
Remarks
By default, this parameter is set to 16.
Reserved use.
2.2.3
PatternFinder Methods
2.2.3.1
Construction
PatternFinder construction
PatternFinder::PatternFinder();
Constructs a PatternFinder context. All properties are initialized to their respective default values.
2.2.3.2
Operations
PatternFinder::Find
Utils::Vector<FoundPattern> PatternFinder::Find(const EROIBW8& source);
Locates a set of possible occurrences of the learnt pattern in the supplied search field. This method will
fail if no pattern has been learnt previously.
The result is a Vector of FoundPattern objects. Basically, FoundPattern instances can be retrieved by
using the Vector::operator[] method.
Parameters
source
360
EasyFind
PatternFinder::Learn
void PatternFinder::Learn(const EROIBW8& pattern);
Learns a given pattern and stores it in the PatternFinder object. Learning another pattern erases the
information stored for the first one.
Parameters
pattern
Learns a given model with a "don't care" area that allows to mask certain parts of the pattern and do
not take them into account. After that, stores it in the PatternFinder object. Learning another pattern
erases the information stored for the first one.
Parameters
pattern
dontcare
Remark
The "don't care" area mask should have the same size than the model.
PatternFinder::LearningDone
BOOL PatternFinder::LearningDone( ) const;
2.2.3.3
Graphical Interaction
PatternFinder::DrawModel
void PatternFinder::DrawModel(HDC hDC, FLOAT32 f32ZoomX = 1.f, FLOAT32 f32ZoomY =
0.f, FLOAT32 f32PanX = 0.f, FLOAT32 f32PanY = 0.f);
2.2.3.4
Persistent storage
PatternFinder::Load
void PatternFinder::Load(const std::string& path);
void PatternFinder::Load(const std::wstring& path);
Loads the learnt pattern and all the associated parameters from the given file.
361
Parameters
path
Restores the PatternFinder model from the supplied serializer current position.
Parameters
serializer
ESerializer object.
Example
// Create an ESerializer object for reading
ESerializer *pSerializer = ESerializer::CreateFileReader("test.fnd");
// Load the PatternFinder object from the file
m_pPatternFinder.Load( pSerializer);
Remarks
This method allows to read several eVision objects from the same file by passing the same ESerializer
object to several Load(ESerializer* serializer) calls. Moreover, this file can also contained
any kind of information saved with fwrite (and thus retrieved by a fread call) between the eVision
objects.
The ESerializer object given as argument must have been previously created with a call to
ESerializer::CreateFileReader.
The serialization object contains a hidden pointer to the current position in the archive. This pointer
represents the position where the next Load operation will take place. Moreover, each Load operation
also moves the pointer at the end of the just read object (corresponding to the beginning of the next
object or to the end of the file).
It is the user responsibility to use the Load method of the right object. To get information about the
type of the next object in the file, the ESerializer::GetNextObjectType method could be used.
PatternFinder::Save
void PatternFinder::Save(const std::string& path);
void PatternFinder::Save(const std::wstring& path);
Saves the learnt pattern and all the associated parameters to the given file.
Parameters
path
ESerializer object.
Example
// Create an ESerializer object for writing (with the default creation mode)
ESerializer *pSerializer = ESerializer::CreateFileWriter("test.fnd");
// Save the PatternFinder object to the file
m_pPatternFinder.Save( pSerializer);
362
EasyFind
Remarks
This method allows to store several eVision objects in the same file by passing the same ESerializer
object to several Save(ESerializer* serializer) calls.
The ESerializer object given as argument must have been previously created with a call to
ESerializer::CreateFileWriter.
The serialization object contains a hidden pointer to the current position in the archive. This pointer
represents the position where the next Save operation will take place. Moreover, each Save operation
also moves the pointer at the end of the just written object (the end of the file).
2.3
2.3.1
FoundPattern
FoundPattern Overview
FoundPattern represents one case, one instance with all the needed information about it.
The FoundPattern class can be found in the Euresys::eVision package
Declare using
#include "EFind.h"
2.3.2
FoundPattern Properties
FoundPattern::Angle property
Read-only. FLOAT32. The angle of the found instance, in the current angle unit.
FoundPattern::Center property
Read-only. Euresys::eVision::Point. This point is the reference point of the instance. By default this is
its center. If the property Pivot has been changed in the PatternFinder, the point return the pivot in the
instance.
Remarks
Point is a structure that contains two x and y FLOAT32 values.
FoundPattern::Scale property
Read-only. FLOAT32. The scaling factor of the found pattern, in units (not percents).
FoundPattern::Score property
Read-only. FLOAT32. The matching score of the found pattern, in units (not percents).
The matching score range is [-1.0 ... 1.0].
363
2.3.3
FoundPattern Methods
2.3.3.1
Graphical interaction
FoundPattern::Draw
void FoundPattern::Draw(HDC hDC, BOOL bEdges= FALSE, FLOAT32 f32ZoomX = 1.f, FLOAT32
f32ZoomY = 0.f, FLOAT32 f32PanX = 0.f, FLOAT32 f32PanY = 0.f);
Draws the found pattern, in image coordinates. The zoomX, zoomY, panX and panY parameters can
be used to scale and/or translate the drawing operations.
If bEdges is set to TRUE, then the feature points are drawn.
Parameters
hDC
bEdges
f32ZoomX
f32ZoomY
f32PanX
f32PanY
FoundPattern::Draw
void FoundPattern::Draw(HDC hDC, BOOL bEdges= FALSE, FLOAT32 f32ZoomX = 1.f, FLOAT32
f32ZoomY = 0.f, FLOAT32 f32PanX = 0.f, FLOAT32 f32PanY = 0.f);
Draws the found pattern, in image coordinates. The zoomX, zoomY, panX and panY parameters can
be used to scale and/or translate the drawing operations.
If bEdges is set to TRUE, then the feature points are drawn.
Parameters
hDC
bEdges
f32ZoomX
f32ZoomY
f32PanX
f32PanY
364
EasyFind
3.
ENUMERATION CONSTANTS
3.1
enum Contrast::Type
3.2
enum PatternType::Type
3.3
enum ThinStructureMode::Type
365
4.
SAMPLE PROGRAMS
using namespace Euresys::eVision;
try {
EImageBW8 image;
// Load the image from a file
image.Load("imageWithPatternToLearn.bmp");
// Test for a possible error
ThrowOnEError();
// Create an ROI
EROIBW8 roi;
// Attach the ROI to the image
roi.Attach(&image);
// Define the pattern location
roi.SetPlacement(10, 10, 150, 75);
// Create a pattern finder tool and learn the ROI
PatternFinder finder;
finder.Learn(roi);
// Load an image where we will look for the pattern
EImageBW8 imageSource;
imageSource.Load("SourceImage.bmp");
// Test for a possible error
ThrowOnEError();
Utils::Vector<FoundPattern> results = finder.Find(imageSource);
for( int i = 0; i < results.NbItems(); ++i) {
std::cout <<
"result number " << i <<
"Center x = " << results[i].Center.x <<
"Center y = " << results[i].Center.y <<
std::endl;
}
}
catch(Exception e) {
// Handle errors
}
366
1.
EASYMATCH: INTRODUCTION
EasyMatch is a gray level and color pattern matching library. It lets you train the system on a reference
pattern and afterwards locate its occurrences in other images. This tool is quite convenient when the
position of a given part in the field of view is unknown or if the presence of parts must be controlled.
The library works by using correlation, i.e. measuring discrepancies between the pattern and the target
image. The following features are available:
normal, inverse or mixed contrast: because of particular lighting effects, an object can appear
with inverted contrast (white on black instead of black on white or conversely). Depending on the
applications, it can be useful to keep inverted instances or to disregard them. Three matching
modes are available: consider positive occurences only, negative occurences only or both.
translation, rotation and isotropic/anisotropic scaling: to find the best matches between the
pattern and target image, the target is allowed to translate horizontally and vertically; additionally,
it can be allowed to rotate and/or to change its scale in the X and Y directions simultaneously or
independently. The rotation angle and scale factors vary in a user-specified interval. All degrees of
freedom can be combined at will.
variable accuracy, up to sub-pixel level: the accuracy with which the pattern is measured can
be chosen (the less accurate, the faster). By default, the position parameters for each degree of
freedom are computed with a precision corresponding to the size of a pixel; lower precision can
be enforced. On the other hand, one tenth-of-a-pixel accuracy can be achieved.
dont care pixels: when the pattern cannot be inscribed in a rectangular region of interest, the
surrounding of the pattern can be ignored by setting the pixels values below a threshold level.
These pixels will not take part in the matching process. The same feature can be used if parts of
the template vary.
gray level and color images: EasyMatch processes BW8 images as well as C24.
non-square pixels: when images are acquired with non-square pixels, rotated objects appear
skewed. This effect can be compensated for by taking the pixel aspect ratio into account.
All of the required functionality is encapsulated in a single C++ object:
EMatch: manages a complete matching context, i.e. a learned pattern and parameters required to
locate one or more occurrences in an image.
The results of the matching are returned through the use of a very simple object:
369
Learning a pattern
Then, for any subsequent image, the pattern can be searched for and located. This is the matching phase.
It is performed using a single function call:
EMatch::Match: receives the target image/ROI as its argument and locates the desired
occurrences of the pattern.
To get the result of the matching, one uses the following functions:
EMatch::GetNumPositions: returns the number of good matches found. A good match is
defined as having a score higher than a prescribed value (MinScoreThreshold).
EMatch::GetPosition: returns the coordinates of the Nth good match found. The positions are
sorted by decreasing score.
Matching a pattern
370
Note. If you want to match several patterns against the same image, create an EMatch object for each
pattern. End of note.
Learning parameters
The following parameters are relevant at learning time:
MinReducedArea
DontCareThreshold
FilteringMode
Matching parameters
The following parameters are relevant at matching time:
CorrelationMode: way to compare the pattern and the image
ContrastMode: way to deal with contrast inversions
MaxPositions, MaxInitialPositions: expected number of matches
MinScore,InitialMinScore: score of the matches considered as bad
MinAngle, MaxAngle: rotation range
MinScale, MaxScale: scaling range
or, in case of anisotropic scaling,
MinScaleX, MaxScaleX,
MinScaleY, MaxScaleY
Interpolation: sub-pixel accuracy
FinalReduction: low accuracy
PixelDimensions: non-square pixels
Note. The following conditions increase the running time:
allowing rotations;
allowing scaling;
371
2.
2.1
EMatch
2.1.1
EMatch Overview
Manages a complete matching context, i.e. a learned pattern and parameters required to locate one or
more occurrences in an image.
Declare using
#include "EMatch.h"
2.1.2
2.1.2.1
Construction/Destruction
Default constructor
EMatch::EMatch();
Constructs a matching context. All parameters are initialized to their respective default values.
Copy constructor
EMatch::EMatch(const EMatch& Match);
EMatch object.
Other constructor
EMatch::EMatch(UINT32 un32NumDOF);
Constructs a matching context with a specified number of degrees of freedom. All parameters are
initialized to their respective default values.
Parameters
un32NumDOF
Remarks
In the prototype EMatch(UINT32 un32NumDOF), un32NumDOF is the maximum number of degrees
of freedom that the EMatch object being constructed will be allowed to use during its life.
372
The degrees of freedom for a matching operation are the translation ( 2 modes), the rotation (1 mode),
the isotropic scaling (1 mode) and the anisotropic scaling (1 more mode).
There is no way to modify this parameter for an existing EMatch object.
The default value for this parameter is 5; this value is also the maximum one. The minimum value for
the number of degrees of freedom is 2, in order to allow, at least, the pattern translation.
EMatch::CopyTo
EMatch* EMatch::CopyTo(EMatch* pMatch=NULL) const;
Copies all the parameters of the current EMatch object into another EMatch object and returns it.
Parameters
pMatch
Example
EMatch Match1, Match2;
// Copy Match1 into Match2
Match1.CopyTo(&Match2);
EMatch::Operator=
EMatch& EMatch::operator=(const EMatch& Match);
Copies all the parameters of the current EMatch object into another EMatch object.
Parameters
Match
Example
EMatch Match1, Match2;
// Copy Match1 into Match2
Match2=Match1;
2.1.2.2
EMatch::LearnPattern
void EMatch::LearnPattern(EROIBW8* pPattern);
void EMatch::LearnPattern(EROIC24* pPattern);
373
EMatch::IsPatternLearnt
BOOL EMatch::IsPatternLearnt();
Returns TRUE after a learning operation has been successfully performed, indicating that EasyMatch is
ready for matching, and FALSE otherwise.
EMatch::CreatePatternCopy
EGenericROI* EMatch::CreatePatternCopy ( ) const;
Returns a copy of the learnt pattern or NULL if no pattern has been learnt.
Remarks
The dynamic type of the returned object is either EImageBW8* or EImageC24*, depending upon the
type of the image and pattern stored in the EMatch object.
The user takes the ownership of the returned object, and as such is responsible for its deletion.
EMatch::ClearImage
void EMatch::ClearImage();
The EMatch::Match method keeps a copy of the image pointer given as parameter. So, if the user
deletes this pointer, the EMatch object should be informed.
The EMatch::ClearImage method releases the pointer to the image object that has been passed to
the EMatch object. It is the way to tell to the EMatch object that its pointer is not valid anymore.
EMatch::Match
void EMatch::Match(EROIBW8* pImage);
void EMatch::Match(EROIC24* pImage);
Matches the pattern against an image. The matching results can be obtained by means of the
EMatch::GetNumPositions and EMatch::GetPosition members.
Parameters
pImage
2.1.2.3
pointer to the image/ROI within which the pattern will be search for.
Learning Parameters
EMatch::Get/Set MinReducedArea
UINT32 EMatch::GetMinReducedArea();
374
Remarks
To achieve acceptable time performance, EasyMatch works by undersampling the pattern in the early
phases of the processing. The MinReducedArea parameter tells how many pixels of the pattern are
kept, at a minimum.
By default, the minimum reduced area is set to 64, which is the right choice in most situations. Higher
values are not recommended. Lower values can speed up the processing but sometimes cause the
matching process fail to find the best matches. To circumvent this problem, you can use guard
positions, that is find more matches than expected and keep the good ones only.
Warning: changing the MinReducedArea parameter invalidates any previous learning.
EMatch::Get/Set DontCareThreshold
UINT32 EMatch::GetDontCareThreshold();
Remarks
If the pattern cannot be inscribed in a rectangle because there are foreign objects in a close
neighborhood, mismatches can be avoided by using "dont care" pixels: all the pattern pixels whose
value is strictly below the DontCareThreshold will be ignored.
By default, the dont care threshold is set to 0: no "dont care" pixel exists.
Note. When you use the dont care feature, either the pattern is well contrasted from its background then set the DontCareThreshold to an appropriate thresholding value - or it is not - then set the
background pixels of the pattern to some low value (by a masking operation) and set the
DontCareThreshold to this low value plus one. End of note.
EMatch::Get/Set FilteringMode
enum MCH_FILTERING_MODE EMatch::GetFilteringMode();
Remarks
To achieve acceptable time performance, EasyMatch works by subsampling the pattern in the early
phases of the processing. The filtering mode parameter allows to select the preprocessing type applied
to the image before the decimation: averaging or low-pass filtering.
By default, the filtering mode is set to Uniform (MCH_UNIFORM), whereas the MCH_LOWPASS mode
is indicated if the image presents sharp gray-level transitions.
375
EMatch::GetPattern Width/Height
INT32 EMatch::GetPatternWidth();
2.1.2.4
Matching Parameters
EMatch::Get/SetCorrelationMode
enum E_CORRELATION_MODE EMatch::GetCorrelationMode();
Remarks
Tells what normalization rule is used to correlate the pattern to the image.
By default, the correlation mode is set to Normalized (E_MATCH_NORMALIZED).
EMatch::Get/SetContrastMode
enum MCH_CONTRAST_MODE EMatch::GetContrastMode();
Remarks
By default, the contrast mode is set to Normal (MCH_CONTRAST_NORMAL).
EMatch::Get/SetInterpolate
BOOL EMatch::GetInterpolate();
376
Parameters
bInterpolate
interpolation mode.
Remarks
By default, matching is done with a one-pixel precision for all degrees of freedom (translation, rotation
and scaling). Sub-pixel accuracy can be achieved by using an additional interpolation process. This
leads to an improvement of the accuracy by a factor of about 10. The added computational cost is low.
By default, the interpolation mode is set to FALSE.
EMatch::GetNumReductions
UINT32 EMatch::GetNumReductions();
Returns the number of reduction steps used in the matching process. These depend on the actual
pattern size and on parameter MinReducedArea. Parameter FinalReduction used to speed up
matching when coarse location is sufficient must be set in range 0..NumReductions-1.
EMatch::Get/SetMaxPositions
UINT32 EMatch::GetMaxPositions();
Remarks
Indicates how many matching positions have to be returned at a maximum. This number corresponds
to the expected maximum number of occurrences of the pattern (it is sometimes advisable to use a few
additional positions).
By default, the maximum number of positions is set to 1.
EMatch::Get/SetFinalReduction
UINT32 EMatch::GetFinalReduction();
Remarks
The pattern matching process is comprised of a few (typically 4) passes during which the position
accuracy is improved by a factor of 2 (for all degrees of freedom). This is called a reduction.
377
By default, the computation continues until an accuracy of one pixel is obtained. To speed up the
process, the last reduction passes can be dropped, so lowering the accuracy. Anyway, the
interpolation mode can then still be used.
By default, the final reduction is set to 0 (pixel accuracy). Value 1 corresponds to 2-pixels accuracy, 2
to 4, and so on. The range of values that can be used for the FinalReduction is 0 to
GetNumReductions-1.
EMatch::Get/SetMaxInitialPositions
UINT32 EMatch::GetMaxInitialPositions();
Returns the maximum number of positions at the first stage of the matching process.
void EMatch::SetMaxInitialPositions(UINT32 un32MaxInitialPositions);
Sets the maximum number of positions at the first stage of the matching process.
Parameters
un32MaxInitialPositions
Remarks
When the search for matches starts, EasyMatch considers a set of candidate positions that it
progressively refines. When they later appear to be bad candidates, they are rejected. Eventually, a
maximum of MaxPositions is returned.
In some circumstances, when the image contains features roughly similar to the pattern, these can
confuse the matching process, resulting in false matches. To overcome this situation, increasing the
number of initial positions will help.
By default, MaxInitialPositions is set to 0, indicating that the value of MaxPositions should be used
instead.
EMatch::Get/SetMinScore
FLOAT32 EMatch::GetMinScore();
minimum score.
Remarks
Indicates what score a match must reach to be considered as good, and be returned in the list of
positions; this selection criterion is applied at the final stage of the matching process. One good way to
select the appropriate MinScore in a given context is to set it to -1 (any match will be retained), set
MaxPositions to more than needed, and examine the returned scores after a matching.
By default, the minimum score is set to -1.
EMatch::Get/SetInitialMinScore
FLOAT32 EMatch::GetInitialMinScore();
378
Returns the minimum score applied as a selection criterion in the early stages of the matching process.
void EMatch::SetInitialMinScore(FLOAT32 f32InitialMinScore);
Sets the minimum score applied as a selection criterion in the early stages of the matching process.
Parameters
f32InitialMinScore
Remarks
When the search for matches starts, EasyMatch considers a set of candidate positions that is
progressively refines. When they later appear to be bad candidates, they are rejected. Though it is the
minimum score level that is used to reject bad matching positions at the final step of the matching
process, the Initial Minimum Score" parameter is used to eliminate bad positions (whose score is not
high enough) in the early stages of the matching processing.
If the matching process is achieved in one step, only the minimum score parameter will be considered.
By default, the initial minimum score is set to -1.
EMatch::Get/SetPixelDimensions
void EMatch::SetPixelDimensions(FLOAT32 f32Width, FLOAT32 f32Height);
width of a pixel.
height of a pixel.
Remarks
When an image has been acquired in such a way that the pixels are "non-square" - the physical width
and height of the area covered by a pixel are unequal - a form of anisotropy results. When rotated, the
objects become skewed; rectangles become parallelograms.
In such a situation, the pixel aspect ratio must be known to compensate it during matching. The aspect
ratio is given by specifying the true width and height of a pixel.
The specification of the pixel dimensions is only useful when rotation is used.
Only the aspect ratio matters, so that relative width and height values can be given.
By default, the pixel width and height are set to 1.0.
EMatch::Get/SetMinAngle
FLOAT32 EMatch::GetMinAngle();
Returns the minimum angle, expressed using the current angle unit.
void EMatch::SetMinAngle(FLOAT32 f32Angle);
Sets the minimum angle, expressed using the current angle unit.
Parameters
f32Angle
379
Remarks
Indicates the range within which the rotation of the pattern is allowed (-1 <= MinAngle < MaxAngle <= 1
revolution). By default, both remain 0.
EMatch::Get/SetMaxAngle
FLOAT32 EMatch::GetMaxAngle();
Returns the maximum angle expressed using the current angle unit.
void EMatch::SetMaxAngle(FLOAT32 f32Angle);
Sets the maximum angle, expressed using the current angle unit.
Parameters
f32Angle
Remarks
Indicates the range within which the rotation of the pattern is allowed (-1 <= MinAngle < MaxAngle <= 1
revolution). By default, both remain 0.
EMatch::Get/SetMinScale
FLOAT32 EMatch::GetMinScale();
Remarks
Two scaling modes are allowed: in isotropic mode, the scales factor is identical in all directions; in
anisotropic mode, the scale factors differ in the horizontal and vertical directions. To select the
appropriate mode, it suffices to call the relevant Set member.
MinScale, MaxScale: indicate the range within which the scaling of the pattern is allowed (1/2 <=
MinScale < MaxScale <= 2). By default, both remain 1. The same holds for anisotropic scale factors.
EMatch::Get/SetMaxScale
FLOAT32 EMatch::GetMaxScale();
380
Remarks
Two scaling modes are allowed: in isotropic mode, the scales factor is identical in all directions; in
anisotropic mode, the scale factors differ in the horizontal and vertical directions. To select the
appropriate mode, it suffices to call the relevant Set member.
MinScale, MaxScale: indicate the range within which the scaling of the pattern is allowed (1/2 <=
MinScale < MaxScale <= 2). By default, both remain 1. The same holds for anisotropic scale factors.
EMatch::Get/SetMinScaleX
FLOAT32 EMatch::GetMinScaleX();
Remarks
Two scaling modes are allowed: in isotropic mode, the scales factor is identical in all directions; in
anisotropic mode, the scale factors differ in the horizontal and vertical directions. To select the
appropriate mode, it suffices to call the relevant Set member.
MinScaleX, MaxScaleX: indicate the range within which the scaling of the pattern is allowed (1/2 <=
MinScaleX < MaxScaleX <= 2). By default, both remain 1.
EMatch::Get/SetMaxScaleX
FLOAT32 EMatch::GetMaxScaleX();
Remarks
Two scaling modes are allowed: in isotropic mode, the scales factor is identical in all directions; in
anisotropic mode, the scale factors differ in the horizontal and vertical directions. To select the
appropriate mode, it suffices to call the relevant Set member.
MinScaleX, MaxScaleX: indicate the range within which the scaling of the pattern is allowed (1/2 <=
MinScaleX < MaxScaleX <= 2). By default, both remain 1.
EMatch::Get/SetMinScaleY
FLOAT32 EMatch::GetMinScaleY();
381
Remarks
Two scaling modes are allowed: in isotropic mode, the scales factor is identical in all directions; in
anisotropic mode, the scale factors differ in the horizontal and vertical directions. To select the
appropriate mode, it suffices to call the relevant Set member.
MinScaleY, MaxScaleY: indicate the range within which the scaling of the pattern is allowed (1/2 <=
MinScaleY < MaxScaleY <= 2). By default, both remain 1.
EMatch::Get/SetMaxScaleY
FLOAT32 EMatch::GetMaxScaleY();
Remarks
Two scaling modes are allowed: in isotropic mode, the scales factor is identical in all directions; in
anisotropic mode, the scale factors differ in the horizontal and vertical directions. To select the
appropriate mode, it suffices to call the relevant Set member.
MinScaleY, MaxScaleY: indicate the range within which the scaling of the pattern is allowed (1/2 <=
MinScaleY < MaxScaleY <= 2). By default, both remain 1.
EMatch::GetIsotropicScale
BOOL EMatch::GetIsotropicScale();
Returns TRUE if isotropic (as opposed to anisotropic) scaling is used, i.e. when the scale factors in
both the X and Y directions are equal.
EMatch::GetAngleStep
FLOAT32 EMatch::GetAngleStep();
382
EMatch::GetScaleX/YStep
FLOAT32 EMatch::GetScaleXStep();
FLOAT32 EMatch::GetScaleYStep();
Sets the extension of the matching ROI, i.e. puts the horizontal and vertical distances, in pixels, that
the found pattern occurrences may fall outside the matching ROI. Such occurrences partially outside
the ROI have their score corrected by the ratio between the pattern area outside the ROI and the
pattern area inside.
Parameters
n32ExtensionX
n32ExtensionY
2.1.2.5
Matching Results
EMatch::GetNumPositions
UINT32 EMatch::GetNumPositions();
Returns the number of good matches found (as defined by parameters MinScore and MaxPosition).
EMatch::GetPosition
EMatchPosition* EMatch::GetPosition(UINT32 un32Index);
EMatch::DrawPosition
void EMatch::DrawPosition(HDC hDC, UINT32 un32Index, BOOL bCorner= FALSE, FLOAT32
f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32 f32PanX= 0.f, FLOAT32 f32PanY= 0.f);
Draws a graphical representation of a given occurrence of the pattern in the image, using a rectangle
and possibly a small line segment in the upper-left corner. Drawing is done in the device context
associated to the desired window. The current pen is used.
Parameters
hDC
un32Index
bCorner
383
f32ZoomX
f32ZoomY
f32PanX
f32PanY
EMatch::DrawPositions
void EMatch::DrawPositions(HDC hDC, BOOL bCorner= FALSE, FLOAT32 f32ZoomX= 1.f,
FLOAT32 f32ZoomY= 0.f, FLOAT32 f32PanX= 0.f, FLOAT32 f32PanY= 0.f);
Draws a graphical representation of all occurrences of the pattern in the image, using a rectangle and
possibly a small line segment in the upper-left corner. Drawing is done in the device context associated
to the desired window. The current pen is used for all occurences (to vary the colors, draw the objects
separately using the DrawPosition method instead).
Parameters
hDC
bCorner
f32ZoomX
f32ZoomY
f32PanX
f32PanY
2.1.2.6
Persistent storage
EMatch::Load
void EMatch::Load(const char* pszPathName);
void EMatch::Load(const UNICHAR* pszPathName);
Restores the state of an EMatch object from the data stored in the given file by a previous
EMatch::Save call. The whole object state, including the learnt pattern and all search parameters, is
restored.
Parameters
pszPathName
full path and name specification of the storage file. Use of file extension
.MCH is recommended though not mandatory.
Remarks
An error code will be set if the data in the file does not represent a well-formed EMatch object.
void EMatch::Load(FILE* file);
Restores the state of an EMatch object from the data stored in the given file by a previous
EMatch::Save call. The whole object state, including the learnt pattern and all search parameters, is
restored. Please note that the data are read at the current file pointer position.
384
Parameters
file
full path and name specification of the storage file. Use of file extension
.MCH is recommended though not mandatory.
Remarks
This method allows to read several eVision objects from the same file by passing the same FILE
pointer to several Load(FILE* file) calls. Moreover, this file can also contained any kind of
information saved with fwrite (and thus retrieved by a fread call) between the eVision objects.
An error code will be set if the data in the file does not represent a well-formed EMatch object.
The FILE pointer given as argument must have been previously initialized with a proper call to fopen.
It is of a greater importance to note that data are read at the current file pointer position.
It is up to users to correctly manage their files to be able to retrieve their eVision objects. Results
obtained by trying to restore an object of the wrong type are undefined.
To circumvent this problem, it is advised to use the ESerializer version of the Load method.
void EMatch::Load(ESerializer* serializer);
This method behaves identically to the EMatch::Load(FILE* file) method, but accepts a file-like
ESerializer object instead of a regular file.
Parameters
serializer
ESerializer object.
Example
// Create an ESerializer object for reading
ESerializer *pSerializer = ESerializer::CreateFileReader("test.mch");
// Load the EMatch object from the file
m_pMatch.Load( pSerializer);
Remarks
This method allows to read several eVision objects from the same file by passing the same ESerializer
object to several Load(ESerializer* serializer) calls. Moreover, this file can also contained
any kind of information saved with fwrite (and thus retrieved by a fread call) between the eVision
objects.
The ESerializer object given as argument must have been previously created with a call to
ESerializer::CreateFileReader.
The serialization object contains a hidden pointer to the current position in the archive. This pointer
represents the position where the next Load operation will take place. Moreover, each Load operation
also moves the pointer at the end of the just read object (corresponding to the beginning of the next
object or to the end of the file).
It is the user responsibility to use the Load method of the right object. To get information about the
type of the next object in the file, the ESerializer::GetNextObjectType method could be used.
EMatch::Save
void EMatch::Save(const char* pszPathName);
void EMatch::Save(const UNICHAR* pszPathName);
Serializes (saves) the EMatch object to the given file. The whole object state, including the learnt
pattern and all search parameters, is stored in the file.
385
Parameters
pszPathName
full path and name specification of the storage file. Use of file extension
.MCH is recommended though not mandatory.
Serializes (saves) the EMatch object to an already opened file, at the current file pointer position. The
whole object state, including the learnt pattern and all search parameters, is stored in the file. The file
pointer is moved by the EMatch object size.
Parameters
file
full path and name specification of the storage file. Use of file extension
.MCH is recommended though not mandatory.
Remarks
This method allows to store several eVision objects in the same file by passing the same FILE pointer
to several Save(FILE* file) calls. Moreover, this file can also contained any kind of information
saved with fwrite (and thus retrieved by a fread call) between the eVision objects.
The FILE pointer given as argument must have been previously initialized with a proper call to fopen.
Data are saved at the current file pointer position. At the end of the writing, the file pointer is moved by
the EMatch object size.
It is the user responsibility to know the exact structure of the used files.
To circumvent this problem, it is advised to use the ESerializer version of the Save method.
void EMatch::Save(ESerializer* serializer);
This method behaves identically to the EMatch::Save(FILE* file) method, but accepts a file-like
ESerializer object instead of a regular file.
Parameters
serializer
ESerializer object.
Example
// Create an ESerializer object for writing (with the default creation mode)
ESerializer *pSerializer = ESerializer::CreateFileWriter("test.mch");
// Save the EMatch object to the file
m_pMatch.Save( pSerializer);
Remarks
This method allows to store several eVision objects in the same file by passing the same ESerializer
object to several Save(ESerializer* serializer) calls.
The ESerializer object given as argument must have been previously created with a call to
ESerializer::CreateFileWriter.
The serialization object contains a hidden pointer to the current position in the archive. This pointer
represents the position where the next Save operation will take place. Moreover, each Save operation
also moves the pointer at the end of the just written object (the end of the file).
EMatch::GetVersion
UINT32 EMatch::GetVersion();
386
2.2
2.2.1
EMatchPosition
EMatchPosition Class Members
Used to hold the results of the matching process. An object of this class is returned by
EMatch::GetPosition.
All class members are public:
m_f32Score
m_f32CenterX
m_f32CenterY
m_f32Angle
m_f32ScaleX
m_f32ScaleY
m_f32Scale
m_f32AreaRatio
m_bInterpolated
indicates how good a matching was; 1 means that the matching was
perfect. Lower values correspond to approximate matching; -1
corresponds to a perfect mismatch (pattern superimposed on its negative
image);
abscissa of the center of the pattern found in the image;
ordinate of the center of the pattern found in the image;
clockwise rotation angle, expressed using the current angle unit, of the
pattern found in the image; 0 if no rotation is allowed;
measured horizontal scaling of the pattern found in the image, expressed
as a dimensionless ratio;
measured vertical scaling of the pattern found in the image, expressed as
a dimensionless ratio;
scale factor of the pattern found in the image; 1 if no scaling is allowed;
ratio between the found pattern area inside the search ROI and its
complete area;
indicates whether sub-pixel interpolation was actually performed on the
position (in some cases, when the pattern is found close to the ROI edge,
sub-pixel interpolation cannot be used).
Declare using
#include "EMatch.h"
387
3.
ENUMERATION CONSTANTS
3.1
enum E_CORRELATION_MODE
E_MATCH_STANDARD
E_MATCH_OFFSET_NORMALIZED
E_MATCH_GAIN_NORMALIZED
E_MATCH_NORMALIZED
Remarks
E_MATCH_SEMI_NORMALIZED = E_MATCH_OFFSET_NORMALIZED [Obsolete]
3.2
enum MCH_CONTRAST_MODE
MCH_CONTRAST_NORMAL
MCH_CONTRAST_INVERSE
MCH_CONTRAST_ANY
3.3
enum MCH_FILTERING_MODE
Filtering modes
MCH_UNIFORM
MCH_LOWPASS
388
filtering with a uniform 2x2 kernel. This is the preferred mode for natural images.
Default mode.
filtering with a lowpass 3x3 kernel. This is the preferred mode for images
featuring sharp gray-level transitions.
4.
SAMPLE PROGRAMS
The available sample program dedicated to the EasyMatch library is the following:
MchMatch: lets you learn a pattern using an ROI and retrieve one or more instances in the
whole image.
Remarks
The corresponding projects for Microsoft Visual C++ can be found in the eVision\MsVc Samples subfolder, the projects for Borland C++ Builder is located in the eVision\BcB Samples sub-folder, while
the projects for RedHat is in the /usr/local/euresys/eVision/samples/console/MchMatch sub-folder.
389
EasyOCV:
Optical Character Verification
1.
EASYOCV: INTRODUCTION
Optical Character Verification, also known as mark inspection, is an inspection technique by which a
geometric pattern, termed a sample, is checked for similarity with a predefined model, called a template.
For instance, when a part number is printed on a integrated circuit package, one may need to control the
quality of the printing: correct placement with respect to the component body, sufficient contrast, good
shaping of the characters, absence of inking defects All these factors may affect readability of the
printing.
OCV first requires training. During this phase, a good quality template is presented to the system. An
interactive utility allows defining the structure of the template and related acceptance criteria, in details.
The learnt template can be saved for later use.
When a template model is available, inspection may take place. The sample image is processed and the
system first locates the marking, allowing it to be translated, rotated and rescaled or even sheared with
respect to the template. After location, geometric comparison is performed and a few matching scores,
called quality indicators are computed. When these fall outside of given acceptance intervals, a defect
warning is generated.
EasyOCV is the eVision component that provides all means to quickly build OCV applications. It is based
upon a single object class, EOCV, that handles all necessary operations for template model edition,
learning, inspection, defect reporting and the like.
393
Inspection process
Inspection takes place in a region of interest that does not need to be the same as at learning time. The
inspection process involves two operations.
First, the region of interest is scanned and the best matching is found between the sample and the
reference template, using all of the desired degrees of freedom. This is the location process.
Then, every sample character is compared to the corresponding template character and the quality
indicators are computed. The results are collated to result in global quality indicators for the texts. This is
the scoring process.
394
When all scores are obtained, they are tested for inclusion in the acceptance intervals. When a value falls
outside an allowed range, the corresponding character/text is flagged and a diagnostic code is generated.
For most application text-level inspection, i.e. assessing text quality globally, is sufficient. If finer details
are wanted, character-level inspection, i.e. assessing the quality of each individual character, is also
possible, though more complex.
text translation: all texts can be moved horizontally and vertically in a specified range. The
corresponding parameters are called ShiftX and ShiftY.
Text translation
text rotation: all texts can be rotated about the center of their bounding box. The corresponding
parameter is an angle called Skew.
Text skewing
character translation: after the text position has been adjusted using the aforementioned degrees
of freedom, the individual characters can again be moved horizontally and vertically with respect
to their nominal position. The corresponding parameters are also called ShiftX and ShiftY.
Character translation
The former degrees of freedom are often met in practical applications. The next ones have been
implemented for completeness but should be used only when there are good reasons to do so.
text scaling: all texts can be rescaled horizontally and vertically, while the center of their bounding
box remains fixed. The corresponding parameters are ratios called ScaleX and ScaleY.
395
Text scaling
text shearing: all texts can be sheared, i.e. become italicized, while the center of their bounding
box remains fixed. The corresponding parameter is an angle called Shear.
Text shearing
The purpose of these degrees of freedom is to compensate for misalignment and distortion: translation
and rotation often arise because of non repeatability of the parts placement, f.i. because of imperfect
mechanical guiding; character translation may be due to a lack of stiffness of the printing device, but is
also a convenient way to cope with small amplitude skew or scale changes; changes in scaling occur
when lens magnification (or scene/lens distance) is changed; anisotropic scaling and shearing are even
less frequent and may occur because of relative movement between the marking device and the medium
during printing.
Since the addition of a degree of freedom increases the running time, it is advisable to use them sparingly.
In many cases, text and characters translation are sufficient. When large amplitude rotation is possible,
text translation plus rotation can be used. Care must be exercised when combining the other degrees of
freedom.
396
The number of positions tried for each degree of freedom is specified differently for translation than for the
other transforms:
translation: in principle, every integer value in the ranges ShiftX Bias + or - Tolerance and ShiftY
Bias + or - Tolerance is tried. However, for efficiency reasons, the ShiftX and ShiftY Stride
parameters can be set to a value larger than 1 so that a gross location pass with the specified
stride is followed by a finer one with unit stride. (The expected speedup is on the order of the
square of the Stride parameter.) Anyway, choosing too large a value may cause mismatches
when local maxima are present.
rotation, scaling and shearing: the Skew, ScaleX, ScaleY and Shear Count parameters indicate
the exact number of values tried for each degree of freedom in the allowed ranges, bounds
included. The execution time increases as the product of these counts. When a degree of freedom
is not used, its count must be left as 1.
Note. Even when a tolerance is set to 0 and/or a count is set to 1, the bias value is taken into account so
that its value is used for the corresponding degree of freedom. End of note.
Quality indicators
After accurate location of the model, the inspection process compares the contents of the sample image
with that of the template and rates the resemblance between them at the character level.
When the template image is thresholded, the marking appears as white pixels on a black background. The
foreground region of a character is formed by all the white pixels; the background region is formed by all
remaining pixels in the characters bounding box. The bounding box is the tightest rectangle that wholly
contain an item, with a possible safety margin.
Three types of quality indicators are available:
1. area-based: the foreground and background template areas are the pixel counts of the
foreground and background regions of a character. When the sample image is rated, thresholding
also separates white and black pixels. The foreground and background sample areas are defined
as the count of the white [black] sample pixels falling in the foreground [background] region (this is
not the same as the total count of white and black pixels).
2. gray sum-based: a different measure of the amount of light reflected by the marking is given by
sums rather than counts: the foreground [background] sample sum is defined as the sum of the
gray-level values of all pixels of the foreground [background] region of the sample image. The
foreground [background] template sum is the same feature computed on the template image to
provide a reference value. Additionally, the sums are normalized with respect to the reference
foreground and background average gray-levels to compensate for possible changes in gain
the items for which diagnostics are reported are automatically selected so that they can be
immediately highlighted on the display.
397
First, the image is thresholded to separate the foreground (marking) from the background (printing
medium). If necessary, the thresholded image can be improved manually to join split characters or
separate touching ones.
Blob analysis (as done by EasyObject) is performed and the detected objects are selected
depending on their size to generate a set of candidates. If necessary, some blobs can be
manually selected or deselected, to add features of unusual size or delete spurious objects. At
that stage, the blobs are said to be free.
The blobs are then aggregated automatically and enclosed into boxes corresponding to the
characters. If necessary, the grouping can be improved manually to merge several characters
together or on the opposite separate blobs that were erroneously put together. At that stage, the
characters are said to be free.
The characters are then aggregated automatically and enclosed into boxes corresponding to the
texts. If necessary, this grouping can be improved manually to merge several texts together or on
the opposite separate characters that were erroneously put together.
When the resulting structure is satisfactory, the actual learning process takes place. The system
will analyze the shape of the template and generate the required data structures that represent it
and allow fast inspection. It will also perform some quality measurement on the template for later
comparison with the sample.
if the marking should be considered a single piece of text or several independent ones, depending
on the possible movements;
to what extent the text position can vary in terms of translation, rotation and possibly scaling
and/or shearing;
how the texts should be decomposed into several characters, if at all, depending on the desired
level of detail for quality measurement;
if the individual characters are allowed to move with respect to their containing text.
Statistics
Optionally, statistics can be accumulated on a series of consecutive inspections: the average value of the
quality indicators can be reported, as well as their standard deviation.
398
In this way, better control of the marking process can be gained. The average shows the long-term trend
behavior of the system and allows detecting drift in the marking device settings. The standard deviation is
related the repeatability of the process and allows detecting the appearance of slack.
Another virtue of the statistic parameters is that they allow you to choose appropriate values for the
acceptance ranges. It is customary to select a tolerance value that is a small multiple of the observed
standard deviation ( + or - sigma or + or - 3sigma criterion).
EOCV is the most important and most complex object. It is called the OCV context in what follows.
It manages the template model during edition as well as inspection. Among others, it maintains
the tree-like structure of the model, seen as a set of texts each comprised of a set of characters.
During the learning phases, it works in close cooperation with an ECodedImage object for blob
analysis;
EOCVText holds all information related to a single piece of text, such as nominal and average
position, reference quality indicators It also keeps the list of its constituent characters;
EOCVChars holds all information related to a single character, such as nominal and average
position, reference quality indicators During the learning phases, it also keeps the list of its
constituent blobs.
Usually, you will just need to keep a single EOCV object in your application. The template model is built
separately and stored in a file. The inspection application merely loads the model and invokes the Inspect
method. Then, if detailed information is requested about the detected defects, the model can be queried
text by text or character by character using the corresponding parameter access functions. To use them,
you will need to declare a temporary EOCVText or EOCVChar object.
399
Sample drawing
Free objects management
Free characters management
Template texts management
Text parameters
Text character parameters
Sample texts and char selection
Learning
Contrast
Location options
Inspection options
Inspection
Statistics
EOCVChar
Character location parameters
Character position parameters
Character inspection parameters
Character statistics
Miscellaneous character parameters
ResetParameters
EOCVText
Text location parameters
Text position parameters
Text inspection parameters
Text statistics
Miscellaneous text parameters
ResetParameters
Declare using
#include "EOCV.h"
400
2.
2.1
EOCV
2.1.1
EOCV Overview
EasyOCV is the eVision component that provides all means to quickly build OCV applications. It is based
upon a single object class, EOCV, that handles all necessary operations for template model edition,
learning, inspection, defect reporting and the like.
See EasyOCV Library Overview for more information.
Declare using
#include "EOCV.h"
2.1.2
2.1.2.1
Construction
EOCV: Construction
Only the default constructor is needed.
EOCV();
2.1.2.2
Persistent storage
EOCV::Load
void EOCV::Load(const char* pszPathName);
Loads the OCV context from a file (before inspection). Only the members related to the template are
retrieved.
Parameters
pszPathName
full path and file name to save to/load from. File extension .ocv is
recommended but not mandatory.
Remarks
After learning, the template model can be stored in a file for later use. After it has been loaded,
inspection can immediately take place.
Loading a template model empties the data structures used for model edition (free objects, free
characters).
401
EOCV::Save
void EOCV::Save(const char* pszPathName);
Saves the OCV context to a file for later use. Only the members related to the template are stored.
Parameters
pszPathName
full path and file name to save to/load from. File extension .ocv is
recommended but not mandatory.
Remarks
After learning, the template model can be stored in a file for later use. After it has been loaded,
inspection can immediately take place.
EOCV::Dump
void EOCV::Dump();
Outputs a readable description of the OCV context contents to the standard output console.
2.1.2.3
Template Drawing
EOCV::DrawTemplateObjects
void DrawTemplateObjects(HDC hDC, enum E_SELECTION_MODE eObjectsSelectionMode=
E_SELECTED_TRUE, FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32 f32OrgX= 0.f,
FLOAT32 f32OrgY= 0.f);
Draws the free objects as blobs. The associated coded image must be present.
Parameters
hDC
eObjectsSelectionMode
f32ZoomX, f32ZoomY
f32OrgX, f32OrgY
Remarks
The template drawing member functions are used to graphically represent the free objects, free
characters, texts and text characters associated to the OCV context before learning. All drawing
operations are done using the current pen attributes.
EOCV::DrawTemplateChars
void DrawTemplateChars(HDC hDC, enum E_SELECTION_MODE eCharsSelectionMode=
E_SELECTED_TRUE, FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32 f32OrgX= 0.f,
FLOAT32 f32OrgY= 0.f);
402
eCharsSelectionMode
f32ZoomX, f32ZoomY
f32OrgX, f32OrgY
Remarks
The template drawing member functions are used to graphically represent the free objects, free
characters, texts and text characters associated to the OCV context before learning. All drawing
operations are done using the current pen attributes.
EOCV::DrawTemplateTexts
void DrawTemplateTexts(HDC hDC, enum E_SELECTION_MODE eTextsSelectionMode=
E_SELECTED_TRUE, FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32 f32OrgX= 0.f,
FLOAT32 f32OrgY= 0.f);
Remarks
The template drawing member functions are used to graphically represent the free objects, free
characters, texts and text characters associated to the OCV context before learning. All drawing
operations are done using the current pen attributes.
EOCV::DrawTemplateTextsChars
void DrawTemplateTextsChars(HDC hDC, enum E_SELECTION_MODE eTextsSelectionMode=
E_SELECTED_TRUE, enum E_SELECTION_MODE eCharsSelectionMode= E_SELECTED_TRUE, FLOAT32
f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32 f32OrgX= 0.f, FLOAT32 f32OrgY= 0.f);
f32ZoomX, f32ZoomY
f32OrgX, f32OrgY
Remarks
The template drawing member functions are used to graphically represent the free objects, free
characters, texts and text characters associated to the OCV context before learning. All drawing
operations are done using the current pen attributes.
403
2.1.2.4
Sample drawing
EOCV::DrawText
void DrawText(HDC hDC, EOCVText& Text, FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f,
FLOAT32 f32OrgX= 0.f, FLOAT32 f32OrgY= 0.f);
Draws a tight bounding box around a single text, possibly with the main diagonal where diagnostics
occur.
Parameters
hDC
Text
f32ZoomX, f32ZoomY
f32OrgX, f32OrgY
Remarks
The sample drawing member functions are used to graphically represent the texts and text characters
located in the image during inspection. All drawing operations are done using the current pen
attributes.
Normally, the characters and texts are drawn as a bounding box. However, when diagnostics have
been raised on a character or text, the main diagonal (north west to south east) is drawn as well,
indicating that the item is rejected.
EOCV::DrawTexts
void DrawTexts(HDC hDC, enum E_SELECTION_MODE eTextsSelectionMode= E_SELECTED_TRUE,
FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32 f32OrgX= 0.f, FLOAT32 f32OrgY=
0.f);
Draws a tight bounding box around all texts, possibly with the main diagonal where diagnostics occur.
Parameters
hDC
eTextsSelectionMode
f32ZoomX, f32ZoomY
f32OrgX, f32OrgY
Remarks
The sample drawing member functions are used to graphically represent the texts and text characters
located in the image during inspection. All drawing operations are done using the current pen
attributes.
Normally, the characters and texts are drawn as a bounding box. However, when diagnostics have
been raised on a character or text, the main diagonal (north west to south east) is drawn as well,
indicating that the item is rejected.
EOCV::DrawTextChars
void DrawTextChars(HDC hDC, EOCVText& Text, enum E_SELECTION_MODE
eCharsSelectionMode= E_SELECTED_TRUE, FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f,
FLOAT32 f32OrgX= 0.f, FLOAT32 f32OrgY= 0.f);
404
Draws a tight bounding box around all characters of a single text, possibly with the main diagonal
where diagnostics occur.
Parameters
hDC
Text
eCharsSelectionMode
f32ZoomX, f32ZoomY
f32OrgX, f32OrgY
Remarks
The sample drawing member functions are used to graphically represent the texts and text characters
located in the image during inspection. All drawing operations are done using the current pen
attributes.
Normally, the characters and texts are drawn as a bounding box. However, when diagnostics have
been raised on a character or text, the main diagonal (north west to south east) is drawn as well,
indicating that the item is rejected.
EOCV::DrawTextsChars
void DrawTextsChars(HDC hDC, enum E_SELECTION_MODE eTextsSelectionMode=
E_SELECTED_TRUE, enum E_SELECTION_MODE eCharsSelectionMode= E_SELECTED_TRUE, FLOAT32
f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32 f32OrgX= 0.f, FLOAT32 f32OrgY= 0.f);
Remarks
The sample drawing member functions are used to graphically represent the texts and text characters
located in the image during inspection. All drawing operations are done using the current pen
attributes.
Normally, the characters and texts are drawn as a bounding box. However, when diagnostics have
been raised on a character or text, the main diagonal (north west to south east) is drawn as well,
indicating that the item is rejected.
EOCV::GetTextPoint
void GetTextPoint (UINT32 un32TextIndex, INT32& n32X, INT32& n32Y, FLOAT32
f32ReducedX= 0.f, FLOAT32 f32ReducedY= 0.f, FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY=
0.f, FLOAT32 f32PanX= 0.f, FLOAT32 f32PanY= 0.f);
405
Parameters
un32TextIndex
n32X
n32Y
f32ReducedX
f32ReducedY
f32ZoomX, f32ZoomY
f32PanX, f32PanY
Remarks
The parameters f32ReducedX and f32ReducedY are used to indicate the position of the requested
point relatively to the bounding box. These parameters can take values from -1 to 1 where 1 is the half
height or half width of the bounding box. By default, the returned point is the center of the bounding
box.
EOCV::GetTextCharPoint
void GetTextCharPoint(UINT32 un32TextIndex, UINT32 un32CharIndex, INT32& n32X,
INT32& n32Y, FLOAT32 f32ReducedX= 0.f, FLOAT32 f32ReducedY= 0.f, FLOAT32 f32ZoomX=
1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32 f32PanX= 0.f, FLOAT32 f32PanY= 0.f);
406
Remarks
The parameters f32ReducedX and f32ReducedY are used to indicate the position of the requested
point relatively to the bounding box. These parameters can take values from -1 to 1 where 1 is the half
height or half width of the bounding box. By default, the returned point is the center of the bounding
box.
2.1.2.5
Template image
EOCV::Get/SetTemplateImage
EROIBW8* GetTemplateImage();
Retrieves the source template image associated to the OCV context during model edition.
void SetTemplateImage(EROIBW8* pImage);
Associates the source template image to the OCV context. This must be done as a first step before
any model edition operation. During edition, the source image should not be altered.
Parameters
pImage
Remarks
Before learning, the OCV context must have access to the template image to pre-process it. After
learning, the OCV context keeps an internal copy for comparison purposes.
EOCV::m_TemplateImage
EROIBW8 m_TemplateImage
407
2.1.2.6
EOCV::m_Objects
static EObjectsVector m_Objects
The individual free objects of the OCV context can be accessed directly as a vector of EOCVObject
objects. Note that this is a static class member, so that only one OCV context at a time may use free
objects.
Remarks
The free objects are blobs built using a separate coded image. One step of the model definition is to
specify which objects will be handled by the OCV context.
EOCV::CreateTemplateObjects
void CreateTemplateObjects(ECodedImage* pCodedImage, enum E_SELECTION_MODE
eCodedObjectsSelectionMode= E_SELECTED_TRUE);
Adds to the OCV context the objects from the list of the associated coded image.
Parameters
eObjectsSelectionMode
Remarks
The free objects are blobs built using a separate coded image. One step of the model definition is to
specify which objects will be handled by the OCV context.
EOCV::SelectTemplateObjects
void SelectTemplateObjects(INT32 n32OrgX, INT32 n32OrgY, INT32 n32Width, INT32
n32Height, enum E_SELECTION_MODE eObjectsSelectionMode= E_SELECTED_ANY);
Toggles selection of the objects whose bounding box intersects a given rectangle (unselected
becomes selected and conversely).
Parameters
n32OrgX, n32OrgY
n32Width, n32Height
eObjectsSelectionMode
Remarks
The free objects are blobs built using a separate coded image. One step of the model definition is to
specify which objects will be handled by the OCV context.
EOCV::DeleteTemplateObjects
void DeleteTemplateObjects(enum E_SELECTION_MODE eObjectsSelectionMode=
E_SELECTED_TRUE);
408
Remarks
The free objects are blobs built using a separate coded image. One step of the model definition is to
specify which objects will be handled by the OCV context.
2.1.2.7
EOCV::m_FreeChars
EOCVCharVector m_FreeChars
The individual free characters of the OCV context can be accessed directly as a vector of EOCVChar
objects.
Remarks
The free characters are sets of blobs taken from the free objects list. One step of the model definition is
to specify which free objects will be handled by the OCV context and how they will be grouped to form
characters. Grouping can be done automatically by using a overlapping criterion, or explicitly. When an
object is added to a character, it is removed from the free objects list.
EOCV::CreateTemplateChars
void CreateTemplateChars(enum E_SELECTION_MODE eObjectsSelectionMode=
E_SELECTED_TRUE, enum OCV_CHAR_CREATION_MODES eCreationMode=
OCV_CREATE_CHAR_OVERLAP);
Adds to the OCV context the characters formed from the list of free objects.
Parameters
eObjectsSelectionMode
eCreationMode
Remarks
The free characters are sets of blobs taken from the free objects list. One step of the model definition is
to specify which free objects will be handled by the OCV context and how they will be grouped to form
characters. Grouping can be done automatically by using a overlapping criterion, or explicitly. When an
object is added to a character, it is removed from the free objects list.
EOCV::SelectTemplateChars
void SelectTemplateChars(INT32 n32OrgX, INT32 n32OrgY, INT32 n32Width, INT32
n32Height, enum E_SELECTION_MODE eCharsSelectionMode= E_SELECTED_ANY);
Toggles selection of the free characters whose bounding box intersects a given rectangle (unselected
becomes selected and conversely).
409
Parameters
n32OrgX, n32OrgY
n32Width, n32Height
eCharsSelectionMode
Remarks
The free characters are sets of blobs taken from the free objects list. One step of the model definition is
to specify which free objects will be handled by the OCV context and how they will be grouped to form
characters. Grouping can be done automatically by using a overlapping criterion, or explicitly. When an
object is added to a character, it is removed from the free objects list.
EOCV::DeleteTemplateChars
void DeleteTemplateChars(enum E_SELECTION_MODE eCharsSelectionMode=
E_SELECTED_TRUE);
Remarks
The free characters are sets of blobs taken from the free objects list. One step of the model definition is
to specify which free objects will be handled by the OCV context and how they will be grouped to form
characters. Grouping can be done automatically by using a overlapping criterion, or explicitly. When an
object is added to a character, it is removed from the free objects list.
2.1.2.8
EOCV::m_Texts
EOCVTextVector m_Texts
The individual texts of the OCV context can be accessed directly as a vector of EOCVText objects.
Remarks
The template texts are sets of characters taken from the free characters list. One step of the model
definition is to specify which free characters will be handled by the OCV context and how they will be
grouped to form texts. Grouping must be done explicitly. When a character is added to a text, it is
removed from the free characters list.
EOCV::CreateTemplateTexts
void CreateTemplateTexts(enum E_SELECTION_MODE eCharsSelectionMode=
E_SELECTED_TRUE);
Adds to the OCV context a piece of text formed from the list of free characters.
410
Parameters
eCharsSelectionMode
Remarks
The template texts are sets of characters taken from the free characters list. One step of the model
definition is to specify which free characters will be handled by the OCV context and how they will be
grouped to form texts. Grouping must be done explicitly. When a character is added to a text, it is
removed from the free characters list.
EOCV::SelectTemplateTexts
void SelectTemplateTexts(INT32 n32OrgX, INT32 n32OrgY, INT32 n32Width, INT32
n32Height, enum E_SELECTION_MODE eTextsSelectionMode= E_SELECTED_ANY);
Toggles selection of the template texts whose bounding box intersects a given rectangle (unselected
becomes selected and conversely).
Parameters
n32OrgX, n32OrgY
n32Width, n32Height
eTextSelectionMode
Remarks
The template texts are sets of characters taken from the free characters list. One step of the model
definition is to specify which free characters will be handled by the OCV context and how they will be
grouped to form texts. Grouping must be done explicitly. When a character is added to a text, it is
removed from the free characters list.
EOCV::DeleteTemplateTexts
void DeleteTemplateTexts(enum E_SELECTION_MODE eTextsSelectionMode=
E_SELECTED_TRUE);
Remarks
The template texts are sets of characters taken from the free characters list. One step of the model
definition is to specify which free characters will be handled by the OCV context and how they will be
grouped to form texts. Grouping must be done explicitly. When a character is added to a text, it is
removed from the free characters list.
411
2.1.2.9
Text parameters
individually (Get/Set), using the text index: the parameter values associated to a single piece of
text can be read or written from/to the temporary EOCVText;
collectively (Gather/Scatter), using text selection: the parameter values associated to all texts, all
selected texts or all unselected texts can be read or written from/to the temporary EOCVText.
Undefined parameters
When reading parameters (Get or Gather), the value of one of them may be undefined, either because
it was not computed, or because its value is not unique among the selected texts. When this occurs,
the Get or Gather function will return (in the temporary EOCVText object) one of the reserved values,
depending on the parameter type.
Always be sure to check that a returned parameter does not have such an undefined value assigned,
otherwise its contents will appear meaningless.
When writing (Set or Scatter), only parameters with a defined value (in the temporary EOCVText
object) will be copied.
Before setting parameters, be sure to call the ResetParameters member of the temporary EOCVText
object. This will reset all parameters to the undefined value, thus avoiding unwanted copy.
EOCV::GetNumTexts
UINT32 GetNumTexts();
Returns the number of texts in this OCV context. The texts are numbered from 0 to NumTexts-1.
EOCV::Get/SetTextParameters
void GetTextParameters(EOCVText& Text, UINT32 un32TextIndex);
Copies the parameters from the text of given index to the temporary text. For each text parameter
retrieved, the corresponding value is different from undefined.
Always be sure to check that a returned parameter does not have such an undefined value assigned,
otherwise its contents will appear meaningless.
Parameters
Text
un32TextIndex
Copies the desired parameters from the temporary text to the text of given index. Only the parameters
for which the value is not undefined value are copied.
Before setting parameters, be sure to call the ResetParameters member of the temporary EOCVText
object. This will reset all parameters to the undefined value, thus avoiding unwanted copy.
Parameters
Text
un32TextIndex
412
EOCV::Get/SetTextParameters
void GetTextParameters(EOCVText& Text, UINT32 un32TextIndex);
Copies the parameters from the text of given index to the temporary text. For each text parameter
retrieved, the corresponding value is different from undefined.
Always be sure to check that a returned parameter does not have such an undefined value assigned,
otherwise its contents will appear meaningless.
Parameters
Text
un32TextIndex
Copies the desired parameters from the temporary text to the text of given index. Only the parameters
for which the value is not undefined value are copied.
Before setting parameters, be sure to call the ResetParameters member of the temporary EOCVText
object. This will reset all parameters to the undefined value, thus avoiding unwanted copy.
Parameters
Text
un32TextIndex
EOCV::Gather/ScatterTextsParameters
void GatherTextsParameters(EOCVText& Text, enum E_SELECTION_MODE
eTextsSelectionMode);
Copies the parameters from the texts specified by the selection mode to the temporary text. For each
text parameter that has a unique value among the specified texts, the corresponding value is different
from undefined.
Always be sure to check that a returned parameter does not have such an undefined value assigned,
otherwise its contents will appear meaningless.
Parameters
Text
eTextsSelectionMode
Copies the desired parameters from the temporary text to the texts specified by the selection mode.
Only the parameters for which the value is not undefined value are copied.
Before setting parameters, be sure to call the ResetParameters member of the temporary EOCVText
object. This will reset all parameters to the undefined value, thus avoiding unwanted copy.
Parameters
Text
eTextsSelectionMode
413
EOCV::Gather/ScatterTextsParameters
void GatherTextsParameters(EOCVText& Text, enum E_SELECTION_MODE
eTextsSelectionMode);
Copies the parameters from the texts specified by the selection mode to the temporary text. For each
text parameter that has a unique value among the specified texts, the corresponding value is different
from undefined.
Always be sure to check that a returned parameter does not have such an undefined value assigned,
otherwise its contents will appear meaningless.
Parameters
Text
eTextsSelectionMode
Copies the desired parameters from the temporary text to the texts specified by the selection mode.
Only the parameters for which the value is not undefined value are copied.
Before setting parameters, be sure to call the ResetParameters member of the temporary EOCVText
object. This will reset all parameters to the undefined value, thus avoiding unwanted copy.
Parameters
Text
eTextsSelectionMode
individually (Get/Set), using a text and a character index: the parameter values associated to a
single character can be read or written from/to the temporary EOCVChar;
collectively (Gather/Scatter), using text and character selection: the parameter values associated
to all characters, all selected characters or all unselected characters of the desginated texts can
be read or written from/to the temporary EOCVChar.
Undefined parameters
When reading parameters (Get or Gather), the value of one of them may be undefined, either because
it was not computed, or because its value is not unique among the selected characters. When this
occurs, the Get or Gather function will return (in the temporary EOCVChar object) one of the undefined
value, depending on the parameter type.
Always be sure to check that a returned parameter does not have such an undefined value assigned,
otherwise its contents will appear meaningless.
When writing (Set or Scatter), only parameters with a defined value (in the temporary EOCVChar
object) will be copied.
Before setting parameters, be sure to call the ResetParameters member of the temporary EOCVChar
object. This will reset all parameters to the undefined value, thus avoiding unwanted copy.
414
EOCV::GetNumTextChars
UINT32 GetNumTextChars(UINT32 un32TextIndex);
Returns the number of characters in this OCV context. The characters are numbered from 0 to
NumTextChars excluded.
Parameters
un32TextIndex
EOCV::Get/SetTextCharParameters
void GetTextCharParameters(EOCVChar& Char, UINT32 un32TextIndex, UINT32
un32CharIndex);
Copies the parameters from the character of given index to the temporary character. For each
character parameter retrieved, the corresponding value is different from undefined.
Always be sure to check that a returned parameter does not have such an undefined value assigned,
otherwise its contents will appear meaningless.
Parameters
Char
un32TextIndex
un32CharIndex
Copies the desired pameters from the temporary character to the character of given index. Only the
parameters for which the value is not undefined are copied.
Before setting parameters, be sure to call the ResetParameters member of the temporary EOCVChar
object. This will reset all parameters to the undefined value, thus avoiding unwanted copy.
Parameters
Char
un32TextIndex
un32CharIndex
EOCV::Get/SetTextCharParameters
void GetTextCharParameters(EOCVChar& Char, UINT32 un32TextIndex, UINT32
un32CharIndex);
Copies the parameters from the character of given index to the temporary character. For each
character parameter retrieved, the corresponding value is different from undefined.
Always be sure to check that a returned parameter does not have such an undefined value assigned,
otherwise its contents will appear meaningless.
Parameters
Char
un32TextIndex
un32CharIndex
415
Copies the desired pameters from the temporary character to the character of given index. Only the
parameters for which the value is not undefined are copied.
Before setting parameters, be sure to call the ResetParameters member of the temporary EOCVChar
object. This will reset all parameters to the undefined value, thus avoiding unwanted copy.
Parameters
Char
un32TextIndex
un32CharIndex
EOCV::Gather/ScatterTextsCharsParameters
void GatherTextsCharsParameters(EOCVChar& Char, enum E_SELECTION_MODE
eTextsSelectionMode, enum E_SELECTION_MODE eCharsSelectionMode);
Copies the parameters from the characters specified by the selection modes to the temporary
character. For each character parameter that has a unique value among the specified characters, the
corresponding value is different from undefined.
Always be sure to check that a returned parameter does not have such an undefined value assigned,
otherwise its contents will appear meaningless.
Parameters
Char
eTextsSelectionMode
eCharsSelectionMode
Copies the desired parameters from the temporary character to the characters specified by the
selection mode. Only the parameters for which the value is not undefined are copied.
Before setting parameters, be sure to call the ResetParameters member of the temporary EOCVChar
object. This will reset all parameters to the undefined value, thus avoiding unwanted copy.
Parameters
Char
eTextsSelectionMode
eCharsSelectionMode
EOCV::Gather/ScatterTextsCharsParameters
void GatherTextsCharsParameters(EOCVChar& Char, enum E_SELECTION_MODE
eTextsSelectionMode, enum E_SELECTION_MODE eCharsSelectionMode);
Copies the parameters from the characters specified by the selection modes to the temporary
character. For each character parameter that has a unique value among the specified characters, the
corresponding value is different from undefined.
Always be sure to check that a returned parameter does not have such an undefined value assigned,
otherwise its contents will appear meaningless.
416
Parameters
Char
eTextsSelectionMode
eCharsSelectionMode
Copies the desired parameters from the temporary character to the characters specified by the
selection mode. Only the parameters for which the value is not undefined are copied.
Before setting parameters, be sure to call the ResetParameters member of the temporary EOCVChar
object. This will reset all parameters to the undefined value, thus avoiding unwanted copy.
Parameters
Char
eTextsSelectionMode
eCharsSelectionMode
Toggles selection of the template texts whose bounding box intersects a given rectangle (unselected
become selected and conversely).
Parameters
n32OrgX, n32OrgY
n32Width, n32Height
eTextsSelectionMode
Remarks
Reading or changing properties of the sample texts and the characters they contain can be done on
basis of selection.
417
EOCV::SelectSampleTextsChars
void SelectSampleTextsChars(INT32 n32OrgX, INT32 n32OrgY, INT32 n32Width, INT32
n32Height, enum E_SELECTION_MODE eTextsSelectionMode= E_SELECTED_ANY, enum
E_SELECTION_MODE eCharsSelectionMode= E_SELECTED_ANY);
Toggles selection of the template text characters whose bounding box intersects a given rectangle
(unselected become selected and conversely).
Parameters
n32OrgX, n32OrgY
n32Width, n32Height
eTextsSelectionMode
eCharsSelectionMode
Remarks
Reading or changing properties of the sample texts and the characters they contain can be done on
basis of selection.
2.1.2.12 Learning
EOCV::Learn
void Learn(EROIBW8* pImage, enum E_SELECTION_MODE eTextsSelectionMode=
E_SELECTED_TRUE, enum E_SELECTION_MODE eCharsSelectionMode= E_SELECTED_TRUE);
Preprocesses the model so that all required internal data structures are set up. After learning, the
model may not be edited anymore. It can be saved for later use and becomes ready for the inspection
task.
Parameters
pImage
eCharsSelectionMode
eTextsSelectionMode
Remarks
Learning is the final step of the model editing.
EOCV::ComputeDefaultTolerances
void ComputeDefaultTolerances(EROIBW8 *pRoi, UINT32 un32Threshold=
IMG_MIN_RESIDUE_THRESHOLD);
Computes or recomputes the default tolerances of the quality indicators currently in use for all
characters of all texts from the given ROI and threshold.
Parameters
pRoi
un32Threshold
418
Pointer to the ROI from which the default tolerances should be computed.
Threshold level to use during computation, as defined by enum
IMG_THRESHOLD_MODES.
Remarks
An explicit call of this method is performed by method Learn at the end of the learning stage.
Returns the global contrast of the template image, or FLOAT32_UNDEFINED if it has not been
computed.
FLOAT32 GetSampleContrast();
Returns the global contrast of the last inspected image, or FLOAT32_UNDEFINED if it has not been
computed.
FLOAT32 GetContrastAverage();
Returns the average contrast of last images added to statistics, or FLOAT32_UNDEFINED if it cannot
be computed.
FLOAT32 GetContrastDeviation();
Returns the standard deviation of the contrast of the last images added to statistics, or
FLOAT32_UNDEFINED if it cannot be computed.
FLOAT32 GetContrastTolerance();
Returns the allowed tolerance on the global contrast (allowed difference between the sample and
template values).
void SetContrastTolerance(FLOAT32 f32Tolerance);
Sets the allowed tolerance on the global contrast (allowed difference between the sample and template
values).
419
Parameters
f32Tolerance
EOCV::Get/SetWhiteOnBlack
BOOL EOCV::GetWhiteOnBlack();
OCV contrast parameter. TRUE if the learning and inspection steps used
white characters on a black background, FALSE otherwise.
Remarks
By default, the WhiteOnBlack parameter is set to TRUE.
It is important to note that this parameter affects the learning AND the inspection steps.
Moreover, the use of the "black characters on a white background" mode requires the choice of the
correct ECodedImage class.
420
Remarks
For efficiency reasons, the quality indicators can be computed on demand only. The
UsedQualityIndicators parameter is the logical combination (bitwise OR) of the values in enum
OCV_QUALITY_INDICATORS. When a bit is set in this mask, the corresponding feature is computed.
EOCV: Get/SetResampleChars
BOOL GetResampleChars();
Remarks
Normally, when text is inspected with rotation, scaling and/or shearing, some resampling must be
performed when computing the quality indicators on the separate characters. If the angles remain
small and the scale factors remain very close to unity, this resampling can be avoided by setting the
ResampleChars parameter to FALSE.
EOCV::Get/SetReduceLocationScore
BOOL GetReduceLocationScore();
Remarks
The location score is computed as a sum of gray-level values along the character contours. When the
Reduce mode is in effect, which is the default, the location score is divided by the number of contour
points, giving an average gray-level, in range 0..255. The non-reduced mode is considered obsolete.
The location score reduction mode is independent of the location score normalization mode.
EOCV::Get/SetNormalizeLocationScore
BOOL GetNormalizeLocationScore();
421
Parameters
bNormalizeLocationScore
Remarks
Location score normalization performs a score correction using the sample and template reference
gray levels. It is intended to correct potential contrast or intensity discrepancies between template and
sample images, and acts as if the sample image had the same foreground and background reference
gray levels than the template image.
It is recommended to turn this option on if the acquisition conditions can change from one sample to an
other. However, the correction may have a bad effect if the image acquisition system (camera) uses
gamma correction, or the acquired image is saturated.
The location score normalization mode is independent of the location score reduction mode.
EOCV::Get/SetAccurateTextsLocationScore
BOOL GetAccurateTextsLocationScore();
Remarks
During text location, the text location score is computed before any individual character displacement is
allowed. This results in lower location scores because the matching between undeformed template and
sample texts is less accurate.
When turned on, option AccurateTextsLocationScore allows the score to be corrected, by taking into
account the character displacements. This allows more robust diagnostics based on the location score.
If no movement freedom is given to the characters (i.e. no ShiftTolerance), this option is irrelevant.
2.1.2.16 Inspection
EOCV::Inspect
void Inspect(EROIBW8* pSampleImage, UINT32 un32Threshold);
Parameters
pSampleImage
un32Threshold
Remarks
Inspection is the process that locates the template in the sample image using all allowed degrees of
freedom, compares both images to detects and quantify defects. After inspection, all defective texts
and text characters are selected. Further, the Diagnostics binary mask contain a detailed interpretation
of the defects found.
A few options can be tuned to speedup the inspection process (see Location options and Inspection
options).
422
EOCV::GetDiagnostics
UINT32 GetDiagnostics();
Returns the logical combination (bitwise OR) of the defects found, as define by enum
OCV_DIAGNOSTICS).
Remarks
Inspection is the process that locates the template in the sample image using all allowed degrees of
freedom, compares both images to detects and quantify defects. After inspection, all defective texts
and text characters are selected. Further, the Diagnostics binary mask contain a detailed interpretation
of the defects found.
2.1.2.17 Statistics
EOCV: Statistics overview
To obtain better control on the marking process or easily choose the allowed ranges for inspection
parameters, the OCV context can maintain statistics about a number of parameters. Each time a new
inspection takes place, you can decide to take the results into account in the statistics or not.
The average and standard deviation of the following parameters can be obtained separately for each
text and text character:
Location
ShiftX, ShiftY
Skew, Shear, ScaleX, ScaleY (texts only)
LocationScore
Inspection
Template/Sample Background/Foreground Area
Template/Sample Background/Foreground Sum
Correlation
Use the GetTextParameters or GetTextCharParameters member to retrieve these values. Also see
Text statistics and Character statistics.
EOCV::ClearStatistics
void ClearStatistics();
Resets the statistics accumulation. This function must be called before a batch of inspections.
EOCV::UpdateStatistics
void UpdateStatistics();
Adds the parameters of the last inspection to the statistics. This function must be called explicitly for
the current sample to be taken into account.
EOCV::GetStatisticsCount
UINT32 GetStatisticsCount()
423
Returns the number of samples that have been taken into account in the statistics so far. For averages
to be computed, this member must amount to at least 1. For standard deviations to be computed, this
member must amount to at least 2.
EOCV::AdjustTextsLocationRanges
void AdjustTextsLocationRanges(FLOAT32 f32Factor= 1.2, enum E_SELECTION_MODE
eSelection= E_SELECTED_TRUE);
Adjust the location ranges (i.e tolerances and bias) of texts using the results of the statistical training
(minimum and maximum observed values).
Parameters
f32Factor
eSelection
Remarks
The method reassigns bias and tolerances values according to their minimum and maximum observed
values in the X and Y directions (reported by statistics). The following adjustments are made on texts
whose selection state matches eSelection:
- m_f32Shift Bias is assigned 1/2 *(m_f32Shift Max + m_f32Shift Min)
- m_f32Shift Tolerance is assigned 1/2 * f32Factor * (m_f32Shift Max - m_f32Shift Min)
Defined this way, the allowed range is simply the observed range enlarged by the user-defined factor.
The default value for f32Factor is 1.2 (+20 % allowance)
EOCV::AdjustCharsLocationRanges
void AdjustCharsLocationRanges(FLOAT32 f32Factor= 1.2, enum E_SELECTION_MODE
eTextSelection= E_SELECTED_TRUE, enum E_SELECTION_MODE eCharSelection=
E_SELECTED_TRUE);
Adjust the location ranges (i.e tolerances and bias) of the characters using the results of the statistical
training (minimum and maximum observed values).
Parameters
f32Factor
eTextSelection
eCharSelection
Remarks
The method reassigns bias and tolerances values according to their minimum and maximum observed
values in the X and Y directions (reported by statistics). The following adjustments are made on
characters whose selection state matches eTextSelection and eCharSelection:
- m_f32Shift Bias is assigned 1/2 *(m_f32Shift Max + m_f32Shift Min)
- m_f32Shift Tolerance is assigned 1/2 * f32Factor * (m_f32Shift Max - m_f32Shift Min)
Defined this way, the allowed range is simply the observed range enlarged by the user-defined factor.
The default value for f32Factor is 1.2 (+20 % allowance)
424
EOCV::AdjustTextsQualityRanges
Adjust the allowed ranges for the text quality indicators (i.e. tolerances and bias) using the results of the
statistical training (average and standard deviation of the observed values).
void EOCV::AdjustTextsQualityRanges(FLOAT32 f32Factor= 3.3, enum E_SELECTION_MODE
eSelection= E_SELECTED_TRUE);
Parameters
f32Factor
eSelection
Remarks
The method reassigns bias and tolerances values according to their average and standard deviation,
as reported by statistics. The following adjustments are made on texts whose selection state matches
eSelection:
- the bias parameter value is assigned the corresponding parameter average
- the tolerance parameter value is assigned the product of f32Factor by its corresponding standard
deviation
Please note that 3 is a minimum value for f32Factor (3 rule).This value should be increased if
deviations are computed from a small number of samples.
EOCV::AdjustCharsQualityRanges
Adjust the allowed ranges for the character quality indicators (i.e. tolerances and bias) using the results of
the statistical training (average and standard deviation of the observed values).
void EOCV::AdjustCharsQualityRanges(FLOAT32 f32Factor= 3.3, enum E_SELECTION_MODE
eTextSelection= E_SELECTED_TRUE, enum E_SELECTION_MODE eCharSelection=
E_SELECTED_TRUE);
Parameters
f32Factor
eTextSelection
eCharSelection
Remarks
The method reassigns bias and tolerances values according to their average and standard deviation,
as reported by statistics. The following adjustments are made on characters whose selection state
matches eTextSelection and eCharSelection:
- the bias parameter value is assigned the corresponding parameter average
- the tolerance parameter value is assigned the product of f32Factor by its corresponding standard
deviation
Please note that 3 is a minimum value for f32Factor (3 rule).This value should be increased if
deviations are computed from a small number of samples.
425
EOCV::AdjustShiftTolerances
Adjust the shift tolerances on texts from a provided region of interest.
void EOCV::AdjustShiftTolerances(EROIBW8* pRoi)
Parameters
pRoi
pointer on the region of interest from which the shift tolerances will be
computed. See remarks below.
Remarks
The method performs the computation of texts shift tolerances, assuming that the specified ROI always
contains the whole text (text cannot lie outside of the ROI). Other text location parameters (skew,
scale, shear) are not taken in account, and this method should not be called if these parameters
tolerances are not set to zero. The method also assumes texts always have the same displacement,
and does not affect characters location tolerances.
2.2
2.2.1
EOCVChar
EOCVChar Overview
EOCVChars holds all information related to a single character, such as nominal and average position,
reference quality indicators During the learning phases, it also keeps the list of its constituent blobs.
See EasyOCV Library Overview for more information.
Declare using
#include "EOCV.h"
2.2.2
EOCVChar::ResetParameters
void ResetParameters();
Sets all character parameters to the undefined value for use before a SetTextCharParameters or
ScatterTextsCharsParameters operation.
EOCVChar: Character location parameters
Number of contour points
The location process relies on points from the external contours of the character constituent blobs. The
number of points to be used can be adjusted. The smaller this value, the faster the location, but a too
small value can cause mismatches.
m_un32NumContourPoints
UINT32. Number of contour points of this character used for
location.
426
Location score
During the location phase, a score is computed on the sample image. During learning, the same score
is measured on the template image to serve as a reference. The closer the template and sample
scores, the more successful the location. The location score is a first indication on the conformance of
the inspected sample. In particular, a very small sample score may indicate that the character is
absent.
m_f32TemplateLocationScore
FLOAT32. Value of the location score measured on the template
during learning. If necessary, this value may be set explicitely.
m_f32SampleLocationScore
FLOAT32. Value of the location score measured on the sample
during inspection.
m_f32LocationScoreTolerance
FLOAT32. Allowed absolute difference between the template and
sample scores. When the sample value lies outside the
acceptance interval, a character not found diagnostic is issued.
EOCVChar: Character position parameters
When the position of a text is known, each character can be translated horizontally and vertically with
respect to its nominal position.
Location is perfomed in the range Bias + or - Tolerance around the nominal position. To speed location
up, a two pass search may be performed, first with a large stride, then with a unit stride.
ShiftX
m_f32ShiftX
m_f32ShiftXBias
m_f32ShiftXTolerance
m_un32ShiftXStride
ShiftY
m_f32ShiftY
m_f32ShiftYBias
m_f32ShiftYTolerance
m_un32ShiftYStride
427
Area based
m_un32TemplateForegroundArea
m_un32SampleForegroundArea
m_un32ForegroundAreaTolerance
m_un32TemplateBackgroundArea
m_un32SampleBackgroundArea
m_un32BackgroundAreaTolerance
m_f32ForegroundSumTolerance
m_f32TemplateBackgroundSum
m_f32SampleBackgroundSum
m_f32BackgroundSumTolerance
Miscellaneous
m_un32MarginWidth
2.2.2.1
The statistics available for each character are the average, standard deviation (unbiaised), minimum and
maximum computed on the corresponding parameters for all images for which UpdateStatistics has been
invoked after inspection.
The average is only available when at least one set of results has been accumulated. The standard
deviation is only available when at least two sets of results have been accumulated.
m_f32LocationScoreAverage
FLOAT32. Location score average.
m_f32LocationScoreDeviation
FLOAT32. Location score standard deviation.
m_f32ShiftXAverage
FLOAT32. Shift X average.
428
m_f32ShiftXDeviation
m_f32ShiftXMin
m_f32ShiftXMax
m_f32ShiftYAverage
m_f32ShiftYDeviation
m_f32ShiftYMin
m_f32ShiftYMax
m_f32ForegroundAreaAverage
m_f32ForegroundAreaDeviation
m_f32BackgroundAreaAverage
m_f32BackgroundAreaDeviation
m_f32ForegroundSumAverage
m_f32ForegroundSumDeviation
m_f32BackgroundSumAverage
m_f32BackgroundSumDeviation
m_f32CorrelationAverage
m_f32CorrelationDeviation
2.3
2.3.1
EOCVText
EOCVText Overview
EOCVText holds all information related to a single piece of text, such as nominal and average position,
reference quality indicators It also keeps the list of its constituent characters.
See EasyOCV Library Overview for more information.
Declare using
#include "EOCV.h"
2.3.2
EOCVText::ResetParameters
void ResetParameters();
Sets all text parameters to the undefined value for use before a SetTextParameter or
ScatterTextsParameters operation.
429
ShiftY
m_f32ShiftY
m_f32ShiftYBias
m_f32ShiftYTolerance
m_un32ShiftYStride
Skew
m_f32Skew
m_f32SkewBias
430
m_f32SkewTolerance
m_un32SkewCount
Isotropic Scaling
m_bIsotropicScaling
ScaleX
m_f32ScaleX
m_f32ScaleXBias
m_f32ScaleXTolerance
m_un32ScaleXCount
ScaleY
m_f32ScaleY
m_f32ScaleYBias
m_f32ScaleYTolerance
m_un32ScaleYCount
Shear
m_f32Shear
m_f32ShearBias
m_f32ShearTolerance
m_un32ShearCount
431
Note that the quality indicators associated with the texts are the sums of the corresponding parameters
for each of the constituent characters.
Area based
m_un32TemplateForegroundArea
m_un32SampleForegroundArea
m_un32ForegroundAreaTolerance
m_un32TemplateBackgroundArea
m_un32SampleBackgroundArea
m_un32BackgroundAreaTolerance
m_f32ForegroundSumTolerance
m_f32TemplateBackgroundSum
m_f32SampleBackgroundSum
m_f32BackgroundSumTolerance
Miscellaneous
m_un32MarginWidth
Unused.
432
The average is only available when at least one set of results has been accumulated. The standard
deviation is only available when at least two sets of results have been accumulated.
m_f32LocationScoreAverage
FLOAT32. Location score average.
m_f32LocationScoreDeviation
FLOAT32. Location score standard deviation.
m_f32ShiftXAverage
FLOAT32. Shift X average.
m_f32ShiftXDeviation
FLOAT32. Shift X standard deviation.
m_f32ShiftXMin
FLOAT32. Minimum Shift X.
m_f32ShiftXMax
FLOAT32. Maximum Shift Y.
m_f32ShiftYAverage
FLOAT32. Shift Y average.
m_f32ShiftYDeviation
FLOAT32. Shift Y standard deviation.
m_f32ShiftYMin
FLOAT32. Minimum Shift Y.
m_f32ShiftYMax
FLOAT32. Maximum Shift Y.
m_f32ShearAverage
FLOAT32. Shear average.
m_f32ShearDeviation
FLOAT32. Shear standard deviation.
m_f32ShearMin
FLOAT32. Minimum Shear.
m_f32ShearMax
FLOAT32. Maximum Shear.
m_f32SkewAverage
FLOAT32. Skew average.
m_f32SkewDeviation
FLOAT32. Skew standard deviation.
m_f32SkewMin
FLOAT32. Minimum Skew.
m_f32SkewMax
FLOAT32. Maximum Skew.
m_f32ScaleXAverage
FLOAT32. Scale X average.
m_f32ScaleXDeviation
FLOAT32. Scale X standard deviation.
m_f32ScaleXMin
FLOAT32. Minimum Scale X.
m_f32ScaleXMax
FLOAT32. Maximum Scale Y.
m_f32ScaleYAverage
FLOAT32. Scale Y average.
m_f32ScaleYDeviation
FLOAT32. Scale Y standard deviation.
m_f32ScaleYMin
FLOAT32. Minimum Scale Y.
m_f32ScaleYMax
FLOAT32. Maximum Scale Y.
m_f32ForegroundAreaAverage
FLOAT32. Foreground area average.
m_f32ForegroundAreaDeviation
FLOAT32. Foreground area standard deviation.
m_f32BackgroundAreaAverage
FLOAT32. Background area average.
m_f32BackgroundAreaDeviation
FLOAT32. Background area standard deviation.
m_f32ForegroundSumAverage
FLOAT32. Foreground sum average.
m_f32ForegroundSumDeviation
FLOAT32. Foreground sum standard deviation.
m_f32BackgroundSumAverage
FLOAT32. Background sum average.
m_f32BackgroundSumDeviation
FLOAT32. Background sum standard deviation.
m_f32CorrelationAverage
FLOAT32. Correlation average.
m_f32CorrelationDeviation
FLOAT32. Correlation standard deviation.
EOCVText: Miscellaneous text parameters
m_bSelected
433
3.
ENUMERATION CONSTANTS
3.1
enum OCV_CHAR_CREATION_MODES
OCV_CREATE_CHAR_GROUP
OCV_CREATE_CHAR_OVERLAP
OCV_CREATE_CHAR_SEPARATE
3.2
enum OCV_QUALITY_INDICATORS
OCV_QUALITY_LOCATION
OCV_QUALITY_AREA
OCV_QUALITY_SUM
OCV_QUALITY_CORRELATION
OCV_QUALITY_CONTRAST
3.3
enum OCV_DIAGNOSTICS
OCV_CHAR_NOT_FOUND
OCV_TEXT_NOT_FOUND
OCV_CHAR_OVERPRINTING
OCV_CHAR_UNDERPRINTING
OCV_CHAR_MISMATCH
OCV_TEXT_OVERPRINTING
OCV_TEXT_UNDERPRINTING
OCV_TEXT_MISMATCH
OCV_BAD_CONTRAST
3.4
enum OCV_LOCATION_MODE
OCV_LOCATION_RAW
OCV_LOCATION_BINARIZED
OCV_LOCATION_GRADIENT
OCV_LOCATION_LAPLACIAN
Note. Experience reveals that the best location reliability is achieved by the BINARIZED and
GRADIENT modes. Additionally, the GRADIENT mode is not sensitive to the choice of a threshold
level. Use of the LAPLACIAN mode is not recommended. End of note.
434
4.
SAMPLE PROGRAMS
The available sample programs dedicated to the EasyOCV library are the following:
Ocv: is a simple OCV inspection application.
Remarks
The corresponding projects for Microsoft Visual C++ can be found in the eVision\MsVc Samples subfolder, while the projects for Borland C++ Builder are located in the eVision\BcB Samples sub-folder.
435
1.
ECHECKER: INTRODUCTION
EChecker is an inspection tool based on image comparison, i.e. finding visible differences between
representative samples (parts free of defects), and the sample to be inspected.
It starts by a learning step during which a plurality of images is provided and serve as a reference. The
images in this set are averaged to provide a noise-free template. Then, for each image to be inspected, a
comparison is made pixel by pixel between the sample and the template, and significant differences are
highlighted. The result of the comparison is a defect map. All the standard tools of blob analysis (as
provided by EasyObject) can be used to locate those defects and qualify them in terms of extent,
orientation, lightness,
The EChecker object is ideally suited when explicit inspection is wanted. It assumes that the inspected
items are rigid (their shape does not vary) and that the illumination remains uniform. This ensures that the
visual appearance of the image is repeatable enough, so that point to point image comparison makes
sense. Anyway, EChecker is capable of dealing with movement of the inspected part in the field of view
and global illumination changes.
As EChecker is a part of the EasyOCV component, declare using
#include "EOCV.h"
439
2.
2.1
EChecker
2.1.1
EChecker Overview
2.1.2
2.1.2.1
Construction
EChecker Construction
EChecker();
2.1.2.2
Source Image
EChecker::Attach
void Attach(EROIBW8* pSrc);
Associates a source image to a checker context. The source image is used in all consecutive
learning/inspection operations.
Parameters
pSrc
EChecker::GetSrcImage
EROIBW8* GetSrcImage();
2.1.2.3
Search Tolerances
EChecker::GetTolerance X/Y
UINT32 GetToleranceX();
440
Sets the search margin, i.e. the width and height of the search area surrounding the alignment
pattern(s).
Parameters
un32ToleranceX
un32ToleranceY
2.1.2.4
EChecker::Get/Set DegreesOfFreedom
UINT32 GetDegreesOfFreedom();
2.1.2.5
Gray-level Normalisation
EChecker::Get/Set Normalize
enum OCV_NORMALIZATION_MODE GetNormalize();
EChecker::GetAverage
FLOAT32 GetAverage();
Returns the global intensity of the mother image (valid in mode OCV_NORMALIZE_MOMENTS only).
441
EChecker::GetDeviation
FLOAT32 GetDeviation();
Returns the global contrast of the mother image (valid in mode OCV_NORMALIZE_MOMENTS only).
EChecker::GetDarkGray
FLOAT32 GetDarkGray();
Returns the gray level in the dark areas of the mother image (valid in mode
OCV_NORMALIZE_THRESHOLD only).
EChecker::GetLightGray
FLOAT32 GetLightGray();
Returns the gray level in the light areas of the mother image (valid in mode
OCV_NORMALIZE_THRESHOLD only).
2.1.2.6
Learning
EChecker::Register
void Register();
Realigns and normalizes the source image. Only the inspected region of interest is processed. The first
time this function is called, the current pattern ROI are used to define the search patterns.
After registration, public member m_Registered contains the realigned, normalized contents of the
inspected ROI.
EChecker::Learn
void Learn(enum OCV_LEARNING_MODES eMode);
Accumulates a reference image, following a sequence of operations: first the model is reset; then the
matching patterns are shown; next a series of images is presented to estimate the average gray-levels;
then a second series of images is presented to estimate the gray-level variations; finally, the threshold
images are generated.
Parameters
eMode
Remarks
A typical sequence with three reference images goes as follows:
442
EChecker::Get/Set RelativeTolerance
FLOAT32 GetRelativeTolerance();
Returns the current tolerance factor to be used for threshold image setup.
void GetRelativeTolerance(FLOAT32 f32Tolerance);
Sets the current tolerance factor to be used for threshold image setup.
Parameters
f32Tolerance
2.1.2.7
Batch Learning
EChecker::EmptyPathNames
void EmptyPathNames();
443
Parameters
pszPathName
EChecker::BatchLearn
void BatchLearn(enum OCV_LEARNING_MODES eMode);
Performs the learning sequence using the specified list of image files.
Parameters
eMode
2.1.2.8
Drawing
EChecker::Draw
void Draw(HDC hDC, enum OCV_DRAWING_MODES eDrawingMode, BOOL bHandles= FALSE,
FLOAT32 f32ZoomX= 1, FLOAT32 f32ZoomY= 0, FLOAT32 f32PanX= 0, FLOAT32 f32PanY= 0);
Draws one of the geometric items that define the EChecker tool.
Parameters
hDC
eDrawingMode
bHandles
f32ZoomX
f32ZoomY
f32PanX
f32PanY
2.1.2.9
Dragging
EChecker::HitTest
BOOL HitTest(INT32 n32X, INT32 n32Y);
Returns TRUE if the cursor is over one of the dragging handles. In this case, GetHitRoi returns the
name of the ROI that has been hit, and GetHitHandle returns the name of the corresponding handle.
Parameters
n32X
n32Y
EChecker::GetHitHandle
enum E_HANDLES GetHitHandle();
444
EChecker::GetHitRoi
enum ROI_HIT GetHitRoi();
EChecker::SetPan
void SetPan (FLOAT32 f32PanX, FLOAT32 f32PanY);
EChecker::GetZoom X/Y
FLOAT32 GetZoomX ();
Returns the current horizontal zooming factor for use in display operations.
FLOAT32 GetZoomY ();
Returns the current vertical zooming factor for use in display operations.
445
EChecker::GetPan X/Y
FLOAT32 GetPanX ();
Returns the current horizontal panning factor for use in display operations.
FLOAT32 GetPanY ();
Returns the current vertical panning factor for use in display operations.
EChecker::Load
void Load(const char* pszPathName);
2.1.2.12 Miscellaneous
EChecker::GetNumAverageSamples
void GetNumAverageSamples ();
Returns the number of samples that were accumulated in the "average" phase of the training.
EChecker::GetNumDeviationSamples
void GetNumDeviationSamples ();
Returns the number of samples that were accumulated in the "deviation" phase of the training.
446
3.
ENUMERATION CONSTANTS
3.1
enum ROI_HIT
ROI_NONE
LEARN_0
LEARN_1
MATCH_0
MATCH_1
INSPECT
3.2
enum OCV_DEGREES_OF_FREEDOM
OCV_TRANSLATION
OCV_ROTATION
OCV_SCALING
3.3
enum OCV_LEARNING_MODE
OCV_RESET
OCV_TEMPLATE
OCV_AVERAGE
OCV_RMS_DEVIATION
OCV_ABS_DEVIATION
OCV_READY
3.5
Translation allowed.
Rotation allowed.
Scaling allowed.
enum OCV_NORMALIZATION_MODE
OCV_NORMALIZE_NONE
OCV_NORMALIZE_MOMENTS
OCV_NORMALIZE_THRESHOLD
3.4
No ROI.
First learning ROI.
Second learning ROI.
First matching ROI.
Second matching ROI.
Inspection ROI.
restart learning.
train the mother image.
accumulate an image for average estimation.
accumulate an image for standard deviation estimation.
accumulate an image for robust deviation estimation.
end learning and compute threshold images.
enum OCV_DRAWING_MODE
OCV_DRAW_LEARN
OCV_DRAW_MATCH
OCV_DRAW_POSITION
OCV_DRAW_INSPECTED
OCV_DRAW_MAX_INSPECTED
447
4.
SAMPLE PROGRAMS
The available sample program dedicated to EChecker is the following:
OcvCheker: Allows building an EChecker model file and/or performs part inspection by
images comparison.
Remarks
The corresponding projects for Microsoft Visual C++ can be found in the eVision\MsVc Samples subfolder, while the projects for Borland C++ Builder are located in the eVision\BcB Samples sub-folder.
448
1.
EASYBARCODE: INTRODUCTION
EasyBarCode is a library dedicated to the reading of barcodes. Barcode reading is an essential task in
many industrial vision applications. Printed barcodes are generally used to ensure traceability of
manufactured goods; they can carry serial/lot numbers, manufacturer/product identification and the like.
By contrast with printed characters, barcodes are machine-readable and have been specifically designed
for this purpose. In most cases, barcodes are printed in black ink on a white paper label, most of the time
with an excellent contrast.
in the automatic mode, the reader locates the barcode in the field of view on is own. Only images
containing a single symbol are handled. Once the symbol has been found, it is decoded. In this
mode, EasyBarCode can be seen as a straightforward single barcode reader.
the manual location mode requires the user to provide the barcode position. This can be done
graphically by adjusting a rectangle around the symbol or by explicitly specifying its descriptive
parameters. In this mode, several symbols can appear in the image.
In order to make the reading of the barcode possible, some descriptive parameters (symbol position and
extent, bars layout, symbol reading area, symbology and contrast) have to be determined. The reader
then reports the encoded information (if the barcode was readable) or the reason for failure (if it was not
readable).
When ambiguities do arise (a given symbol might have a meaning under different symbologies), the
reader reports the number of possible symbologies and list the data contents by decreasing likeliness. The
running time performance and the robustness are enhanced by using prior information on the symbology.
On the other hand, the reader is able to help a non-aware user to determine the symbology of a given
symbol.
Declare using
#include "EBarCode.h"
451
2.
2.1
EBarCode Overview
Manages a complete barcode reading context, i.e. a set of descriptive parameters required to perform the
reading of a barcode.
Declare using
#include "EBarCode.h"
2.2
2.2.1
EBarCode Constructor
EBarCode();
2.2.2
Reading
EBarCode::Detect
void Detect(EROIBW8* pSrc);
Processes the image, reads the possible contents of the barcode corresponding to all enabled
symbologies and rates their likeliness.
Parameters
pSrc
Remark
Processing the image means finding the symbol (in case of automatic location mode) and retrieving its
descriptive parameters. The decoded information corresponding to a specific symbology is provided by
the decode function. The symbologies that were successfully decoded are ranked by decreasing
likeliness (range 0 to GetNumDecodedSymbologies -1). In case of the mono-symbology mode or if
only the most likely decoding matters, the Read function should be used.
452
EBarCode::Decode
void Decode(enum BRC_SYMBOLOGIES eSymbology, CHAR* pszString, UINT32 un32Length);
void Decode(enum BRC_SYMBOLOGIES eSymbology, UNICHAR* pszString, UINT32 un32Length);
Provides the decoded information (or a reading error code) corresponding to the specified symbology.
Parameters
eSymbology
pszString
un32Length
Remark
Before calling the Decode function, a Detect operation must have been performed. In case of the
mono-symbology mode or if only the most likely decoding matters, the Read function should be used.
EBarCode::Read
void Read(EROIBW8* pSrc, CHAR* pszString, UINT32 un32Length);
void Read(EROIBW8* pSrc, UNICHAR* pszString, UINT32 un32Length);
Processes the image, reads the possible contents of the barcode and returns the single possible
decoding (mono-symbology) or the most likely one (multi-symbology) or a reading error code.
Parameters
pSrc
pszString
un32Length
Remark
Processing the image means finding the symbol (in case of automatic location mode) and retrieving its
descriptive parameters. When decoding other than the most likely one are also required, a call to the
Detect function followed by a Decode should be used.
EBarCode::GetNumEnabledSymbologies
UINT32 GetNumEnabledSymbologies();
Returns the number of symbologies (among the enabled ones) for which the decoding process was
successful.
453
EBarCode::GetDecodedSymbology
enum BRC_SYMBOLOGIES GetDecodedSymbology(UINT32 un32Index);
Returns the identifier of one of the symbologies that were successfully decoded. The desired
symbology is specified by its ranking index (range 0 to GetNumDecodedSymbologies -1).
Parameters
un32Index
Remark
The symbologies that were successfully decoded are ranked by decreasing likeliness.
EBarCode::GetDecodedDirection
void GetDecodedDirection (enum BRC_SYMBOLOGIES eSymbology, BOOL &bDirectEncoding);
Indicates whether the encoding direction of the bar code, pertaining to the specified symbology, is
Direct or Inverse.
void GetDecodedDirection (BOOL &bDirectEncoding);
Indicates whether the encoding direction of the bar code, pertaining to the most likely symbology, is
Direct or Inverse.
Parameters
eSymbology
bDirectEncoding
Remark
The encoding direction is said to be Direct when the bar code longitudinal axis falls in the range [-45,
135]. Conversely, when the bar code longitudinal axis doesnt fall in the previous range, the encoding
direction is said to be Inverse.
EBarCode::GetDecodedAngle
void GetDecodedAngle(enum BRC_SYMBOLOGIES eSymbology, FLOAT32 &f32DecodedAngle,
FLOAT32 f32CutAngle = BRC_DEFAULT_CUT_ANGLE);
Allows retrieving the bar code reading angle, pertaining to the specified symbology.
void GetDecodedAngle(FLOAT32 &f32DecodedAngle, FLOAT32 f32CutAngle =
BRC_DEFAULT_CUT_ANGLE);
Allows retrieving the bar code reading angle, pertaining to the most likely symbology.
Parameters
eSymbology
f32DecodedAngle
f32CutAngle
454
EBarCode::GetDecodedRectangle
void GetDecodedRectangle(enum BRC_SYMBOLOGIES eSymbology, ERectangle &rect);
Allows retrieving the bar code reading rectangle, pertaining to the specified symbology.
void GetDecodedRectangle(ERectangle &rect);
Allows retrieving the bar code reading rectangle, pertaining to the most likely symbology.
Parameters
eSymbology
rect
2.2.3
Symbologies
EBarCode::Get/Set StandardSymbologies
enum BRC_SYMBOLOGIES GetStandardSymbologies();
Returns the enabled symbologies belonging to the group of standard symbologies, as defined by enum
BRC_SYMBOLOGIES.
void SetStandardSymbologies(enum BRC_SYMBOLOGIES eStandardSymbologies);
Enables one or several specified symbologies belonging to the group of standard symbologies, as
defined by enum BRC_SYMBOLOGIES.
Parameters
eStandardSymbologies
Remarks
Due to the large number of supported symbologies, they have been gathered in two groups. For more
information about these groups, refer to the enum BRC_SYMBOLOGIES topic.
EBarCode::Get/Set AdditionalSymbologies
enum BRC_SYMBOLOGIES GetAdditionalSymbologies();
Returns the enabled symbologies belonging to the group of additional symbologies, as defined by
enum BRC_SYMBOLOGIES.
void SetAdditionalSymbologies(enum BRC_SYMBOLOGIES eAdditionalSymbologies);
Enables one or several specified symbologies belonging to the group of additional symbologies, as
defined by enum BRC_SYMBOLOGIES.
Parameters
eAdditionalSymbologies
Remarks
Due to the large number of supported symbologies, they have been gathered in two groups. For more
information about these groups, refer to the enum BRC_SYMBOLOGIES topic.
455
2.2.4
Reading mode
EBarCode::Get/Set KnownLocation
BOOL GetKnownLocation();
Returns the flag defining whether the symbol location is known or not.
void SetKnownLocation(BOOL bKnownLocation);
Sets the flag defining whether the symbol location is known or not.
Parameters
bKnownLocation
flag defining whether the symbol location is known (TRUE) or not (FALSE).
By default, the symbol location is not known.
Remark
In case of known location, use the Set function to adjust a rectangle around the symbol.
EBarCode::Get/Set KnownModule
BOOL GetKnownModule();
Returns the flag defining whether the symbol module is known or not.
void SetKnownModule(BOOL bKnownModule);
Sets the flag defining whether the symbol module is known or not.
Parameters
bKnownModule
flag defining whether the symbol module is known (TRUE) or not (FALSE).
By default, the symbol module is not known.
Remarks
When the "KnownModule" flag is set to TRUE, it is also necessary to use SetModule and
SetThicknessRatio in order to specify the requested module and thickness ratio.
2.2.5
Reading parameters
EBarCode::Get/Set Module
FLOAT32 GetModule();
456
module value.
Remarks
The module value is a descriptive parameter participating in the encoding; it corresponds to the thinner
bar width. Symbols whose bars thickness can take two values, the module and V times the module
(where V runs from 1.5 to 3), are called binary barcodes. When the bars thickness are small integer
multiples (1 to 4 or 5) of a module, the symbols are called modular barcodes.
EBarCode::Get/Set ThicknessRatio
FLOAT32 GetThicknessRatio();
Remarks
The ThicknessRatio parameter is relevant in case of binary codes only. It corresponds to the ratio of a
thin bar width over a thick bar width and should ranges from 1.5 to 3.
EBarCode::Get/Set VerifyChecksum
EBarCode::Get/Set VerifyChecksum
BOOL GetVerifyChecksum();
Remarks
The VerifyChecksum mode enables or disables verification of the checksum character. That
verification mode is set in the same way for all enabled symbologies.
It is worth noting that checksum may be present or not in the barcode and user may verify or not
checksum validity. These two circumstances are independent and give rise to four modes of operation.
The verification process will return an Invalid checksum error in case of bad checksum character. This
error can also be generated if there is no checksum in the barcode.
In the other case, when checksum are not verified, no error will occur and the process will continue
silently.
When the "VerifyChecksum" mode is enabled, the returned decoded string doesnt contain the
checksum character(s).
Conversely, when the verification process is disabled, the checksum character(s) are concatened to
the encoded information.
457
2.2.6
Reading area
EBarCode::Set
void Set(ERectangle Rectangle);
Sets the nominal position (center coordinates), size and rotation angle of the symbol bounding box
according to a known rectangle.
Parameters
Rectangle
Remarks
A Rectangle object is characterized by its center coordinates, its size and its rotation angle. The
ERectangle class has its own overloaded Set member to set its geometrical parameters, the syntax is
the following:
void ERectangle::Set(EPoint Center, FLOAT32 f32SizeX, FLOAT32 f32SizeY, FLOAT32
f32Angle= 0);
Where:
Center
f32SizeX, f32SizeY
f32Angle
EBarCode::SetReadingCenter
void SetReadingCenter(FLOAT32 f32RelativeX, FLOAT32 f32RelativeY);
Sets the reading area center coordinates, relative to the symbol position and extent.
Parameters
f32RelativeX
f32RelativeY
reading area center abscissa, relative to the symbol position and extent.
reading area center ordinate, relative to the symbol position and extent.
EBarCode::GetRelativeReading X/Y
FLOAT32 GetRelativeReadingX();
458
EBarCode::GetRelativeReadingSize X/Y
FLOAT32 GetRelativeReadingSizeX();
Returns the reading area rotation angle, relative to the symbol skewing.
void SetReadingAngle(FLOAT32 f32ReadingAngle);
Sets the reading area rotation angle, relative to the symbol skewing.
Parameter
f32ReadingAngle
2.2.7
Graphical interaction
EBarCode::Draw
Void draw(HDC hDC, enum INS_DRAWING_MODES eDrawingMode= INS_DRAW_NOMINAL, BOOL
bDaughters= FALSE);
Remarks
The bounding box corresponds to the nominal position of the barcode (INS_DRAW_NOMINAL), in
case this information has been explicitly provided, and to the actual position (INS_DRAW_ACTUAL) if
it has been determined by image analysis.
EBarCode::HitTest
BOOL HitTest(BOOL bDaughters= TRUE);
Checks whether the cursor is positioned over a handle (TRUE) or not (FALSE).
Parameters
bDaughters
TRUE if the handles of the shapes attached to the symbol bounding box
have to be considered as well.
459
EBarCode::Drag
void Drag(INT32 n32CursorX, INT32 n32CursorY);
Moves a handle to a new position and updates the position parameters of the symbol bounding box.
Parameters
n32CursorX/Y
EBarCode::SetZoom
void SetZoom(FLOAT32 f32ZoomX= 1, FLOAT32 f32ZoomY= 0);
Sets the horizontal and vertical zooming factors for drawing operations.
Parameters
f32ZoomX
f32ZoomY
EBarCode::GetZoom X/Y
FLOAT32 GetZoomX();
FLOAT32 GetZoomY();
Sets the horizontal and vertical panning factors for drawing operations.
Parameters
f32PanX
f32PanY
EBarCode::GetPan X/Y
FLOAT32 GetPanX();
FLOAT32 GetPanY();
460
3.
ENUMERATION CONSTANTS
3.1
enum BRC_SYMBOLOGIES
Due to the large number of supported symbologies, they have been splitted into two groups. The most
commonly used symbologies have been gathered under the name Standard symbologies. The remaining
symbologies belong to the Additional symbologies group.
Standard symbologies
BRC_CODABAR
BRC_CODE_128
BRC_CODE_25_INTERLEAVED
BRC_CODE_39
BRC_EAN_128
BRC_EAN_13
BRC_MSI
BRC_UPC_A
BRC_UPC_E
BRC_STANDARD
Codabar symbology.
Code 128 symbology.
Code 25 Interleaved symbology.
Code 39 symbology.
EAN 128 symbology.
EAN 13 symbology.
MSI symbology.
UPC A symbology.
UPC E symbology.
gathers all the symbologies belonging to the standard group.
Additional symbologies
BRC_BINARY_CODE
BRC_ADS_ANKER
BRC_BC_412
BRC_CODE_11
BRC_CODE_25_DATALOGIC
BRC_CODE_25_MATRIX
BRC_CODE_25_IATA
BRC_CODE_25_INDUSTRY
BRC_CODE_25_COMPRESSED
BRC_CODE_25_INVERTED
BRC_CODE_32
BRC_CODE_39_EXTENDED
BRC_CODE_39_REDUCED
BRC_CODE_93
BRC_CODE_93_EXTENDED
BRC_CODE_BCD_MATRIX
BRC_CODE_CIP
BRC_CODE_STK
BRC_EAN_8
BRC_IBM_DELTA_DISTANCE_A
BRC_PLESSEY
BRC_TELEPEN
BRC_ADDITIONAL
BRC_SYMBOLOGY_UNKNOWN
461
4.
SAMPLE PROGRAMS
The available sample program dedicated to the EasyBarCode library is the following:
Remarks
The corresponding projects for Microsoft Visual C++ can be found in the eVision\MsVc Samples subfolder, the projects for Borland C++ Builder is located in the eVision\BcB Samples sub-folder, while
the projects for RedHat are in the /usr/local/euresys/eVision/samples/wxWidgets/BrcReading subfolder.
462
EasyMatrixCode:
Data Matrix Code Reading
1.
EASYMATRIXCODE: INTRODUCTION
A 2D-code is a two-dimensional symbol made up of a set of dots or cells arranged in a specific way, used
for marking. They can be considered as a generalization of bar codes, enabling storage of a much larger
volume of information. Presence or absence of a dot at a given position corresponds to a single bit of
information.
A Data Matrix code is a frequently used type of 2-D code. The definition of Data Matrix codes is provided
by AIM International Inc. (PA) and is available as document "AIM USA Uniform Symbology Specifications:
Data Matrix (Item X5-11)" and has been approved as standard ANSI/AIM BC11-1997.
A Data Matrix code can easily be recognized as a square or rectangular array of elementary cells. There
are two kinds (classes) of cells: the "black" one and the "white" one. The bottom and left edges contain
only black cells, while the top and right edges have alternating cells. This arrangement is known as the
finder pattern. The data contents of the Data Matrix is a string of characters chosen from several possible
character sets (digits, letters and possibly special characters), encoded using various encodation schemes
to achieve maximum packing. In addition to the data bits, redundant bits are added to allow error
correction for robust reading of degraded symbols.
A Data Matrix code is characterized by its logical size (number of cells) and encodation type,
corresponding to several levels of error correction capability, namely ECC 000, ECC 050, ECC 080, ECC
100, ECC 140 (odd symbol sizes) and ECC 200 (even symbol sizes).
EasyMatrixCode is a library dedicated to the reading of Data Matrix codes.
EasyMatrixCode provides an easy way to read a Data Matrix code. Basically, merely calling the
MatrixCodeReader.Read method on a supplied image is sufficient. In this way of working, the Data Matrix
code and its decoding are provided with any associated information (logical size, contrast type, ).
It is also possible to speed up the localization and decoding process by constraining the
MatrixCodeReader object to look for an object that matches a set of properties (EasyMatrixCode can then
work faster by only searching in a subset of all the possible Data Matrix code parameters).
These constraints can be set manually, by setting lookup ranges or single values for parameters, or can
be automatically built by asking the reader to learn a Data Matrix code.
If no learning has been performed and if no constraint has been set manually, the
MatrixCodeReader.Read method allows to read a symbol of any size, contrast, location and orientation in
a single operation.
Declare using
#include "EMatrixCode.h"
465
2.
EasyMatrixCode library has now a new user interface (API) and a totally reworked reading algorithm.
Moreover, error handling is now exception-based rather than error-code-based ("errno").
The API is greatly simplified since it uses the concept of properties (avoiding setters and getters), and
provides a single and unified way to learn and/or read a matrix code. You do not have to worry anymore
about setting parameters beforehand, since a single call to the MatrixCodeReader.Read method will
automatically perform the location and decoding of the Data Matrix code that is being analyzed.
Additionally, it is possible to speed up the processing by using the MatrixCodeReader.Learn/LearnMore
method which reduces the parameter search space.
And, last but not least, the new reading algorithm is strongly improved and now successfully finds and
decodes matrix codes even in extremely bad conditions.
The benefits of this new version of EasyMatrixCode can be classified in two main categories:
Grading improvements:
o grading (which is the process of estimating the Data Matrix symbol print quality) is now
fully compliant with the ANSI Matrix Code International Symbology Specification
466
3.
CLASSES
3.1
The "package" name is used here to represent a scope. It can be a class or a namespace in C++.
Regarding the type names, the dot has to be replaced by double colons (::) in C++, in order for a type or a
namespace to access its member (be it a type, a namespace or a property/method).
There are three classes to deal with when using EasyMatrixCode:
3.2
3.2.1
MatrixCode
MatrixCode Overview
A MatrixCode embeds all the information regarding a single Data Matrix code: its decoded string, its
grading, its errors
The MatrixCode class can be found in the Euresys::eVision package.
Note. The reference corner (Corners[0]) of a matrix code is the last corner belonging to the continuous
pattern finder when running clockwise through the matrix code borders.
467
Declare using
#include "EMatrixCode.h"
3.2.2
3.2.2.1
Properties
General Properties
MatrixCode::DecodedString property
String. This is the decoded Data Matrix symbol string.
MatrixCode::Center property
Read-only. Euresys::eVision::Point. This is the MatrixCode center.
MatrixCode::Angle property
Read-only. Float. This is the MatrixCode angle.
MatrixCode::Corners[4] property
Read-only indexed. Euresys::eVision::Point. These are the MatrixCode corners.
Example
Euresys::eVision::Point p = matrixCode.Corners[0]
468
MatrixCode::NumErrors property
INT32. This is the number of errors that were detected and corrected while decoding the symbol. Such
errors may be due to symbol degradation by scratches, blur, nonuniform illumination or slight changes
in size.
MatrixCode::LogicalSize property
EasyMatrixCode::LogicalSize::Type. This is the symbol logical size, as described by the enum
LogicalSize::Type.
MatrixCode::ContrastType property
EasyMatrixCode::Contrast::Type. This is the symbol contrast type, as described by the enum
Contrast::Type.
MatrixCode::Flipping property
EasyMatrixCode::Flipping::Type. This is the symbol flipping type, as described by the enum
Flipping::Type.
MatrixCode::Family property
EasyMatrixCode::Family::Type. This is the ECC symbol family, as described by the enum
Family::Type.
MatrixCode::LogicalSizeWidth property
INT32. For a logical size of S1 x S2, LogicalSizeWidth is the integer S2.
MatrixCode::LogicalSizeHeight property
INT32. For a logical size of S1 x S2, LogicalSizeHeight is the integer S1.
MatrixCode::LocationThreshold property
INT32. This is the absolute threshold (0 to 255 scale) that was used during location of the symbol.
MatrixCode::ReadingThreshold property
INT32. This is the absolute threshold (0 to 255 scale) that was used during reading of the symbol.
MatrixCode::IsFound property
BOOL. True if a MatrixCode object has been found in the ROI supplied to MatrixCodeReader.Read,
even if it could not be successfully decoded.
469
Remarks
If this property is false, it is still possible that an unlocalized matrix code exists in the image.
However, if IsFound is false, no other property should be read.
470
It is computed as the measured area of the active cells over the area of ideal square cells, having sides
equal to the pitches (such cells perfectly tile the symbol). Its value typically is on the order of unity.
Remarks
The quality of the printing of a data matrix can be inspected by means of several indicators that are
defined by the AIM standard. Those indicators are normalized values with typical values close to 0 or
close to 1, depending on the parameter. Additionally, a grade from 4 to 0, in decreasing quality order,
is assigned to predefined ranges of values.
These indicators, together with the returned number of errors, allow a thorough verification of the
printing quality.
MatrixCode::PrintGrowthGrade property
INT32. This is the measured print growth grading (4 to 0 scale), as defined by the AIM standard, after a
read operation, provided that the print quality assessment has been enabled.
Remarks
The quality of the printing of a data matrix can be inspected by means of several indicators that are
defined by the AIM standard. Those indicators are normalized values with typical values close to 0 or
close to 1, depending on the parameter. Additionally, a grade from 4 to 0, in decreasing quality order,
is assigned to predefined ranges of values.
These indicators, together with the returned number of errors, allow a thorough verification of the
printing quality.
MatrixCode::AxialNonuniformity property
FLOAT32. This is the measured axial non-uniformity value (1.0 to 0 scale), as defined by the AIM
standard, after a read operation, provided that the print quality assessment has been enabled.
Remarks
The quality of the printing of a data matrix can be inspected by means of several indicators that are
defined by the AIM standard. Those indicators are normalized values with typical values close to 0 or
close to 1, depending on the parameter. Additionally, a grade from 4 to 0, in decreasing quality order,
is assigned to predefined ranges of values.
These indicators, together with the returned number of errors, allow a thorough verification of the
printing quality.
MatrixCode::AxialNonUniformityGrade property
INT32. This is the measured axial non-uniformity grading (4 to 0 scale), as defined by the AIM
standard, after a read operation, provided that the print quality assessment has been enabled.
Remarks
The quality of the printing of a data matrix can be inspected by means of several indicators that are
defined by the AIM standard. Those indicators are normalized values with typical values close to 0 or
close to 1, depending on the parameter. Additionally, a grade from 4 to 0, in decreasing quality order,
is assigned to predefined ranges of values.
These indicators, together with the returned number of errors, allow a thorough verification of the
printing quality.
471
MatrixCode::UnusedErrorCorrection property
FLOAT32. This is the measured unused error correction value (1.0 to 0 scale), as defined by the AIM
standard, after a read operation, provided that the print quality assessment has been enabled.
Remarks
The quality of the printing of a data matrix can be inspected by means of several indicators that are
defined by the AIM standard. Those indicators are normalized values with typical values close to 0 or
close to 1, depending on the parameter. Additionally, a grade from 4 to 0, in decreasing quality order,
is assigned to predefined ranges of values.
These indicators, together with the returned number of errors, allow a thorough verification of the
printing quality.
MatrixCode::UnusedErrorCorrectionGrade property
INT32. This is the measured unused error correction grading (4 to 0 scale), as defined by the AIM
standard, after a read operation, provided that the print quality assessment has been enabled.
Remarks
The quality of the printing of a data matrix can be inspected by means of several indicators that are
defined by the AIM standard. Those indicators are normalized values with typical values close to 0 or
close to 1, depending on the parameter. Additionally, a grade from 4 to 0, in decreasing quality order,
is assigned to predefined ranges of values.
These indicators, together with the returned number of errors, allow a thorough verification of the
printing quality.
MatrixCode::OverallGrade property
INT32. This is the overall symbol grading (4 to 0 scale), as defined by the AIM standard, after a read
operation, provided that the print quality assessment has been enabled.
Remarks
The quality of the printing of a data matrix can be inspected by means of several indicators that are
defined by the AIM standard. Those indicators are normalized values with typical values close to 0 or
close to 1, depending on the parameter. Additionally, a grade from 4 to 0, in decreasing quality order,
is assigned to predefined ranges of values.
These indicators, together with the returned number of errors, allow a thorough verification of the
printing quality.
3.2.2.2
Methods
MatrixCode construction
Default constructor
MatrixCode::MatrixCode();
Constructs a MatrixCode context. All properties are initialized to their respective default values.
472
Copy constructor
MatrixCode::MatrixCode(const MatrixCode& MatrixCode);
Constructs a MatrixCode context based on a pre-existing MatrixCode object. All properties and internal
data are copied.
Parameters
MatrixCode
MatrixCode object.
Copies all the parameters of the current MatrixCode object into another MatrixCode object.
Parameters
MatrixCode
Graphical interaction
MatrixCode::Draw
void MatrixCode::Draw(HDC hDC, FLOAT32 f32ZoomX = 1.f, FLOAT32 f32ZoomY = 0.f,
FLOAT32 f32PanX = 0.f, FLOAT32 f32PanY = 0.f);
Draws the MatrixCode corner points and symbol finder pattern (when the symbol size has been
correctly detected). The reference corner has a bold cross marking.
Parameters
hDC
f32ZoomX
f32ZoomY
f32PanX
f32PanY
MatrixCode::DrawErrors
void MatrixCode::DrawErrors(HDC hDC, FLOAT32 f32ZoomX = 1.f, FLOAT32 f32ZoomY = 0.f,
FLOAT32 f32PanX = 0.f, FLOAT32 f32PanY = 0.f);
Draws all symbol finder pattern cells where errors were detected and corrected.
Parameters
hDC
f32ZoomX
f32ZoomY
f32PanX
f32PanY
Remarks
This member is intended to be called in conjunction with Draw.
3.3
3.3.1
SearchParamsType
SearchParamsType Overview
This type is instantiated once in each MatrixCodeReader and represents the search parameters that can
be learnt between readings.
Each property of this class represents a vector of values that are scanned at read time.
At MatrixCodeReader construction time, these sets of values are initialized with all possible values. This
means, for instance, that a Data Matrix code read in a freshly created reader is matched against all
possible logical sizes.
As a consequence, the default values of these properties are not repeated here. They are assumed (for
Vector<EnumeratedType> properties at least, and there is no other property type at the moment) to
represent every possible value of the held type.
There are no methods in this class, since all operations can be done through the individual properties
interfaces.
The SearchParamsType object needs to be used only if you wish to "override" the learning process.
The SearchParamsType class is in the Euresys::eVision::MatrixCodeReader package.
Declare using
#include "EMatrixCode.h"
3.3.2
SearchParamsType Properties
SearchParamsType::LogicalSize property
Utils::Vector<LogicalSize::Type>. The Data Matrix code symbol logical sizes the candidate
is matched against at read time.
SearchParamsType::Family property
Utils::Vector<Family::Type>. The Data Matrix code families the candidate is matched against
at read time.
SearchParamsType::Contrast property
Utils::Vector<Contrast::Type>. The Data Matrix code contrast types the candidate is matched
against at read time.
SearchParamsType::Flipping property
Utils::Vector<Flipping::Type>. The Data Matrix code flipping values the candidate is matched
against at read time.
474
3.4
3.4.1
MatrixCodeReader
MatrixCodeReader Overview
A MatrixCodeReader instance is a tool that processes an ROI and returns a MatrixCode instance. A
MatrixCodeReader has properties that allow customizing the reading process. One of these properties is
SearchParams, which is an instance of SearchParamsType. This object embeds the parameter space
where a Data Matrix code will be searched and has an interface of its own.
The MatrixCodeReader class is found in the Euresys::eVision package.
Declare using
#include "EMatrixCode.h"
3.4.2
PropertiesMatrixCodeReader::LearnMask property
Array of boolean. This allows to choose which decoded parameters are learnt when the Learn or
LearnMore methods are called.
In order to enable a parameter for learning, you need to set the kth item of LearnMask to true, k being
a value of the LearnParams::Type enumeration.
By default, all items are set to true.
Example
MatrixCodeReader reader;
reader[LearnParams::Flipping] = false;
This means the flipping property of the matrix code will not be learnt by subsequent Learn or
LearnMore calls. Thus, there are no constraints on the flipping of the MatrixCode that the
MatrixCodeReader instance is able to read.
MatrixCodeReader::SearchParams property
EasyMatrixCode::SearchParamsType. This is the parameter space that the algorithm uses to
read a Data Matrix code from an ROI.
It can be modified through automatic learning (using the Learn or LearnMore methods) or by using
SearchParamsType properties and methods.
MatrixCodeReader::ComputeGrading property
BOOL. This allows to choose whether the grading properties of the MatrixCode object will be computed
by the Read, Learn or LearnMore methods.
Remarks
Please note this is not enabled by default.
475
MatrixCodeReader::MinimumPrintGrowth property
FLOAT32. Returns the minimum reference value in use for normalization of the PrintGrowth quality
indicator.
By default, MinimumPrinthGrowth = 0.0.
Remarks
After the standard, parameter PrintGrowth must be computed as normalized value related to three
references: minimum, nominal and maximum values have to be provided.
Parameter MeasuredPrintGrowth is the raw, un-normalized print quality parameter. It is computed as
the measured area of the active cells over the area of ideal square cells, having sides equal to the
pitches (such cells perfectly tile the symbol). Its value typically is on the order of unity. The PrintGrowth
is derived from the MeasuredPrintGrowth by means of the three normalization parameters.
MatrixCodeReader::MaximumPrintGrowth property
FLOAT32. Returns the maximum reference value in use for normalization of the PrintGrowth quality
indicator.
By default, MaximumPrinthGrowth = 2.0.
Remarks
After the standard, parameter PrintGrowth must be computed as normalized value related to three
references: minimum, nominal and maximum values have to be provided.
Parameter MeasuredPrintGrowth is the raw, un-normalized print quality parameter. It is computed as
the measured area of the active cells over the area of ideal square cells, having sides equal to the
pitches (such cells perfectly tile the symbol). Its value typically is on the order of unity. The PrintGrowth
is derived from the MeasuredPrintGrowth by means of the three normalization parameters.
MatrixCodeReader::NominalPrintGrowth property
FLOAT32. Returns the nominal reference value in use for normalization of the PrintGrowth quality
indicator.
By default, NominalPrinthGrowth = 1.0.
Remarks
After the standard, parameter PrintGrowth must be computed as normalized value related to three
references: minimum, nominal and maximum values have to be provided.
Parameter MeasuredPrintGrowth is the raw, un-normalized print quality parameter. It is computed as
the measured area of the active cells over the area of ideal square cells, having sides equal to the
pitches (such cells perfectly tile the symbol). Its value typically is on the order of unity. The PrintGrowth
is derived from the MeasuredPrintGrowth by means of the three normalization parameters.
MatrixCodeReader::TimeOut property
UINT32. Gets or sets a timeout for the Learn, LearnMore and Read methods. If the processing time
of one of these functions becomes longer than the set timeout, the processing is stopped and an
exception is thrown. In that case, the error code of the exception is E_ERROR_TIMEOUT_REACHED.
The timeout is set in microseconds.
Remarks
This timeout is not a real timeout. The processing is stopped as soon as possible after the timeout has
been reached. This means that the time elapsed effectively in the method can be greater than the
timeout in itself.
476
3.4.2.1
Methods
Operations
MatrixCodeReader::Reset
void MatrixCodeReader::Reset();
Resets the parameter search space to its default: the full range of all parameters.
Remarks
This does not modify the learning mask.
MatrixCodeReader::Read
MatrixCode MatrixCodeReader::Read(const EROIBW8& bw8Roi);
Tries to locate, decode and read the Data Matrix code in the given ROI.
The decoding results can be found in the returned MatrixCode object.
Parameters
bw8Roi
Remarks
See the MatrixCode.IsFound property for information about the outcome of the Read process.
MatrixCodeReader::Learn
MatrixCode MatrixCodeReader::Learn(const EROIBW8& bw8Roi);
Tries to locate, decode and read the Data Matrix code in the given ROI.
If successful, it adds the parameters of the Data Matrix code found into the internal learning database.
The decoding results can be found in the returned MatrixCode object.
Parameters
bw8Roi
Remarks
The addition of the parameters of the Data Matrix code found into the internal learning database
means that subsequent Read operations will be faster, but can only be performed on similar Data
Matrix codes/conditions.
Only the parameters that are tagged for learning are remembered for the subsequent Read operations
(see the LearnMask property).
See the MatrixCode.IsFound property for information about the outcome of the Learn process.
MatrixCodeReader::LearnMore
MatrixCode MatrixCodeReader::LearnMore(const EROIBW8& bw8Roi);
Tries to locate, decode and read the Data Matrix code in the given ROI.
If successful, it cumulates the parameters of the Data Matrix code found with those already present in
the internal learning database.
477
Remarks
The cumulation of the parameters of the Data Matrix code found with those already present in the
internal learning database means that subsequent Read operations will be faster, but can only be
performed on similar Data Matrix codes/conditions.
Only the parameters that are tagged for learning are remembered for the subsequent Read operations
(see the LearnMask property).
See the MatrixCode.IsFound property for information about the outcome of the LearnMore process.
Persistent storage
MatrixCodeReader::Load
void MatrixCodeReader::Load(const char* pszPathName);
void MatrixCodeReader::Load(const UNICHAR* pszPathName);
Restores the state of a MatrixCodeReader object from the data stored in the given file by a previous
MatrixCodeReader::Save call. The whole object state, including the learnt pattern and all search
parameters, is restored.
Parameters
pszPathName
full path and name specification of the storage file. Use of file extension
.MXC is recommended though not mandatory.
Remarks
An error code will be set if the data in the file does not represent a well-formed MatrixCodeReader
object.
void MatrixCodeReader::Load(FILE* file);
Restores the state of an MatrixCodeReader object from the data stored in the given file by a previous
MatrixCodeReader::Save call. The whole object state, including the learnt pattern and all search
parameters, is restored. Please note that the data are read at the current file pointer position.
Parameters
file
full path and name specification of the storage file. Use of file extension
.MXC is recommended though not mandatory.
Remarks
This method allows to read several eVision objects from the same file by passing the same FILE
pointer to several Load(FILE* file) calls. Moreover, this file can also contained any kind of
information saved with fwrite (and thus retrieved by a fread call) between the eVision objects.
An error code will be set if the data in the file does not represent a well-formed MatrixCodeReader
object.
The FILE pointer given as argument must have been previously initialized with a proper call to fopen.
It is of a greater importance to note that data are read at the current file pointer position.
It is up to users to correctly manage their files to be able to retrieve their eVision objects. Results
obtained by trying to restore an object of the wrong type are undefined.
478
To circumvent this problem, it is advised to use the ESerializer version of the Load method.
void MatrixCodeReader::Load(ESerializer* serializer);
This method behaves identically to the MatrixCodeReader::Load(FILE* file) method, but accepts a
file-like ESerializer object instead of a regular file.
Parameters
serializer
ESerializer object.
Example
// Create an ESerializer object for reading
ESerializer *pSerializer = ESerializer::CreateFileReader("test.mxc");
// Load the MatrixCodeReader object from the file
m_pMatrixCodeReader.Load( pSerializer);
Remarks
This method allows to read several eVision objects from the same file by passing the same ESerializer
object to several Load(ESerializer* serializer) calls. Moreover, this file can also contained
any kind of information saved with fwrite (and thus retrieved by a fread call) between the eVision
objects.
The ESerializer object given as argument must have been previously created with a call to
ESerializer::CreateFileReader.
The serialization object contains a hidden pointer to the current position in the archive. This pointer
represents the position where the next Load operation will take place. Moreover, each Load operation
also moves the pointer at the end of the just read object (corresponding to the beginning of the next
object or to the end of the file).
It is the user responsibility to use the Load method of the right object. To get information about the
type of the next object in the file, the ESerializer::GetNextObjectType method could be used.
MatrixCodeReader::Save
void MatrixCodeReader::Save(const char* pszPathName);
void MatrixCodeReader::Save(const UNICHAR* pszPathName);
Serializes (saves) the MatrixCodeReader object to the given file. The whole object state, including the
learnt pattern and all search parameters, is stored in the file.
Parameters
pszPathName
full path and name specification of the storage file. Use of file extension
.MXC is recommended though not mandatory.
Serializes (saves) the MatrixCodeReader object to an already opened file, at the current file pointer
position. The whole object state, including the learnt pattern and all search parameters, is stored in the
file. The file pointer is moved by the MatrixCodeReader object size.
Parameters
file
full path and name specification of the storage file. Use of file extension
.MXC is recommended though not mandatory.
479
Remarks
This method allows to store several eVision objects in the same file by passing the same FILE pointer
to several Save(FILE* file) calls. Moreover, this file can also contained any kind of information
saved with fwrite (and thus retrieved by a fread call) between the eVision objects.
The FILE pointer given as argument must have been previously initialized with a proper call to fopen.
Data are saved at the current file pointer position. At the end of the writing, the file pointer is moved by
the MatrixCodeReader object size.
It is the user responsibility to know the exact structure of the used files.
To circumvent this problem, it is advised to use the ESerializer version of the Save method.
void MatrixCodeReader::Save(ESerializer* serializer);
This method behaves identically to the MatrixCodeReader::Save(FILE* file) method, but accepts a
file-like ESerializer object instead of a regular file.
Parameters
serializer
ESerializer object.
Example
// Create an ESerializer object for writing (with the default creation mode)
ESerializer *pSerializer = ESerializer::CreateFileWriter("test.mxc");
// Save the MatrixCodeReader object to the file
m_pMatrixCodeReader.Save( pSerializer);
Remarks
This method allows to store several eVision objects in the same file by passing the same ESerializer
object to several Save(ESerializer* serializer) calls.
The ESerializer object given as argument must have been previously created with a call to
ESerializer::CreateFileWriter.
The serialization object contains a hidden pointer to the current position in the archive. This pointer
represents the position where the next Save operation will take place. Moreover, each Save operation
also moves the pointer at the end of the just written object (the end of the file).
480
4.
ENUMERATION CONSTANTS
4.1
enum LearnParams::Type
4.2
The Data Matrix code symbol logical sizes the candidate is matched
against at read time.
The Data Matrix code contrast types the candidate is matched against
at read time.
The Data Matrix code flipping values the candidate is matched
against at read time.
The Data Matrix code families the candidate is matched against at
read time.
enum LogicalSize::Type
Unknown
4.3
enum Contrast::Type
481
4.4
enum Flipping::Type
4.5
image is flipped.
image is not flipped.
to be determined at Read or Learn time.
enum Family::Type
4.6
enum Handles::Type
482
no handle hit.
upper left corner.
upper right corner.
lower right corner.
lower left corner.
let the Drag member add a new corner instead of moving one.
undefined so far.
5.
SAMPLE PROGRAMS
The available sample program dedicated to the EasyMatrixCode library is the following:
Remarks
The corresponding project for Microsoft Visual C++ can be found in the eVision\MsVc Samples subfolder, while the project for Borland C++ Builder is located in the eVision\BcB Samples sub-folder.
The project for RedHat is in the /usr/local/euresys/eVision/samples/console/MchMatch sub-folder; the
available sample is a console-mode one and it is named MxcRead.
483
1.
EASYBGA: INTRODUCTION
EasyBGA is a 2D BGA inspection package. This means that it allows checking one ore several BGA
devices at a time by means of a top view. The following ball characteristics can be measured and
controlled:
Ball diameters;
Ball positions;
Ball pitches;
Ball circularities.
Diagnostics are reported when any of these quantities fall outside of predefined ranges. The library is also
capable to report per filed of view, per component and per ball statistics on these parameters (minimum
and maximum values, mean and standard deviation).
Declare using
#include "EBGA.h"
485
2.
2.1
EBGA
2.1.1
EBGA Overview
Class EBGA encapsulates a whole BGA component inspection context. It contains all relevant information
and means to perform an inspection task, find balls, measure them, diagnose defects, display results,
compute statistics, as well as edit the component model.
The EBGA context is a complex object that manages a hierarchy of internal parts, namely a set of BGA
devices (class EBGAComponent), each carrying one or more arrays (class EBGAArray) each holding
identical balls (class EBGABall). Most of the relevant operations are achieved through EBGA members.
On occasion, members of the contained objects are used.
Additionally, the EBGA object is attached to a companion object of class EWorldShape, that handles field
of view calibration.
Declare using
#include "EBGA.h"
2.1.2
2.1.2.1
Construction/Destruction
EBGA Construction
EBGA();
486
Remark
Be aware that you have to call AddArray at least once to get a valid BGA device.
EBGA Destruction
~EBGA();
2.1.2.2
Measurement units
EBGA::Get/Set Unit
enum E_MEASUREMENT_UNITS GetUnit();
2.1.2.3
Inspection
EBGA::Inspect
void Inspect(EROIBW8* pSrcImage);
Performs full component(s) inspection on the given image. After inspection, any defect found
(parameter out of tolerance) generates global diagnostics (see section Global Diagnostics), the faulty
balls are highlighted, and individual ball diagnostics can be obtained (using GetBall and further inquiry
members). Additionally, per component/per field of view/per ball statistics are computed for the
measured features.
Parameters
pSrcImage
Tolerances
EBGA::Get/Set BallDiameterTolerance
FLOAT32 GetBallDiameterTolerance();
487
Parameters
f32Tolerance
EBGA::Get/Set BallCircularityTolerance
The circularity indicator takes values in range 0..1. The closer to one, the more circular.
FLOAT32 GetBallCircularityTolerance();
Returns the allowed tolerance on the ball center position. The ball positions are relative to a reference
frame originating at the gravity center of the set of balls (when the device is symetrical, this coincides
with the package center).
EBGA::SetBallOffsetTolerance
void SetBallOffsetTolerance(FLOAT32 f32XTolerance, FLOAT32 f32YTolerance = 0);
Sets the allowed tolerance on the ball center position. The ball positions are related to a reference
frame originating at the gravity center of the set of balls (when the device is symetrical, this coincides
with the package center).
Parameters
f32XTolerance
f32YTolerance
Returns the allowed tolerance on the ball pitches. The pitches are defined as the shortest horizontal or
vertical center to center distance to the nearest neighbor in the same array.
488
EBGA::SetBallPitchTolerance
void SetBallPitchTolerance(FLOAT32 f32XTolerance, FLOAT32 f32YTolerance = 0);
Sets the allowed tolerance on the ball pitches. The pitches are defined as the shortest horizontal or
vertical center to center distance to the nearest neighbor in the same array.
Parameters
f32XTolerance
f32YTolerance
EBGA::Get/Set BallDoughnutnessTolerance
FLOAT32 GetBallDoughnutnessTolerance();
Returns the doughnutness value under which an object is considered an empty pad rather than a ball.
void SetBallDoughnutnessTolerance(FLOAT32 f32MinDoughnutness= 0.1f);
Changes the doughnutness value under which an object is considered an empty pad rather than a ball.
By default (parameter omitted), an object is never considered an empty pad. Suitable values typically
range from 0.03 to 0.15.
Parameters
f32MinDoughnutness
Remarks
The "doughnutness" coefficient is an empirical parameter meant to help discriminate between solder
balls and empty pads. A solder ball normally looks like a doughnut because of the curvature of its
apex, while an empty pad is seen as a disk. The doughnutness is a measure that quantifies the
amount of black visible in the center. Typical values are larger than 10% (0.1) for balls and smaller for
empty pads.
When inspecting a ball, if the measured value of the doughnutness parameter does not reach a
specified minimum, the object is treated as a missing ball. To select an appropriate value for the
minimum doughnutness, a recommended approach is to inspect a device with MinimumDoughnutness
set to 0 and observe the values of the MeasuredDoughnutness for every ball, and possibly for empty
pads. (Also see Outer/Inner RoiDiameter and EBGABall::GetMeasuredDoughnutness).
Important note. When using this feature, make sure that the value of InnerRoiDiameter is set smaller
than the diameter of the inner black spot at the center of the balls. Otherwise, the doughnutness
parameter becomes meaningless. End of note.
EBGA::Get/Set BallQualityFactorTolerance
FLOAT32 GetBallQualityFactorTolerance();
Returns the gray level quality factor tolerance under which an object is not considered as a valid ball.
void SetBallQualityFactorTolerance(FLOAT32 f32BallQualityFactorTolerance= 0.1f);
Changes the gray level quality factor tolerance under which an object is not considered as a valid ball.
By default (parameter omitted), an object is always considered as a valid ball. Suitable values typically
range from 0.10 to 0.20.
489
Parameters
f32BallQualityFactorTolerance
Remarks
The gray level "Quality Factor" parameter is an empirical parameter meant to help find solder balls
which has been oxidized or cut. A solder ball normally looks like a doughnut or a ring; this shape has a
clear radial or circular symmetry. Any variation of the radial symmetry of the gray level value of the ball
pixels comes from ball oxidation or cut-off (non-uniform radial gray level ball profile). If this problem
occurs at the external border of the ball, the circularity parameter will detect the flaw. Inside the ball,
any gray level radial non-uniformity will not modify the external shape and the circularity will not detect
the problem. The "Quality Factor" is aimed at solving this latter case.
The gray level quality factor ranges from 0% (means very poor radial symmetry) to 100% (means
perfect radial symmetry). Typical tolerances are about 10% (0.1) below the maximum value (100% =
1.0). To select an appropriate value for the minimum gray level quality factor, a recommended
approach is to inspect a device with MinimumQualityFactor set to 0% and observe the values of the
MeasuredQualityFactor for every ball. (Also see Outer/Inner RoiDiameter and
EBGABall::GetMeasuredQualityFactor.
Important note. When using this feature, make sure that the value of InnerRoiDiameter is set smaller
than the diameter of the inner black spot at the center of the balls. Otherwise, the gray level quality
factor parameter becomes meaningless. End of note.
Inspection modes
EBGA::Get/Set WhiteOnBlack
BOOL GetWhiteOnBlack();
EBGA::Get/Set BlobThreshold
UINT32 GetBlobThreshold();
Returns the threshold mode or value used at the blob segmentation level.
void SetBlobThreshold(UINT32 un32Threshold= IMG_MIN_RESIDUE_THRESHOLD);
Sets the threshold mode to use at blob segmentation level, as defined by enum
IMG_THRESHOLD_MODES. In the case of absolute thresholding, the threshold value is given
instead. By default (if no threshold value/mode is specified), the minimum residue mode is used to
determine the threshold value.
Parameters
un32Threshold
490
EBGA::Get/Set MaxBlobArea
UINT32 GetMaxBlobArea ();
Returns the maximum allowed area of the blobs at the segmentation level (in pixels).
void SetMaxBlobArea (UINT32 un32MaxArea= UINT32_UNDEFINED);
Sets the maximum tolerated area of the blobs at the segmentation level (in pixels). By default, the
maximum area is computed automatically by EasyBGA, using the calibration information as well as the
nominal ball size.
Parameters
un32MaxArea
EBGA::Get/Set MinBlobArea
UINT32 GetMinBlobArea ();
Returns the minimum allowed area of the blobs at the segmentation level (in pixels).
void SetMinBlobArea (UINT32 un32MinArea= UINT32_UNDEFINED);
Sets the minimum tolerated area of the blobs at the segmentation level (in pixels). By default, the
minimum area is computed automatically by EasyBGA, using the calibration information as well as the
nominal ball size.
Parameters
un32MinArea
EBGA::Get/Set SingulatedComponents
When several components are visible at a time, it makes a difference to know if they are singulated
(sawed apart) or still part of a common substrate (BGA strip). This information impacts the way ball
location is performed and offsets are computed (pitches will not be influenced), given that singulated
components can move with respect to each other. By default, the components are assumed not to be
singulated.
BOOL GetSingulatedComponents();
EBGA::Get/Set MaxMissingBalls
UINT32 GetMaxMissingBalls();
491
Sets the maximum number of missing balls to be allowed. When the number of balls not found falls
below this threshold, inspection is canceled. This mechanism is mainly used to avoid meaningless
inspection results when the component is at a wrong place in the field of view, or simply missing.
Parameters
un32Ball
EBGA::Get/Set OuterRoiDiameter
FLOAT32 GetOuterRoiDiameter();
Returns the relative diameter (related to the nominal diameter) used to delimit the outer edge of the
annular ROI used for ball measurement.
void SetOuterRoiDiameter(FLOAT32 f32OuterRoiDiameter);
Sets the relative diameter (related to the nominal diameter) used to delimit the outer edge of the
annular ROI used for ball measurement. By default, the inspected area is extended outwards by 100%
of the nominal diameter (relative coefficient 2). Suitable values typically range from 1.3 to 2.0.
Parameters
f32OuterRoiDiameter
Remark
When measuring balls, processing is done in a tight region of interest around them. This region has an
annular shape, i.e. the space between two concentric circles. The size of this ROI can be adjusted in
proportion to the nominal diameter.
EBGA::Get/Set InnerRoiDiameter
FLOAT32 GetInnerRoiDiameter();
Returns the relative diameter (related to the nominal diameter) used to delimit the inner edge of the
annular ROI used for ball measurement.
void SetInnerRoiDiameter(FLOAT32 f32OuterRoiDiameter);
Sets the relative diameter (related to the nominal diameter) used to delimit the outer edge of the
annular ROI used for ball measurement. By default, the inspected area is extended inwards by 70% of
the nominal diameter (relative coefficient 0.3). Suitable values typically range from 0.1 to 0.7.
Parameters
f32InnrRoiDiameter
Remark
When measuring balls, processing is done in a tight region of interest around them. This region has an
annular shape, i.e. the space between two concentric circles. The size of this ROI can be adjusted in
proportion to the nominal diameter.
EBGA::Get/SetPackCloseBlobs
BOOL GetPackCloseBlobs () const;
Remarks
When creating a new EBGA object, the first method (close blobs merging) is automatically used.
When loading an old BGA model file, the second method (only connected blobs) is used.
EBGA::Get/Set MeasureAssessment
enum BGA_MEASURE_ASSESSMENT GetMeasureAssessment();
Basic: Basic measurement; this mode is now obsolete but is kept for backward compatibility
purpose. It corresponds to the old FineBallMeasure parameter set to FALSE.
Fine: Refined measurement; useful when limited clutter is present near balls. It corresponds to
the old FineBallMeasure parameter set to TRUE.
Robust: Robust measurement; this mode will be able to correctly discriminate balls from their
close environment (clutter, pad) and to provide more accurate measurements and diagnostics.
Parameters
eMeasureAssessment
Remarks
When creating a new EBGA object, the new robust method is automatically used.
When loading an old BGA model file, former methods are used.
Caution:
Old methods EBGA::Get/Set FineBallMeasure are considered obsolete and should not be used
anymore.
Old Basic mode is also considered obsolete and should not be used anymore.
The doughnutness and gray level quality factor parameter are not yet available in the new
robust mode.
Fine and robust mode do not work the same way and it may be necessary to set the circularity
tolerance to a different value.
493
EBGA::Get/Set CircularityAssessment
enum BGA_CIRCULARITY_ASSESSMENT GetCircularityAssessment();
Basic: Basic circularity measurement. It corresponds to the old FineCircularity parameter set to
FALSE.
Fine: Refined circularity measurement. It corresponds to the old FineCircularity parameter set to
TRUE. This mode is only available when Fine MeasureAssessment mode is selected.
Parameters
eCircularityAssessment
Remarks
When creating a new EBGA object, the Basic method is automatically used.
When loading an old BGA model file, former methods are used.
Caution:
Old methods EBGA::Get/Set FineCircularity are considered obsolete and should not be used
anymore.
For Basic and Robust MeasureAssessment mode, the Fine CircularityAssessment mode is
not available. So, in these MeasureAssessment modes, CircularityAssessment mode has no
effects.
EBGA::Get/Set FineBallMeasure
These methods are obsolete and should not be used anymore. Use EBGA::Get/Set MeasureAssessment
methods instead.
BOOL GetFineBallMeasure();
Remarks
When creating a new EBGA object, the new improved method is automatically used.
When loading an old BGA model file, the former method is used.
Caution: The old method is considered obsolete and should not be used anymore.
494
EBGA::Get/Set FineCircularity
These methods are obsolete and should not be used anymore. Use EBGA::Get/Set
CircularityAssessment methods instead.
BOOL GetFineCircularity();
Remarks
When creating a new EBGA object, the improved method is automatically used.
When loading an old BGA model file, the former method is used.
Caution: The old method is considered obsolete and should not be used anymore.
2.1.2.4
Quality Indicators
EBGA::GetSetEnabledQualityDiagnostics
UINT32 GetEnabledQualityDiagnostics();
Returns the set of quality indicators for which diagnostics should be issued as a combination of values
from enum BGA_QUALITY_INDICATORS.
void SetEnabledQualityDiagnostics(UINT32 un32Indicators);
Sets the set of quality indicators for which diagnostics should be issued by a combination of values
from enum BGA_QUALITY_INDICATORS.
By default, all the quality indicators are enabled.
Parameters
un32Indicators
Remark
When doing a BGA inspection, one of four parameters are measures: diameter, circularity, pitch and
offset. Diagnostics are generated when a parameter falls outside the allowed range (nominal value +/tolerance). Statistics (range, average and deviation) are also computed per field of view and per
component on a single image, and per ball across several images corresponding to a batch of
components.
EasyBGA allows enabling/disabling range checking and statistics computations for each quality
indicator separately.
495
EBGA::GetSetEnabledQualityStatistics
UINT32 GetEnabledQualityStatistics();
Returns the set of quality indicators for which statistics should be computed as a combination of values
from enum BGA_QUALITY_INDICATORS.
void SetEnabledQualityStatistics(UINT32 un32Indicators);
Sets the set of quality indicators for which statistics should be computed by a combination of values
from enum BGA_QUALITY_INDICATORS.
By default, all the quality indicators are enabled and batch statistics are disabled.
Parameters
un32Indicators
Remark
When doing a BGA inspection, one of four parameters are measures: diameter, circularity, pitch and
offset. Diagnostics are generated when a parameter falls outside the allowed range (nominal value +/tolerance). Statistics (range, average and deviation) are also computed per field of view and per
component on a single image, and per ball across several images corresponding to a batch of
components.
EasyBGA allows enabling/disabling range checking and statistics computations for each quality
indicator separately.
Position
EBGA::GetPackageCenter X/Y
FLOAT32 GetPackageCenterX();
Returns the package center abscissa, in calibrated units, with respect to the origin of the world
coordinate system.
FLOAT32 GetPackageCenterY();
Returns the package center ordinate, in calibrated units, with respect to the origin of the world
coordinate system.
Global Diagnostics
EBGA::GetDiagnostics
UINT32 GetDiagnostics();
Returns a summary of the anomalies found obtained by combining values from enum
BGA_DIAGNOSTICS.
EBGA::GetDiagnostic
BOOL GetDiagnostic(enum BGA_DIAGNOSTICS eDiagnostic);
496
Parameters
eDiagnostic
EBGA::GetNumBallsFound
UINT32 GetNumBallsFound();
Returns the total number of balls expected minus the total number of balls found in the field of view.
EBGA::GetNumClutter
UINT32 GetNumClutter();
Returns the number of "clutter objects" found, i.e. objects having characteristics similar to actual balls
but that do not appear at an expected position. A clutter object may correspond to a displaced ball or
an extraneous artifact.
Beware that extra balls are told from clutter by using the ball diameter and circularity criteria. If
tolerances are loose, clutter may be reported as extra balls.
EBGA::GetNumExtraBalls
UINT32 GetNumExtraBalls();
Returns the number of "extra balls" found, i.e. objects having characteristics similar to actual balls but
that do not appear at an expected position.
Beware that extra balls are told from clutter by using the ball diameter and circularity criteria. If
tolerances are loose, clutter may be reported as extra balls.
EBGA::BadBalls
Euresys::eVision::Utils::Vector<EBGABall*> BadBalls();
Statistics
EBGA::GetMinimumOffset
FLOAT32 GetMinimumOffset();
Returns the smallest ball offset in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
497
EBGA::GetMaximumOffset
FLOAT32 GetMaximumOffset();
Returns the largest ball offset in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetAverageOffset
FLOAT32 GetAverageOffset();
Returns the average ball offset in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetDeviationOffset
FLOAT32 GetDeviationOffset();
Returns the standard deviation of the ball offsets in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetMinimumPitch
FLOAT32 GetMinimumPitch();
Returns the smallest ball pitch in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetMaximumPitch
FLOAT32 GetMaximumPitch();
Returns the largest ball pitch in the last inspected field of view.
498
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetAveragePitch
FLOAT32 GetAveragePitch();
Returns the average ball pitch in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetDeviationPitch
FLOAT32 GetDeviationOffset();
Returns the ball pitch standard deviation in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetMinimumDiameter
FLOAT32 GetMinimumDiameter();
Returns the smallest ball diameter in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetMaximumDiameter
FLOAT32 GetMaximumDiameter();
Returns the largest ball diameter in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
499
EBGA::GetAverageDiameter
FLOAT32 GetAverageDiameter();
Returns the average ball diameter in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetDeviationDiameter
FLOAT32 GetDeviationDiameter();
Returns the standard deviation of all ball diameters in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetMinimumCircularity
FLOAT32 GetMinimumCircularity();
Returns the smallest ball circularity value in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetMaximumCircularity
FLOAT32 GetMaximumCircularity();
Returns the largest ball circularity value in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetAverageCircularity
FLOAT32 GetAverageCircularity();
Returns the average ball circularity value in the last inspected field of view.
500
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetDeviationCircularity
FLOAT32 GetDeviationCircularity();
Returns the standard deviation of all ball circularity values in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetMinimumDoughnutness
FLOAT32 GetMinimumDoughnutness();
Returns the smallest ball doughnutness value in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetMaximumDoughnutness
FLOAT32 GetMaximumDoughnutness ();
Returns the largest ball doughnutness value in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetAverageDoughnutness
FLOAT32 GetAverageDoughnutness();
Returns the average ball doughnutness value in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
501
EBGA::GetDeviationDoughnutness
FLOAT32 GetDeviationDoughnutness();
Returns the standard deviation of all ball doughnutness values in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetMinimumQualityFactor
FLOAT32 GetMinimumQualityFactor();
Returns the smallest ball gray level quality factor value in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetMaximumQualityFactor
FLOAT32 GetMaximumQualityFactor();
Returns the largest ball gray level quality factor value in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetAverageQualityFactor
FLOAT32 GetAverageQualityFactor();
Returns the average ball gray level quality factor value in the last inspected field of view.
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::GetDeviationQualityFactor
FLOAT32 GetDeviationQualityFactor();
Returns the standard deviation of all ball gray level quality factor values in the last inspected field of
view.
502
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
EBGA::ClearBatchStatistics
void ClearBatchStatistics(BOOL bEnable= TRUE);
Remarks
Statistics function reports descriptive estimators related to the distribution of a given feature (ball
diameter, offset, pitch) as measured on the whole field of view. Four estimators are provided: minimum
and maximum correspond to the extreme values found; average and standard deviation are the
classical estimators of the central trend and dispersion.
Drawing
EBGA::DrawPackages
void DrawPackages(HDC hDC);
EBGA::DrawClutter
void DrawClutter(HDC hDC);
EBGA::DrawExtraBalls
void DrawExtraBalls(HDC hDC);
503
2.1.2.5
Model Edition
EBGA::GetNumBalls
UINT32 GetNumBalls();
Returns the total number of balls expected per field of view (i.e. the number of balls per components
times the number of components).
EBGA::GetComponentNumBalls
UINT32 GetComponentNumBalls();
Returns the total number of balls expected per component (rather than in the whole field of view).
EBGA::ArrangeDaughters
void ArrangeDaughters();
Persistent storage
EBGA::Load
void Load(const CHAR* pszPathName, BOOL bRecurse= TRUE);
EBGA::Save
void Save(const CHAR* pszPathName, BOOL bRecurse= TRUE);
Drawing
EBGA::Draw
void Draw(HDC hDC, enum INS_DRAWING_MODES eDrawingMode= INS_NOMINAL, BOOL bRecurse=
TRUE);
Draws the inspected components. See EnableBehaviorFilter function to draw separately correct and
faulty inspected balls (in different colors, for instance).
504
Parameters
hDC
eDrawingMode
bRecurse
EBGA::DrawArrayLabels
void DrawArrayLabels(HDC hDC);
EBGA::EnableBehaviorFilter
void EnableBehaviorFilter(enum INS_SHAPE_BEHAVIOR eBehavior, BOOL bValue=TRUE);
Applies a filter to specify which balls must be displayed by the Draw function.
Calling the Draw function after a call to EnableBehaviorFilter(INS_PASSED, TRUE) draws the
inspected balls that passed the quality criteria. Otherwise (EnableBehaviorFilter
(INS_PASSED, FALSE)), only the failed balls (missing, too small/large, not cicular, moved) are
drawn.
The filter is cancelled by a call to the DisableBehaviorFilter function.
505
Parameters
eBehaviour
bValue
EBGA::DisableBehaviorFilter
void DisableBehaviorFilter(enum INS_SHAPE_BEHAVIOR eBehavior);
Package
EBGA::GetPackage Width/Height
FLOAT32 GetPackageWidth();
Sets the package dimensions, in calibrated units. By default (if the second argument is not used) the
package is considered to be square.
Parameters
f32PackageWidth
f32PackageHeight
package width.
package height. If not defined, same as width.
EBGA::Get/Set PackageName
The package name is an optional character string that can be associated to the component. The content is
free.
const char* GetPackageName();
506
package name.
Balls
EBGA::Get/Set BallDiameter
FLOAT32 GetBallDiameter();
Returns the nominal ball diameter, in calibrated units. The ball diameter is common to all balls on all
devices.
void SetBallDiameter(FLOAT32 f32Diameter);
Sets the nominal ball diameter, in calibrated units. The ball diameter is common to all balls on all
devices.
Parameters
f32Diameter
EBGA::GetBall
EBGABall* GetBall(UINT32 un32ColIndex, UINT32 un32RowIndex);
Returns a pointer to the ball on the current array of the current component, at given indices (regular
array only).
Parameters
un32ColIndex
un32RowIndex
Array Edition
EBGA::GetNumArrays
UINT32 GetNumArrays();
Returns the number of arrays of the components. Most of the time, a single array suffices.
EBGA::Get/Set CurrentArray
UINT32 GetCurrentArray();
EBGA::GetArray
EBGAArray* GetArray();
507
EBGA::AddArray
void AddArray(FLOAT32 f32ArrayWidth= 11.43f, FLOAT32 f32ArrayHeight= 0, UINT32
un32NumCols= 10, UINT32 un32NumRows= 0, FLOAT32 f32CenterX= 0, FLOAT32 f32CenterY=
0, BOOL bStaggered= FALSE);
Creates a new array of balls of given logical, physical size, center coordinates and arrangement, and
adds it to the current component. By default, a rectangular array of standard size, centered on the
package is created.
Parameters
f32ArrayWidth
f32ArrayHeight
un32NumCols
un32NumRows
f32Center X/Y
bStaggered
EBGA::RemoveArray
void RemoveArray();
Removes the current array from the current component. The last array of the array list becomes the
new current array.
EBGA::GetArrayNumBalls
UINT32 GetArrayNumBalls();
Array Placement
EBGA::GetArrayNum Cols/Rows
UINT32 GetArrayNumCols();
Sets the current array column and row counts, as well as the ball arrangement (rectangular, by default,
or staggered). This operation refills all grid nodes with balls.
508
Parameters
un32NumCols
un32NumRows
bStaggered
EBGA::GetArraySize X/Y
FLOAT32 GetArraySizeX();
Returns the current array horizontal size, in calibrated units. The size is measured between the ball
centers of the extreme columns.
FLOAT32 GetArraySizeY();
Returns the current array vertical size, in calibrated units. The size is measured between the ball
centers of the extreme rows.
EBGA::SetArrayPhysicalSize
void SetArrayPhysicalSize(FLOAT32 f32Witdth= 11.43f, FLOAT32 f32Height= 0);
Sets the current array dimensions, in calibrated units. The size is measured between the ball centers of
the extreme columns and rows. By default (if the Y size is not specified), the array is square.
Parameters
f32Width
f32Height
EBGA::GetArrayPitch X/Y
FLOAT32 GetArrayPitchX();
Returns the current array horizontal pitch, in calibrated units. The pitch is measured between the ball
centers of the neighboring columns.
FLOAT32 GetArrayPitchY();
Returns the current array vertical pitch, in calibrated units. The pitch is measured between the ball
centers of the neighboring rows.
EBGA::SetArrayPitches
void SetArrayPitches(FLOAT32 f32PitchX= 1.27f, FLOAT32 f32PitchY= 0);
Sets the current array pitches, in calibrated units. The pitch is measured between the ball centers of
the neighboring columns and rows. By default (if the Y pitch is not specified), the Y pitch takes the
same value as the X pitch.
Parameters
f32PitchX
f32PitchY
509
EBGA::GetArrayCenter X/Y
FLOAT32 GetArrayCenterX();
Sets the current array center coordinates, in calibrated units. By default, the array is centered on the
component package.
Parameters
f32CenterX
f32CenterY
Sets the current symmetry mode, as defined by enum BGA_SYMMETRY. This mode is used when
adding to/removing balls from an array.
Parameters
eSymmetry
EBGA::ToggleBall
void ToggleBall(UINT32 un32Col, UINT32 un32Row);
Adds or removes the ball of given indices from the current array of the current component. (If a ball is
present, it is removed; otherwise it is added). The current symmetry mode is enforced, so that the
function operates symmetrically.
Parameters
un32Col
un32Row
column index
row index
EBGA::ToggleBalls
void ToggleBalls(INT32 n32OrgX, INT32 n32OrgY, INT32 n32EndX, INT32 n32EndY);
Adds or removes the balls inside the given bounding box from the current array of the current
component. (If a ball is present, it is removed; otherwise it is added). The current symmetry mode is
enforced, so that the function operates symmetrically. This function is intended to be used with in
combination with a dragging rectangle.
510
Parameters
n32OrgX
n32OrgY
n32EndX
n32EndY
Number of components
EBGA::GetNumComponents
UINT32 GetNumComponents();
Sets the number of components in the field of view, using a regular arrangement of NumCols columns
and NumRows rows, enforcing regular component placement.
Parameters
un32NumCols
un32NumRows
number of columns
number of rows
EBGA::SetCurrentComponent
void SetCurrentComponent(UINT32 un32ColIndex, UINT32 un32RowIndex);
Sets the current component indices, between 0 and NumCols-1 and 0 and NumRows-1, assuming
regular component placement.
Parameters
un32ColIndex
un32RowIndex
column index.
row index.
EBGA::GetComponent
EBGAComponent* GetComponent();
Returns the horizontal pitch between components of a regular arrangement. Horizontal pitch is defined
as the shortest horizontal distance between two neighboring component centers.
511
Returns the vertical pitch between components of a regular arrangement. Vertical pitch is defined as
the shortest vertical distance between two neighboring component centers.
EBGA::SetComponentPitches
void SetComponentPitches(FLOAT32 f32PitchX, FLOAT32 f32PitchY= 0);
Sets the pitch between components of a regular arrangement. Pitches are defined as the shortest
horizontal and vertical distances between two neighboring component centers. By default, the Y pitch
gets the same value as the X pitch.
Parameters
f32PitchX
f32PitchY
EBGA::GetRegularPlacement
BOOL GetRegularPlacement();
Returns TRUE if the components are placed in a matrix-like arrangement (regular placement). A FALSE
value indicates an irregular component placement.
Sets the number of components in the field of view, using an arbitrary arrangement of Num
components, enforcing irregular component placement. When the number of components is
changed, all of them are set to the same position, thus overlapping.
Parameters
un32Num
number of components
EBGA::SetCurrentComponent
void SetCurrentComponent(UINT32 un32Index);
Sets the current component indice, between 0 and NumComponents-1, assuming irregular
component placement.
Parameters
un32Index
EBGA::GetCurrentComponent
UNIT32 GetCurrentComponent();
512
EBGA::SetComponentCenter
void SetComponentCenter(FLOAT32 f32CenterX, FLOAT32 f32CenterY);
Sets the center coordinates of the current component, in calibrated units, with respect to a common
origin, assuming irregular component placement.
Parameters
f32CenterX
f32CenterY
2.1.2.6
Auto-calibration
EBGA::Get/Set AutoCalibrateBalls
BOOL GetAutoCalibrateBalls();
When set to TRUE, the next inspection operation (Inspect) will adjust the
diameter correction parameters of the balls.
Remarks
Caution: after inspection, the Auto Calibrate flag is reset to the FALSE state to avoid unwanted
recalibration at the next inspections. Recalibrating at each inspection is not recommended.
Auto-calibration is the process by which EasyBGA is capable to derive calibration information from the
BGA image itself. Calibration takes place at two levels:
Field of view calibration: the pixel size and other calibration parameters can be adjusted as
described in the User's Guide chapter on Calibration. These relate to the whole filed of view.
The field of view calibration is handled by the EWorldShape class.
Balls calibration: even after the field of view has been calibrated, the ball diameter
measurement may require additional calibration. What is measured is the apparent ball
diameter, i.e. the diameter of the part of the balls reflecting some light. This may differ from
the actual ball diameter. Ball calibration determines an appropriate calibration factor for ball
diameter measurement (the other measured parameters need no further calibration).
EBGA::Get/Set AutoCalibrateWorld
BOOL GetAutoCalibrateWorld();
513
Parameters
bAutoCalibrate
When set to TRUE, the next inspection operation (Inspect) will adjust the
calibration parameters of the EWorldShape to which the BGA object is
attached.
Remarks
Caution: after inspection, the Auto Calibrate flag is reset to the FALSE state to avoid unwanted
recalibration at the next inspections. Recalibrating at each inspection is not recommended.
Auto-calibration is the process by which EasyBGA is capable to derive calibration information from the
BGA image itself. Calibration takes place at two levels:
2.2
Field of view calibration: the pixel size and other calibration parameters can be adjusted as
described in the User's Guide chapter on Calibration. These relate to the whole filed of view.
The field of view calibration is handled by the EWorldShape class.
Balls calibration: even after the field of view has been calibrated, the ball diameter
measurement may require additional calibration. What is measured is the apparent ball
diameter, i.e. the diameter of the part of the balls reflecting some light. This may differ from
the actual ball diameter. Ball calibration determines an appropriate calibration factor for ball
diameter measurement (the other measured parameters need no further calibration).
EBGABall
2.2.1
EBGABall Overview
An EBGABall object is used to represent each solder ball on a component. These objects are storing the
measured parameters after an inspection (individual diameters, circularities...) as well as statistics
accumulated per batch. To get access to a given ball (of the current array of the current component),
member EBGA::GetBall returns a pointer to an EBGABall object, or NULL if the ball at given indices does
not exist.
2.2.2
2.2.2.1
Diagnostics
EBGABall::GetDiagnostics
UINT32 GetDiagnostics();
Returns a summary of the anomalies found, obtained by combining values from enum
BGA_DIAGNOSTICS.
EBGABall::GetDiagnostic
BOOL GetDiagnostic(enum BGA_DIAGNOSTICS eDiagnostic);
514
Parameters
eDiagnostic
2.2.2.2
Ball Measurement
EBGABall::GetMeasuredOffset X/Y
FLOAT32 GetMeasuredOffsetX();
Returns the distance between the current ball and its closest horizontal neighbor, in calibrated units.
FLOAT32 GetMeasuredPitchY();
Returns the distance between the current ball and its closest vertical neighbor, in calibrated units.
Remark
Field of view calibration is managed by the EWorldShape class. Such an object is able to represent the
relationship between World (physical units) and Sensor (pixels) coordinates and account for the
distortions inherent in the image formation process.
EBGABall::GetMeasuredCircularity
FLOAT32 GetMeasuredCircularity();
Returns the circularity value of the current ball, as a value in range [0,1] (1 = perfect circle).
515
EBGABall::GetMeasuredDoughnutness
FLOAT32 GetMeasuredDoughnutness();
Returns the value of the "doughnutness" parameter measured on the current ball.
Remark
The "doughnutness" parameter is used to allow distinguishing between solder balls and empty pads,
by measuring the black spot in the center. (
EBGABall::GetMeasuredQualityFactor
FLOAT32 GetMeasuredQualityFactor();
Returns the value of the gray level Quality Factor parameter measured on the current ball.
Remarks
The gray level Quality Factor parameter is used to allow distinguishing ball with non-uniform gray
level radial profile or too low contrast. (
2.2.2.3
Statistics
EBGABall::GetNumBatchSamples
UINT32 GetNumBatchSamples();
Returns the number of images processed for the ball so far in the current batch (since the last time
ClearBatchStatistics has been called).
EBGABall::GetMinimumOffset
FLOAT32 GetMinimumOffset();
Returns the minimum ball offset for a given ball across all images in the batch (use EBGA::GetBall() to
select the ball).
EBGABall::GetMaximumOffset
FLOAT32 GetMaximumOffset();
Returns the maximum ball offset for a given ball across all images in the batch (use EBGA::GetBall() to
select the ball).
EBGABall::GetAverageOffset
FLOAT32 GetAverageOffset();
Returns the average ball offset for a given ball across all images in the batch (use EBGA::GetBall() to
select the ball).
EBGABall::GetDeviationOffset
FLOAT32 GetDeviationOffset();
Returns the standard deviation of the ball offset for a given ball across all images in the batch (use
EBGA::GetBall() to select the ball).
516
EBGABall::GetMinimumPitch
FLOAT32 GetMinimumPitch();
Returns the minimum pitch between a given ball and its closest neighbor across all images in the batch
(use EBGA::GetBall() to select the ball).
EBGABall::GetMaximumPitch
FLOAT32 GetMaximumPitch();
Returns the maximum pitch between a given ball and its closest neighbor across all images in the
batch (use EBGA::GetBall() to select the ball).
EBGABall::GetAveragePitch
FLOAT32 GetAveragePitch();
Returns the average pitch between a given ball and its closest neighbor across all images in the batch
(use EBGA::GetBall() to select the ball).
EBGABall::GetDeviationPitch
FLOAT32 GetDeviationOffset();
Returns the standard deviation of the pitch between a given ball and its closest neighbor across all
images in the batch (use EBGA::GetBall() to select the ball).
EBGABall::GetMinimumDiameter
FLOAT32 GetMinimumDiameter();
Returns the minimum diameter of a given ball across all images in the batch (use EBGA::GetBall() to
select the ball).
EBGABall::GetMaximumDiameter
FLOAT32 GetMaximumDiameter();
Returns the maximum diameter of a given ball across all images in the batch (use EBGA::GetBall() to
select the ball).
EBGABall::GetAverageDiameter
FLOAT32 GetAverageDiameter();
Returns the average diameter of a given ball across all images in the batch (use EBGA::GetBall to
select the ball).
EBGABall::GetDeviationDiameter
FLOAT32 GetDeviationDiameter();
Returns the standard deviation of a given ball diameter across all images in the batch (use
EBGA::GetBall() to select the ball).
517
EBGABall::GetMinimumCircularity
FLOAT32 GetMinimumCircularity();
Returns the minimum circularity value of a given ball across all images in the batch (use
EBGA::GetBall() to select the ball).
EBGABall::GetMaximumCircularity
FLOAT32 GetMaximumCircularity();
Returns the maximum circularity value of a given ball across all images in the batch (use
EBGA::GetBall() to select the ball).
EBGABall::GetAverageCircularity
FLOAT32 GetAverageCircularity();
Returns the average circularity value of a given ball across all images in the batch (use EBGA::GetBall
to select the ball).
EBGABall::GetDeviationCircularity
FLOAT32 GetDeviationCircularity();
Returns the standard deviation of the circularity value of a given ball across all images in the batch
(use EBGA::GetBall() to select the ball).
EBGABall::GetMinimumDoughnutness
FLOAT32 GetMinimumDoughnutness();
Returns the minimum doughnutness value of a given ball across all images in the batch (use
EBGA::GetBall() to select the ball).
EBGABall::GetMaximumDoughnutness
FLOAT32 GetMaximumDoughnutness ();
Returns the maximum doughnutness value of a given ball across all images in the batch (use
EBGA::GetBall() to select the ball).
EBGABall::GetAverageDoughnutness
FLOAT32 GetAverageDoughnutness();
Returns the average doughnutness value of a given ball across all images in the batch (use
EBGA::GetBall to select the ball).
EBGABall::GetDeviationDoughnutness
FLOAT32 GetDeviationDoughnutness ();
Returns the standard deviation of the doughnutness value of a given ball across all images in the batch
(use EBGA::GetBall to select the ball).
518
EBGABall::GetMinimumQualityFactor
FLOAT32 GetMinimumQualityFactor();
Returns the minimum gray level quality factor value of a given ball across all images in the batch (use
EBGA::GetBall to select the ball).
EBGABall::GetMaximumQualityFactor
FLOAT32 GetMaximumQualityFactor();
Returns the maximum gray level quality factor value of a given ball across all images in the batch (use
EBGA::GetBall to select the ball).
EBGABall::GetAverageQualityFactor
FLOAT32 GetAverageQualityFactor();
Returns the average gray level quality factor value of a given ball across all images in the batch (use
EBGA::GetBall to select the ball).
EBGABall::GetDeviationQualityFactor
FLOAT32 GetDeviationQualityFactor();
Returns the standard deviation of the gray level quality factor value of a given ball across all images in
the batch (use EBGA::GetBall to select the ball).
2.2.2.4
Position
EBGABall::GetComponent
EBGAComponent* EBGABall::GetComponent();
519
EBGABall::GetBallRowIndex
UINT32 EBGABall::GetBallRowIndex();
Balls are always located on a rectangular grid. Thus, each ball may be uniquely referenced by the row
and the column index in its array.
This method returns the index of the row in which the ball is.
EBGABall::GetBallColIndex
UINT32 EBGABall::GetBallColIndex();
Balls are always located on a rectangular grid. Thus, each ball may be uniquely referenced by the row
and the column index in its array.
This method returns the index of the column in which the ball is.
2.3
EBGAArray
2.3.1
EBGAArray Overview
An EBGAArray object is used to represent each solder ball array of the BGA device.
To get access to a given component in the field of view, member EBGA::SetCurrentArray allows pointing
at the desired indices, and member EBGA::GetArray returns a pointer to the suitable EBGAArray object
2.3.2
2.3.2.1
Geometry
Get/Set Staggered
BOOL GetStaggered();
Returns a Boolean indicating whether the ball placement is staggered (TRUE) or not (FALSE, default
value).
void SetStaggered(BOOL bStaggered);
Defines the ball placement. By default (FALSE) the ball placement is square, not staggered.
Parameters
bStaggered
520
2.3.2.2
Array label
Get/Set InverseRowNumbering
BOOL GetInverseRowNumbering();
Returns a Boolean indicating whether the row numbering is inverted (TRUE) or not (FALSE, default
value).
void SetInverseRowNumbering(BOOL bInverseRowNumbering);
Defines the row numbering order. By default (FALSE) the row numbering is not inverted.
Parameters
bInverseRowNumbering
Remark
To display the array label, use EBGA::DrawArrayLabels.
521
Get/Set InverseColNumbering
BOOL GetInverseColNumbering();
Returns a Boolean indicating whether the column numbering is inverted (TRUE) or not (FALSE, default
value).
void SetInverseColNumbering(BOOL bInverseColNumbering);
Defines the column numbering order. By default (FALSE) the column numbering is not inverted.
Parameters
bInverseColNumbering
Remark
To display the array label, use EBGA::DrawArrayLabels.
2.4
2.4.1
EBGAComponent
EBGAComponent Overview
An EBGAComponent object is used to represent a whole BGA device, including package and ball arrays.
These objects are storing accumulated statistics on the measured parameters after an inspection
(average diameters...) and per component diagnostics.
To get access to a given component in the field of view, member EBGA::SetCurrentComponent allows
pointing at the desired indices, and member EBGA::GetComponent returns a pointer to the suitable
EBGAComponent object.
522
2.4.2
2.4.2.1
Component model
EBGAComponent::GetNumBalls
UINT32 GetNumBalls();
Sets the center coordinates of the component, in calibrated units, with respect to a common origin.
Parameters
f32CenterX
f32CenterY
2.4.2.2
Diagnostics
EBGAComponent::GetNumBallsFound
UINT32 GetNumBallsFound();
Returns the number of balls missing in the component (i.e. the number of balls in the compoent model
minus the number of balls found in the component).
EBGAComponent::GetDiagnostics
UINT32 GetDiagnostics();
Returns a summary of the anomalies found obtained by combining values from enum
BGA_DIAGNOSTICS.
EBGAComponent::GetDiagnostic
BOOL GetDiagnostic(enum BGA_DIAGNOSTICS eDiagnostic);
523
2.4.2.3
Statistics
EBGAComponent::GetMinimumOffset
FLOAT32 GetMinimumOffset();
Returns the standard deviation of the ball offset for the component.
EBGAComponent::GetMinimumPitch
FLOAT32 GetMinimumPitch();
Returns the minimum distance between each ball and its closest neighbor for the component.
EBGAComponent::GetMaximumPitch
FLOAT32 GetMaximumPitch();
Returns the maximum distance between each ball and its closest neighbor for the component.
EBGAComponent::GetAveragePitch
FLOAT32 GetAveragePitch();
Returns the average distance between each ball and its closest neighbor for the component.
EBGAComponent::GetDeviationPitch
FLOAT32 GetDeviationOffset();
Returns the standard deviation of the distance between each ball and its closest neighbor for the
component.
524
EBGAComponent::GetMinimumDiameter
FLOAT32 GetMinimumDiameter();
Returns the standard deviation of the ball diameters for the component.
EBGAComponent::GetMinimumCircularity
FLOAT32 GetMinimumCircularity();
Returns the standard deviation of the circularity value of the component balls.
EBGAComponent::GetMinimumDoughnutness
FLOAT32 GetMinimumDoughnutness();
525
EBGAComponent::GetMaximumDoughnutness
FLOAT32 GetMaximumDoughnutness();
Returns the standard deviation of the doughnutness value of the component balls.
EBGAComponent::GetMinimumQualityFactor
FLOAT32 GetMinimumQualityFactor();
Returns the minimum gray level quality factor value of the component balls.
EBGAComponent::GetMaximumQualityFactor
FLOAT32 GetMaximumQualityFactor();
Returns the maximum gray level quality factor value of the component balls.
EBGAComponent::GetAverageQualityFactor
FLOAT32 GetAverageQualityFactor();
Returns the average gray level quality factor value of the component balls.
EBGAComponent::GetDeviationQualityFactor
FLOAT32 GetDeviationQualityFactor();
Returns the standard deviation of the gray level quality factor value of the component balls.
526
3.
ENUMERATION CONSTANTS
3.1
enum BGA_DIAGNOSTICS
BGA_DIAGNOSTIC_CLUTTER
BGA_DIAGNOSTIC_MISSING_BALL
BGA_DIAGNOSTIC_EXTRA_BALL
BGA_DIAGNOSTIC_BAD_BALL_OFFSET
BGA_DIAGNOSTIC_BAD_BALL_PITCH
BGA_DIAGNOSTIC_BAD_BALL_DIAMETER
BGA_DIAGNOSTIC_BAD_BALL_SHAPE
BGA_DIAGNOSTIC_BAD_BALL_COLOR
BGA_DIAGNOSTIC_BAD_BALL_QUALITY
3.2
enum BGA_QUALITY_INDICATORS
BGA_DIAMETER_QUALITY
BGA_CIRCULARITY_QUALITY
BGA_PITCH_QUALITY
BGA_OFFSET_QUALITY
BGA_DOUGHNUTNESS_QUALITY
BGA_GRAY_LEVEL_QUALITY
BGA_ALL_QUALITIES
BGA_PER_BATCH_QUALITY
3.3
measure diameters.
measure circularities.
measure pitches.
measure offsets.
measure doughnutness.
measure gray level uniformity and quality.
measure all of the above.
measure qualities per batch.
enum BGA_SYMMETRY
BGA_SYMMETRY_NONE
BGA_SYMMETRY_2H
BGA_SYMMETRY_2V
BGA_SYMMETRY_4
BGA_SYMMETRY_8
3.4
no symmetry.
horizontal symmetry (left to right).
vertical symmetry (up-down).
four-ways symmetry (combines horizontal and vertical).
eight-ways symmetry (four-ways plus diagonal symmetry).
enum INS_DRAWING_MODES
Drawing modes
INS_DRAW_NOMINAL
INS_DRAW_ACTUAL
INS_DRAW_TOLERANCE
527
INS_DRAW_SAMPLED_PATHS
INS_DRAW_SAMPLED_PATH
INS_DRAW_SAMPLED_POINTS
INS_DRAW_SAMPLED_POINT
INS_DRAW_POINTS_IN_SKIP_RANGE
INS_DRAW_INVALID_SAMPLED_POINTS
3.5
enum BGA_MEASURE_ASSESSMENT
BGA_BASIC_MEASURE_ASSESSMENT
BGA_FINE_MEASURE_ASSESSMENT
BGA_ROBUST_MEASURE_ASSESSMENT
3.6
enum BGA_CIRCULARITY_ASSESSMENT
BGA_BASIC_CIRCULARITY_ASSESSMENT
BGA_FINE_CIRCULARITY_ASSESSMENT
528
4.
SAMPLE PROGRAMS
The available sample programs dedicated to the EasyBGA library are the following:
BgaInspect: illustrates the BGA inspection process. A BGA model file is first loaded, then a
perfect BGA image is loaded to perform a calibration on component. Finally, images of BGA
to inspect are loaded and processed.
Remarks
The corresponding projects for Microsoft Visual C++ can be found in the eVision\MsVc Samples subfolder, while the projects for Borland C++ Builder are located in the eVision\BcB Samples sub-folder.
529
EWorldShape:
Field of View Calibration
1.
EWORLDSHAPE: OVERVIEW
Manages a field of view calibration context. Such an object is able to represent the relationship between
World (physical units) and Sensor (pixels) coordinates and account for the distortions inherent in the
image formation process.
Calibration can be setup by providing explicit calibration parameters of the calibration model, or by
identifying those parameters by means of a set of known points (landmarks), or by means of a calibration
target.
533
2.
2.1
Calibration
EWorldShape::Calibrate
void EWorldShape::Calibrate(enum INS_CALIBRATION_MODES eCalibration);
Remarks
Landmark calibration is the process of computing the calibration parameters by means of a set of
known points for which the coordinates are available in both World and Sensor spaces. Usually, such
points are chosen as salient features on the part or target in view. They must be such that appropriate
image processing techniques allow measuring their positions from the image (directly or indirectly by
geometric constructions), while at the same time their coordinates in a reference frame are known.
In some cases, not all requested calibration modes are honored. After calibration,
GetCalibrationModes returns the actual combination of modes in effect.
EWorldShape::CalibrationSucceeded
BOOL EWorldShape::CalibrationSucceeded();
Returns TRUE if the calibration has succeeded, that is whether the mean variation of grid points
(distance between computed grid points and ideal grid points in world space) and the maximum
variation of grid points are between given tolerances.
The mean and maximum grid point variations are normalized using the pitch values.
Remarks
By default, tolerances are set to 0.05 (5%) for the mean and 0.1 (10%) for the maximum grid point
variation. You can change these tolerances using the
EWorldShape::SetGridPointsMeanVariationThreshold and
EWorldShape::SetGridPointsMaxVariationThreshold functions.
EWorldShape::AutoCalibrate
UINT32 EWorldShape::AutoCalibrate(BOOL bTestEmpiricalModes = FALSE);
Returns the best calibration modes for the current calibration grid and calibrates the field of view
accordingly.
Parameters
bTestEmpiricalModes
534
EWorldShape::GetGridPointsMeanVariation
FLOAT32 EWorldShape::GetGridPointsMeanVariation();
After a call to CalibrationSucceeded, returns the mean variation of grid points (mean distance
between computed grid points and ideal grid points in world space), normalized using the pitch values.
EWorldShape::GetGridPointsMaxVariation
FLOAT32 EWorldShape::GetGridPointsMaxVariation();
After a call to CalibrationSucceeded, returns the maximum variation of grid points (maximum
distance between computed grid points and ideal grid points in world space), normalized using the
pitch values.
EWorldShape::Get/Set GridPointsMaxVariationThreshold
FLOAT32 EWorldShape::GetGridPointsMaxVariationThreshold();
Sets the grid points maximum variation threshold, the value above which the maximum variation of grid
points (maximum distance between computed grid points and ideal grid points in world space) is
considered too high, and thus marks the calibration as a failure when using
CalibrationSucceeded.
The maximum grid point variation is normalized using the pitch values.
Parameters
f32Value
EWorldShape::Get/Set GridPointsMeanVariationThreshold
FLOAT32 EWorldShape::GetGridPointsMeanVariationThreshold();
Sets the grid points mean variation threshold, the value above which the mean variation of grid points
(mean distance between computed grid points and ideal grid points in world space) is considered too
high, and thus marks the calibration as a failure when using CalibrationSucceeded.
The mean grid point variation is normalized using the pitch values.
Parameters
f32Value
535
2.2
Grid calibration
EWorldShape::AutoCalibrateDotGrid
UINT32 EWorldShape::AutoCalibrateDotGrid(EROIBW8* pSrc, FLOAT32 f32RowPitch, FLOAT32
f32ColPitch, BOOL bTestEmpiricalModes = FALSE);
Remarks
The AutoCalibrateDotgrid method will first do an automatic blob analysis in order to extract all
dots. Their gravity centers are used as the grid reference points. Then, the AutoCalibrateDotgrid
method will select and compute the best calibration mode by reducing the fitting error.
EWorldShape::AddPoint
void EWorldShape::AddPoint(EPoint SensorPoint);
Adds a new point coordinates (in Sensor space) to the set of grid points used for calibration.
Parameters
SensorPoint
Remarks
Grid calibration is the process of computing the calibration parameters by means of a set of points
known to lie on a rectangular grid. If the grid pitch is known and one of the points is chosen as the
origin point, the points can be used as landmarks. By contrast with the landmark calibration functions,
the World coordinates of the grid points need not be specified, nor do they have to be given in any
specific order. The calibration algorithm is capable of sorting out the points to reconstruct the grid
topology.
Typically, this function is used in conjunction with blob analysis to extract the dot centers from a grid of
dots. Anyway, any other scheme can be used.
The grid of points need not be complete, i.e. some of the nodes may be missing, and the points need
not completely fill a rectangular area.
Landmark calibration is simply achieved by providing a series of point coordinates (in Sensor space
only) and then calling the grid reconstruction function followed by the calibration function.
EWorldShape::RebuildGrid
UINT32 EWorldShape::RebuildGrid(FLOAT32 f32ColPitch, FLOAT32 f32RowPitch, UINT32
un32CenterIndex= ~0, EPoint WorldCenter= EPoint(0,0), BOOL bDirect= TRUE);
536
Reconstructs the grid of points from the given dot centers in such a way that the World coordinates of
the points can be computed. This member function also returns the number of grid points that were
connected. This prepares the calibration using landmarks (for use by member Calibrate).
Parameters
f32 Col/Row Pitch
un32CenterIndex
WorldCenter
bDirect
actual pitches of the grid, i.e. distances between vertical and horizontal
rows of the grid.
index of the grid point chosen as coordinate origin point. By default, the
most central grid point is chosen.
World coordinates of the starting grid point.
TRUE if the world reference frame points upwards.
Remarks
Landmark calibration is the process of computing the calibration parameters by means of a set of
known points for which the coordinates are available in both World and Sensor spaces. Usually, such
points are chosen as salient features on the part or target in view. They must be such that appropriate
image processing techniques allow measuring their positions from the image (directly or indirectly by
geometric constructions), while at the same time their coordinates in a reference frame are known.
2.3
Landmark calibration
EWorldShape::EmptyLandmarks
void EWorldShape::EmptyLandmarks();
Adds a new pair of points coordinates (in Sensor and World spaces) to the set of landmarks used for
calibration.
Parameters
SensorPoint
WorldPoint
Remarks
Landmark calibration is the process of computing the calibration parameters by means of a set of
known points for which the coordinates are available in both World and Sensor spaces. Usually, such
points are chosen as salient features on the part or target in view. They must be such that appropriate
image processing techniques allow measuring their positions from the image (directly or indirectly by
geometric constructions), while at the same time their coordinates in a reference frame are known.
537
EWorldShape::AutoCalibrateLandmarks
UINT32 EWorldShape::AutoCalibrateLandmarks(BOOL bTestEmpiricalModes = FALSE);
Returns the best calibration modes for the current landmark set and calibrates the field of view
accordingly.
Parameters
bTestEmpiricalModes
Remarks
Landmark calibration is the process of computing the calibration parameters by means of a set of
known points for which the coordinates are available in both World and Sensor spaces. Usually, such
points are chosen as salient features on the part or target in view. They must be such that appropriate
image processing techniques allow measuring their positions from the image (directly or indirectly by
geometric constructions), while at the same time their coordinates in a reference frame are known.
The AutoCalibrateLandmarks method is meant to be used with landmark calibration only. To
calibrate automatically your field of view using a dot grid, use the AutoCalibrate method instead.
2.4
Explicit calibration
EWorldShape::SetSensor
void EWorldShape::SetSensor(INT32 n32SensorWidth, INT32 n32SensorHeight, FLOAT32
f32FieldWidth= 0, FLOAT32 f32FieldHeight= 0, FLOAT32 f32CenterX= FLOAT32_UNDEFINED,
FLOAT32 f32CenterY= FLOAT32_UNDEFINED, FLOAT32 f32Angle= 0, FLOAT32 f32TiltXAngle=
0, FLOAT32 f32TiltYAngle= 0, FLOAT32 f32PerspectiveStrength= 0, FLOAT32
f32DistortionStrength= 0, FLOAT32 f32OpticalCenterX= FLOAT32_UNDEFINED, FLOAT32
f32OpticalCenterY= FLOAT32_UNDEFINED, UINT32 un32CalibrationModes= 0);
Initializes the calibration object using all given parameters. The function automatically selects the
appropriate calibration model by checking the parameters. The use of a more complex calibration
mode can be enforced by means of parameter CalibrationModes, not a simpler one.
Parameters
n32Sensor Width/Height
f32Field Width/Height
f32Center X/Y
f32Angle
f32Tilt X/Y Angle
f32PerspectiveStrength
f32DistortionStrength
538
f32OpticalCenterX/Y
un32CalibrationModes
2.5
position of the "intersection" between the optical axis and the field of view
in the image. By default (argument omitted) the image center.
desired calibration mode effects to be combined (as defined by enum
INS_CALIBRATION_MODES). By default (argument omitted), the
simplest model compatible with the given parameters is chosen.
Calibration parameters
EWorldShape::SetSensorSize
void EWorldShape::SetSensorSize(INT32 n32Width, INT32 n32Height);
Sets the logical image size, i.e. the number of pixels horizontally and vertically.
Parameters
n32 Width/Height
EWorldShape::GetSensor Width/Height
INT32 EWorldShape::GetSensorWidth();
Returns the logical image width, i.e. the number of pixels horizontally.
INT32 EWorldShape::GetSensorHeight();
Returns the logical image height, i.e. the number of pixels vertically.
EWorldShape::SetFieldSize
void EWorldShape::SetFieldSize(FLOAT32 f32Width, FLOAT32 f32Height =0);
Sets the field of view size in actual units. Field size not matching the sensor size results in non square
pixels. By default, the pixels are square.
539
Remarks
Beware there is a restriction pertaining to the allowed image anisotropy. The resulting pixels aspect
ratio (Xresolution/Yresolution) should be in the range [-4/3, -3/4] (or [3/4, 4/3]), otherwise the calibration
process could fail.
EWorldShape::GetField Width/Height
FLOAT32 EWorldShape::GetFieldWidth();
FLOAT32 EWorldShape::GetFieldHeight();
Returns the field of view size in actual units. Field size not matching the sensor size results in non
square pixels.
Sets the sensor resolution in pixels per unit in both directions. By default, the pixels are square.
Parameters
f32XResolution
f32YResolution
540
EWorldShape::GetScale
FLOAT32 EWorldShape::GetScale();
Returns the X resolution / Y resolution ratio. If this equals 1 (or 1), pixels are square.
Remarks
Beware there is a restriction pertaining to the allowed image anisotropy. The resulting pixels aspect
ratio (Xresolution/Yresolution) should be in the range [-4/3, -3/4] (or [3/4, 4/3]), otherwise the calibration
process could fail.
EWorldShape::SetCenter
void EWorldShape::SetCenter(FLOAT32 f32CenterX, FLOAT32 f32CenterY);
Sets the position of the origin point of the reference frame as projected onto the image, i.e. the Sensor
coordinates of the point at World coordinates (0,0).
Parameters
f32Center X/Y
EWorldShape::GetCenter X/Y
FLOAT32 EWorldShape::GetCenterX();
Returns the horizontal position of the origin point of the reference frame as projected onto the image,
i.e. the Sensor abscissa of the point at World coordinates (0,0).
FLOAT32 EWorldShape::GetCenterY();
Returns the vertical position of the origin point of the reference frame as projected onto the image, i.e.
the Sensor ordinate of the point at World coordinates (0,0).
EWorldShape::SetAngle
void EWorldShape::SetAngle (FLOAT32 f32Angle, BOOL bWorld= TRUE);
Sets the skew angle, i.e. the angle formed by the X [Y] axis of the reference frame and the image
horizontal [vertical] edges.
541
Skew angle
Parameters
f32Angle
bWorld
angle value.
when TRUE, which is the default value, the skew angle is measured in the
World space; otherwise, it is measured in Sensor space, i.e. onto the
image. The difference only appears when pixels are non square.
EWorldShape::GetAngle
FLOAT32 EWorldShape::GetAngle (BOOL bWorld= TRUE);
Returns the skew angle, i.e. the angle formed by the X [Y] axis of the reference frame and the image
horizontal [vertical] edges.
Skew angle
Parameters
bWorld
when TRUE, which is the default value, the skew angle is measured in the
World space; otherwise, it is measured in Sensor space, i.e. onto the
image. The difference only appears when pixels are non square.
EWorldShape::Get/Set CalibrationModes
The supported calibration modes can be one of INS_CALIBRATION_RAW, meaning that no calibration at
all is performed (the World coordinates are pixel indices), or the logical sum of other values from enum
INS_CALIBRATION_MODES.
enum INS_CALIBRATION_MODES EWorldShape::GetCalibrationModes();
542
Returns the current calibration mode, as defined by a combination of values from enum
INS_CALIBRATION_MODES.
void EWorldShape::SetCalibrationModes(enum INS_CALIBRATION_MODES eCalibration);
Sets the current calibration mode, as defined by a combination of values from enum
INS_CALIBRATION_MODES.
Parameters
eCalibration
EWorldShape::SetTiltAngles
void EWorldShape::SetTiltAngles(FLOAT32 f32XAngle, FLOAT32 f32YAngle);
Sets the tilt angles, i.e. the amplitudes of the rotations applied around the X and Y axis of the sensor to
bring the optical (Z) axis perpendicular to the field of view.
543
Returns the tilt angles, i.e. the amplitudes of the rotations applied around the X and Y axis of the
sensor to bring the optical (Z) axis perpendicular to the field of view.
Returns the radial distortion coefficient, i.e. the ratio of the image diagonal length with and without
optical distortion introduced by the lens.
FLOAT32 EWorldShape::GetDistortionStrength2( );
544
Optical distortion strength, i.e. the ratio of the image diagonal length with
and without optical distortion introduced by the lens.
Optical distortion strength of the second order (by default:
f32DistortionStrength2 = 0).
Returns the perspective effect coefficient, i.e. the inverse of the observation distance. The larger this
parameter, the more perceivable the perspective distortion will be. A null value corresponds to a
telecentric lens.
void EWorldShape::SetPerspective (FLOAT32 f32TiltX, FLOAT32 f32TiltY, FLOAT32
f32PerspectiveStrength);
Sets the perspective effect coefficient, i.e. the inverse of the observation distance. The larger this
parameter, the more perceivable the perspective distortion will be. A null value corresponds to a
telecentric lens.
545
f32PerspectiveStrength
2.6
Tilt angles, i.e. the amplitudes of the rotations applied around the X and Y
axis of the sensor to bring the optical (Z) axis perpendicular to the field of
view.
Perspective effect coefficient.
Coordinate Transforms
EWorldShape::SensorToWorld
EPoint EWorldShape::SensorToWorld (EPoint SensorPoint);
Performs coordinate transform for arbitrary points from Sensor space to World space
Parameters
SensorPoint
Sensor point.
EWorldShape::WorldToSensor
EPoint EWorldShape::WorldToSensor (EPoint WorldPoint);
Performs coordinate transform for arbitrary points from World space to Sensor space
Parameters
WorldPoint
546
World point.
2.7
Unwarping
EWorldShape::SetupUnwarp
void EWorldShape::SetupUnwarp (EImageSubPixel64* pLookupTable, EROIBW8* pSrcImage,
BOOL bInterpolate);
Remarks
The function should be called each time the system is recalibrated (after the optical setup has been
changed, for instance).
EWorldShape::Unwarp
void EWorldShape::Unwarp(EROIBW8* pSrcImage, EROIBW8* pDstImage, BOOL bInterpolate);
void EWorldShape::Unwarp(EImageSubPixel64* pLookupTable, EROIBW8* pSrcImage,
EROIBW8* pDstImage, BOOL bInterpolate);
Unwarps a distorted image using the current calibration model. Using a pre-computed lookup table
allows speeding up the unwarping process.
Parameters
pLookupTable
pSrcImage
pDstImage
bInterpolate
Remarks
The lookup table is initialized by means of the SetupUnwarp function.
2.8
Persistent storage
EWorldShape::Load
void EWorldShape::Load(const char* pszPathName, BOOL bDaughters= FALSE);
547
EWorldShape::Save
void EWorldShape::Save(const char* pszPathName, BOOL bDaughters= FALSE);
2.9
Graphical interaction
EWorldShape::Draw
Void EWorldShape::Draw(HDC hDC, enum INS_DRAWING_MODES eDrawingModes =
INS_DRAW_NOMINAL, BOOL bDaughter = TRUE);
EWorldShape::DrawGrid
Void EWorldShape::DrawGrid(HDC hDC);
EWorldShape::DrawCrossGrid
Void EWorldShape::DrawCrossGrid(HDC hDC, FLOAT32 f32XMin = -1, FLOAT32 f32XMax = 1,
FLOAT32 f32YMin = -1, FLOAT32 f32YMax = 1, UINT32 un32NumXIntervals = 2, UINT32
un32NumYntervals = 2);
EWorldShape::SetZoom
void EWorldShape::SetZoom(FLOAT32 f32ZoomX= 1, FLOAT32 f32ZoomY= 0);
Sets the horizontal and vertical zooming factors for drawing operations.
Parameters
f32ZoomX
f32ZoomY
Remarks
All objects (measurement gauges, BGA models, ) attached to an EWorldShape inherit of the same
zooming factor.
EWorldShape::SetPan
void EWorldShape::SetPan(FLOAT32 f32PanX= 0, FLOAT32 f32PanY= 0);
Sets the horizontal and vertical panning factors for drawing operations.
Parameters
f32PanX
f32PanY
Remarks
All objects (measurement gauges, BGA models, ) attached to an EWorldShape inherit of the same
panning factor.
EWorldShape::GetZoom X/Y
FLOAT32 EWorldShape::GetZoomX();
FLOAT32 EWorldShape::GetZoomY();
549
3.
ENUMERATION CONSTANTS
3.1
enum INS_CALIBRATION_MODES
INS_CALIBRATION_RAW
INS_CALIBRATION_INVERSE
INS_CALIBRATION_SCALED
INS_CALIBRATION_SKEWED
INS_CALIBRATION_ANISOTROPIC
INS_CALIBRATION_TILTED
INS_CALIBRATION_RADIAL
INS_CALIBRATION_BILINEAR
INS_CALIBRATION_QUADRATIC
550
no calibration at all.
the ordinate axis points downwards instead of upwards.
the pixels are assigned a physical size.
the coordinate axis make an angle with the image edge.
the physical size of the pixels differ horizontally and vertically.
(Beware there is a restriction pertaining to the allowed image
anisotropy. The resulting pixels aspect ratio should be in the
range [-4/3, -3/4] (or [3/4, 4/3]), otherwise the calibration
process could fail).
the field-of-view plane is not perpendicular to the optical axis.
the lens introduces some amount of radial distortion.
this mode can not be combined with other calibration mode.
The bilinear calibration is based on a first order polynomial
approach.
this mode can not be combined with other calibration mode.
The quadratic calibration is based on a second order
polynomial approach.
4.
SAMPLE PROGRAM
The available sample program dedicated to EWorldShape is the following:
Remarks
The corresponding projects for Microsoft Visual C++ can be found in the eVision\MsVc Samples subfolder, while the projects for Borland C++ Builder are located in the eVision\BcB Samples sub-folder.
551
5.
EASYMULTICAM: INTRODUCTION
EasyMultiCam is a library aimed at images acquisition with Euresys frame grabbers. It provides a
seamless and efficient path from the camera to eVision images, ready to be analyzed and processed.
The EasyMultiCam library holds objects that handle the image acquisition process and a set of functions
that synchronize the eVision EImage... objects.
EasyMultiCam is built upon MultiCam. The MultiCam Acquisition Principles application note provides a
deeper understanding of the image acquisition mechanisms.
The figure below shows the objects constituting EasyMultiCam.
Note. In this chapter, the dots (.) that are part of type names have to be replaced by double colons (::) in C++.
The following objects are in the Euresys::MultiCam namespace:
MultiCamObject
Configuration
Board
Channel
Surface
BoardList
SignalInfo
Exception
EasyMultiCam functions are in the Euresys::eVision::EasyMultiCam namespace:
CreateImage...
CreateSurface
UpdateImageConfig
Declare using
#include "EasyMultiCam.h"
555
6.
Channel, Surface, Configuration and Board are C++ objects representing the MultiCam objects with the
same names.
In addition to the EasyMultiCam User's Guide that includes sample programs, the reader is encouraged to
refer to the MultiCam documentation.
The following books help to understand and control the image acquisition process with EasyMultiCam.
MultiCam Documentation
MultiCam Introduction
MultiCam User's Guide
MultiCam Reference Manual
The following books hold the EureCard documentation including Euresys frame grabber characteristics.
556
7.
7.1
MultiCamObject
7.1.1
MultiCamObject Overview
MultiCamObject exposes common methods for the EasyMultiCam objects represented above.
It can be found in the Euresys::MultiCam namespace.
Declare using
#include "EasyMultiCam.h"
7.1.2
MultiCamObject Methods
MultiCamObject::GetParam
The GetParam method is used to retrieve the value of a MultiCamObject parameter. It applies to Channel,
Surface, Board and Configuration.
There are two ways to designate the parameter: by id and by name.
Independently of the parameter type, its value may be returned as int, unsigned int, double or character
string. In addition, some parameters have the Surface type.
void
void
void
void
MultiCamObject::GetParam(MCPARAMID
MultiCamObject::GetParam(MCPARAMID
MultiCamObject::GetParam(MCPARAMID
MultiCamObject::GetParam(MCPARAMID
Parameters
param
value
param,
param,
param,
param,
int &value);
unsigned int &value);
double &value);
Surface *&value);
557
Parameters
param
value
maxLength
void
void
void
void
MultiCamObject::GetParam(const
MultiCamObject::GetParam(const
MultiCamObject::GetParam(const
MultiCamObject::GetParam(const
Parameters
param
value
char
char
char
char
*param,
*param,
*param,
*param,
int &value);
unsigned int &value);
double &value);
Surface *&value);
Parameters
param
value
maxLength
MultiCamObject::SetParam
The SetParam method is used to set the value of a MultiCamObject parameter. It applies to Channel,
Surface, Board and Configuration.
There are two ways to designate the parameter: by id and by name.
Independently of the parameter type, the value may be passed as int, unsigned int, double or character
string. In addition, some parameters have the Surface type.
void
void
void
void
void
MultiCamObject::SetParam(MCPARAMID
MultiCamObject::SetParam(MCPARAMID
MultiCamObject::SetParam(MCPARAMID
MultiCamObject::SetParam(MCPARAMID
MultiCamObject::SetParam(MCPARAMID
Parameters
param
value
void
void
void
void
void
558
int value);
unsigned int value);
const char *value);
double value);
Surface &value);
MultiCamObject::SetParam(const
MultiCamObject::SetParam(const
MultiCamObject::SetParam(const
MultiCamObject::SetParam(const
MultiCamObject::SetParam(const
Parameters
param
value
param,
param,
param,
param,
param,
char
char
char
char
char
*param,
*param,
*param,
*param,
*param,
int value);
unsigned int value);
const char *value);
double value);
Surface &value);
7.2
Configuration Overview
The Configuration object gives access to all MultiCam parameters dedicated to the control of systemwide features.
The system is a set of Euresys boards installed inside a host computer. The Configuration object also
addresses any hardware or software element of the host computer requesting some degree of control for
the MultiCam system operation.
The Configuration object exists in one instance per application. The user is not allowed to create a
Configuration object. The Configuration object is natively made available to the application through the
Config global variable.
It can be found in the Euresys::MultiCam namespace.
Declare using
#include "EasyMultiCam.h"
7.3
Board Overview
559
The Board object gives access to all MultiCam parameters dedicated to the control of board features. It
also addresses the access of I/O lines from an application program, implementing the general-purpose I/O
functionality.
The Board object exists in one instance for each Euresys board installed inside a host computer. The user
is not allowed to create Board objects. The Board objects are natively made available to the application
through the Boards global object.
It can be found in the Euresys::MultiCam namespace.
Declare using
#include "EasyMultiCam.h"
7.4
7.4.1
Channel
Channel Overview
The Channel object represents the path from the camera to the Surface (i.e. the image acquired in PC
memory). It performs the image acquisition in EasyMultiCam.
Usually, the application creates one channel per camera. After creation, the channel is configured by
setting relevant parameters with the GetParam and SetParam methods.
Once configured, the channel is activated with the SetActive method. It is stopped with the SetIdle
method.
Optionally and before calling SetActive, the channel may be prepared with the Prepare method. This
ensures that all time-consuming configuration operations are done and that the channel will immediately
perform image acquisitions upon activation.
When active, the channel performs image acquisition. It reports its activity by executing callback functions
previously registered with RegisterCallback. As an alternative, the WaitForSignal and GetSignalInfo
methods may be used to synchronize with the channel activity.
The callback functions and the GetSignalInfo method report, when applicable, the Surface objects
representing the images acquired in PC memory.
Surfaces correspond to EImage... objects. The synchronization between Surface and EImage... is ensured
through the EasyMultiCam functions.
The Channel object is in the Euresys::MultiCam namespace.
560
Declare using
#include "EasyMultiCam.h"
7.4.2
Channel Methods
Channel constructor
Constructs a Channel object. The channel is created on a given Board. The caller specifies the
connector where the camera is connected.
Possible connectors are listed here: Connector Parameter Reference.
Channel::Channel(Board *board, int connector);
Channel::Channel(Board *board, const char *connector);
Parameters
board
connector
Channel::GetSignalInfo
Retrieves the information associated with a MultiCam signal. This function is used in combination with
WaitForSignal. Once a signal is issued, calling GetSignalInfo fills a SignalInfo object with relevant
information.
Possible signals are listed here: MultiCam Channel Signals.
void Channel::GetSignalInfo(MCSIGNAL signal, SignalInfo &info);
Parameters
signal
info
Channel::Prepare
Channel creation and configuration involve some time-consuming tasks like firmware upload, memory
allocation... These time-consuming tasks are best performed after all relevant parameters have been
set but before channel activation.
The Prepare method is optionally called after channel configuration (through SetParam/GetParam)
and before calling SetActive.
When doing so, all time-consuming tasks are performed during the Prepare call. This ensures that the
channel is immediately capable of doing image acquisition upon activation.
If Prepare was not called, or if parameters were changed after calling Prepare, the time-consuming
tasks will be performed when calling SetActive.
void Channel::Prepare( );
Channel::RegisterCallback
This method registers a callback method for a MultiCam signal.
The callback method callbackMethod from the object owner will be called by EasyMultiCam each
time a given signal is issued.
The callback method is executed in a dedicated thread.
561
Parameters
owner
callbackMethod
signal
Parameters
ch
info
Example
class Foo
{
// ...
Channel *pChannel;
public:
void OnSurfaceProcessing(Channel &channel, SignalInfo &info);
// ...
};
void Foo::OnSurfaceProcessing(Channel &channel, SignalInfo &info)
{
cout << "Signal " << info.Signal << endl;
// ...
UpdateImageConfig(*info.Surf, someEImage);
// ...
}
BOOL Foo::Init()
{
// ...
pChannel->RegisterCallback(this, &OnSurfaceProcessing,
MC_SIG_SURFACE_PROCESSING);
// ...
}
Channel::SetActive
This method activates the channel.
When active, the channel performs image acquisition according to its configuration. It reacts to
acquisition triggers when configured to do so.
void Channel::SetActive( );
Channel::SetIdle
This method ends the channel acquisition sequence.
562
When idle, the channel does not acquire images nor responds to acquisition triggers.
void Channel::SetIdle( );
Channel::UnregisterCallback
Calling this method unregisters the callback function for a given signal. Callback functions are
registered by calling RegisterCallback.
Possible signals are listed here: MultiCam Channel Signals.
void Channel::UnregisterCallback(MCSIGNAL signal);
Parameters
signal
Channel::WaitForSignal
This method waits for a MultiCam signal and provides, when the signal is issued, the corresponding
SignalInfo object.
Possible signals are listed here: MultiCam Channel Signals.
void Channel::WaitForSignal(MCSIGNAL signal, unsigned int timeout, SignalInfo
&info);
Parameters
signal
timeout
info
7.5
7.5.1
Signal identifier.
Time-out value, expressed in milliseconds (ms).
SignalInfo object corresponding to the signal.
Surface
Surface Overview
563
The Surface object represents the images acquired by the channel in PC memory.
There is a direct relation between Surface objects and EImage... objects. This relation involves no image
buffer copy, the image buffers being shared between Surface and EImage... objects.
EasyMultiCam functions handle the relation between surfaces and EImage... objects.
7.5.2
Surface Methods
Surface constructor
Constructs an empty Surface object.
By default, surface creation is not mandatory. The channel automatically creates Surface objects for
image acquisition.
Surface construction is useful when the application requires control on the memory allocation process.
In this case, the application configures the relevant Surface parameters through GetParam/SetParam.
Surfaces are passed to the Channel through the Cluster parameter.
The CreateSurface function can also be used to create surfaces from existing EImage... objects.
Surface::Surface( );
Surface::Free
This method reverts the effect of Reserve.
When this is done, the channel is allowed to acquire new images in the surface.
void Surface::Free( );
Surface::Reserve
This method excludes the Surface object from the acquisition process.
When this is done, no new image acquisition will target this surface.
void Surface::Reserve( );
564
7.6
7.6.1
BoardList
BoardList Overview
The BoardList object gives access to the Board objects representing Euresys frame grabbers in the host
computer.
There is only one BoardList instance per application: the global Boards variable. The user is not allowed
to create a BoardList object.
It can be found in the Euresys::MultiCam namespace.
Declare using
#include "EasyMultiCam.h"
7.6.2
BoardList Methods
BoardList::GetBoardByBoardIdentifier
This method is used to obtain a reference to a Board object using its board identifier.
The board identifier is an ASCII character string resulting from the concatenation of the board type and the
serial number with an intervening underscore. The serial number is a 6-digit string made of characters 0 to
9.
"COLORSCAN_000123" is an example.
Board * BoardList::GetBoardByBoardIdentifier(const char *boardIdentifier);
Parameters
boardIdentifier
BoardList::GetBoardByBoardName
This method is used to obtain a reference to a Board object using its name.
The designation is based on the name given to a board. The name is a string of maximum 16 ASCII
characters.
To give a name to a board, use the NameBoard board parameter.
Board * BoardList::GetBoardByBoardName(const char *boardName);
Parameters
boardName
BoardList::GetBoardByDriverIndex
This method is used to obtain a reference to a Board object using its index.
The designation is based on the board location in the Boards global object. The set of MultiCam compliant
boards are assigned a set of consecutive integers starting at zero. The indexing order is system
dependent.
565
Parameters
driverIndex
BoardList::GetBoardByPciPosition
This method is used to obtain a reference to a Board object using its position in the PCI bus.
The designation is based on a number associated to a PCI slot. This number is assigned by the operating
system in a non-predictable way, but remains consistent for a given configuration in a given system.
Board * BoardList::GetBoardByPciPosition(int pciPosition);
Parameters
pciPosition
BoardList::GetCount
This method returns the number of elements in the board list.
int GetCount( );
7.6.3
BoardList Operator
BoardList::operator[ ]
This operator is used to obtain a reference to a Board object using its index.
The designation is based on the board location in the board list. The set of MultiCam compliant boards are
assigned a set of consecutive integers starting at zero. The indexing order is system dependent.
Board *operator[ ] (int driverIndex);
Parameters
driverIndex
7.7
7.7.1
SignalInfo
SignalInfo Overview
566
7.7.2
SignalInfo Properties
SignalInfo::Signal property
This property represents the MCSIGNAL identifier of a MultiCam signal.
Possible signals are listed here: MultiCam Channel Signals.
SignalInfo::Surf property
Reference to the Surface object related to the MultiCam signal.
7.8
7.8.1
Exception
Exception Overview
EasyMultiCam reports errors through the exception system. The Exception object is used as a medium
for information about abnormal conditions.
The What method provides a description of the error condition.
The Exception object is in the Euresys namespace.
Declare using
#include "EasyMultiCam.h"
7.8.2
Exception Method
Exception::What
This method returns the description of the exception.
const char * Exception::What( );
567
8.
FUNCTIONS
The EasyMultiCam Channel objects capture images from a camera and fill Surface objects with these
images.
There is a direct relation between Surface objects and EImage... objects. This relation involves no image
buffer copy, the image buffers being shared between Surface and EImage...
EasyMultiCam functions handle the relation between surfaces and EImage... objects.
Declare using
#include "EasyMultiCam.h"
CreateImage...
This function creates a new EImage... object based on an existing Surface object.
This involves no image buffer copy, the image buffers being shared between Surface and EImage...
EImageBW8 * CreateImageBW8(const Euresys::MultiCam::Surface &s);
EImageBW16 * CreateImageBW16(const Euresys::MultiCam::Surface &s);
EImageC24 * CreateImageC24(const Euresys::MultiCam::Surface &s);
EImageC24A * CreateImageC24A(const Euresys::MultiCam::Surface &s);
EImageC15 * CreateImageC15(const Euresys::MultiCam::Surface &s);
EImageC16 * CreateImageC16(const Euresys::MultiCam::Surface &s);
CreateSurface
This function creates a new Surface object based on an existing EImage... or EVector... object.
This involves no image buffer copy, the image buffers being shared between Surface and
EImage.../EVector...
EMC_API
EMC_API
EMC_API
EMC_API
EMC_API
EMC_API
EMC_API
EMC_API
EMC_API
EMC_API
EMC_API
Euresys::MultiCam::Surface
Euresys::MultiCam::Surface
Euresys::MultiCam::Surface
Euresys::MultiCam::Surface
Euresys::MultiCam::Surface
Euresys::MultiCam::Surface
Euresys::MultiCam::Surface
Euresys::MultiCam::Surface
Euresys::MultiCam::Surface
Euresys::MultiCam::Surface
Euresys::MultiCam::Surface
*CreateSurface(const
*CreateSurface(const
*CreateSurface(const
*CreateSurface(const
*CreateSurface(const
*CreateSurface(const
*CreateSurface(const
*CreateSurface(const
*CreateSurface(const
*CreateSurface(const
*CreateSurface(const
EImageBW8 &img);
EImageBW16 &img);
EImageC24 &img);
EImageC24A &img);
EImageC15 &img);
EImageC16 &img);
EBW8Vector &vec);
EBW16Vector &vec);
EBW32Vector &vec);
EC24Vector &vec);
EColorVector &vec);
UpdateImageConfig
This function updates the properties of an existing EImage... object with new contents provided by a
Channel through Surface objects.
This involves no image buffer copy, the image buffers being shared between Surface and EImage.
568
UpdateImageConfig(const
UpdateImageConfig(const
UpdateImageConfig(const
UpdateImageConfig(const
UpdateImageConfig(const
UpdateImageConfig(const
Euresys::MultiCam::Surface
Euresys::MultiCam::Surface
Euresys::MultiCam::Surface
Euresys::MultiCam::Surface
Euresys::MultiCam::Surface
Euresys::MultiCam::Surface
&s,
&s,
&s,
&s,
&s,
&s,
EImageBW8 &img);
EImageBW16 &img);
EImageC24 &img);
EImageC24A &img);
EImageC15 &img);
EImageC16 &img);
569
Glossary
Glossary
573
Device Contexts
Under Windows, when using the standard drawing functions (GDI), a device context is associated to the
window. The device context maintains the current drawing attributes such as pen and brush specifications.
In a Windows API application, the device context is referred to by means of a device context handle
(HDC). This value must be passed to the eVision drawing functions.
In an MFC application (Microsofts Foundation Classes), the device context is encapsulated in the CDC
class. Member function CDC::GetSafeHdc( ) provides the corresponding device context handle.
In an OWL application (Borlands Object Windows Library), the device context is encapsulated in the TDC
class. The typecast member function TDC::HDC( ) provides the corresponding device context handle.
EGenericROI
A EGenericROI* pointer is used when the actual image type (EBW8, EC24...) is unknown. When passing
such a pointer to a processing function, it must be typecast to the appropriate Image/ROI type. Also see
member GetType.
FOURCC
For AVI files, the programmer chooses the compression with the FOURCC code. Microsoft has given a
FOURCC code for each video compression.
In order to ease the job of programmers, predefined codes for some common compression are ready to
use in the form of constants. For not predefined codes, the programmer can use the macro
'mmioFOURCC(a,b,c,d)' where abcd are the four characters of the code. Here is the list of the codes
defined by a constant:
Compression
Predefined constant
FOURCC code
No compression
EFOURCC_UNCOMPRESSED
mmioFOURCC('D','I','B',' ')
MJPEG
EFOURCC_MJPEG
mmioFOURCC('m','j','p','g')
EFOURCC_RLE
mmioFOURCC('M','R','L','E')
Gray-Level Normalization
Compensation of any change in intensity or contrast by use of two reference gray-levels. The effect is
such that the sample reference gray-levels become equal to the template gray-levels.
Hole
In EasyObject, a hole is an empty space (non-object part) completely included in (or surrounded by) a
well-formed EasyObject object. Holes in objects are generated and processed exactly like any other
EasyObject objects. So, hole building simply adds new objects in EasyObject.
574
Glossary
Key Frame
In compressed video, images which are independent of the others for the decompression, are called key
frames. A key frame is an image which is compressed as single stand-alone image. The encoding of the
other images is based on their closest key frames.
Object
In a general content, the term object should be understood with the meaning of either C++ class instance
or ActiveX control, depending on the interface used.
In EasyObject, objects are also understood as separated shapes got from an image. In that case, the
term "blobs" is also used. This locution refers indifferently to real object (an EasyObject object that is not a
hole) or hole in real object.
Pitch
In the context of BGA Components, the pitches are defined as the shortest horizontal or vertical distance
from center to center to the nearest neighbor ball in the same array.
Quantized colors
A quantized color is a triple of integer values representing discrete color components. All component
values are defined in the [0 255] interval and stored as unsigned bytes (also see Color System Variants).
An EImageC24 image is an array of such quantized colors.
The quantized color components are stored in the following structure:
struct
{ UINT8 m_un8C2, m_un8C1, m_un8C0;
} EC24;
Important note. The components are stored in backward order, for compatibility with the Windows bitmap
definition. However, the components are indexed in the same order as in their acronym: f.i., component 0
of RGB is Red, 1 is Green and 2 is Blue. Similarly, component 0 of LSH is Lightness, 1 is Saturation and 2
is Hue. End of note.
Run
Very roughly speaking, EasyObject objects are described by the list of their pixels. More precisely, object
pixels are first grouped into horizontal line segments also called runs (see the drawing below). Thus, an
object is a list of runs built during image segmentation.
575
Unquantized colors
An unquantized color is a triple of 32 bits floating point values representing continuous color components.
All component values are defined in the [0 1] interval, with the following exceptions:
YUV U and V in range [-0.5 +0.5]
YIQ I and Q in range [-0.5 +0.5]
L*a*b* L* in range [0 100[, a* and b* in range [-128 +128]
LCH L in range [0 100[, C in range [0 256[
L*u*v* L* in range [0 100[, u* and v* in range [-128 +128]
The hues are computed in revolutions rather than degrees and thus contained in the [0 1] interval as well.
The unquantized color components are stored in a different structure depending on the color system:
struct
{ FLOAT32
} EXYZ;
struct
{ FLOAT32
} ERGB;
struct
{ FLOAT32
} EYUV;
struct
{ FLOAT32
} EYIQ;
struct
{ FLOAT32
} ELSH;
struct
{ FLOAT32
} EISH;
struct
{ FLOAT32
} EYSH;
struct
{ FLOAT32
} EVSH;
struct
{ FLOAT32
} ELAB;
576
Glossary
struct
{ FLOAT32 m_f32L, m_f32C, m_f32H;
} ELCH;
struct
{ FLOAT32 m_f32L, m_f32U, m_f32V;
} ELUV;
The following union is used to hold an unquantized color regardless the color system:
union
{ EXYZ m_XYZ;
ERGB m_RGB;
ELAB m_LAB;
ELUV m_LUV;
EYUV m_YUV;
EYIQ m_YIQ;
ELCH m_LCH;
ELSH m_LSH;
EISH m_ISH;
EVSH m_VSH;
EYSH m_YSH;
} EColor;
577
Appendix
Appendix
1.
eVision can generate two kinds of error: errors managed by eVision and exceptions.
The errors managed by eVision use ETraceMode(), EOK(), EGetError(), etc. It is the responsibility
of the user to test the returned error code, by calling eVision EGetError() function. If the mode of
error tracing is not eSilent (default mode), a message box will inform the user about the type of the
encountered error.
Each time an eVision error occurs (i.e. EGetError() != EOK), an exception is generated. Unless the
arising exception is ignored by the IDE (a possible option in the IDE management of the exceptions) or
is managed by the program (try-catch like), a message box will warn the user about this exception. The
samples of eVision are deprived of try-catch mechanism.
In the ActiveX environment, an exception is generated for all possible errors issued by eVision libraries.
581
2.
The following values can be returned by the library functions. E_OK always indicates a normal,
successful termination. The other codes usually correspond to a faulty situation, such as a division by
zero, a lack of memory space or incompatible parameter values. In such cases, correct function results
cannot be guaranteed.
0 Success
E_OK
582
Appendix
E_ERROR_PARAMETER_2_OUT_OF_RANGE
1022 Invalid planes per pixel - Check image type or file contents
E_ERROR_INVALID_PLANES_PER_PIXEL
1023 1 bit black & white (BW1) image expected - Check image type or file contents
E_ERROR_BW1_IMAGE_EXPECTED
1024 8 bits black & white (BW8) image expected - Check image type or file contents
E_ERROR_BW8_IMAGE_EXPECTED
1025 16 bits black & white (BW16) image expected - Check image type or file contents
E_ERROR_BW16_IMAGE_EXPECTED
1026 32 bits black & white (BW32) image expected - Check image type or file contents
E_ERROR_BW32_IMAGE_EXPECTED
1027 15 bits High Color (C15) image expected - Check image type or file contents
E_ERROR_C15_IMAGE_EXPECTED
1028 16 bits High Color (C16) image expected - Check image type or file contents
E_ERROR_C16_IMAGE_EXPECTED
1029 24 bits True Color (C24) image expected - Check image type or file contents
E_ERROR_C24_IMAGE_EXPECTED
1100 File access problems - Check file pathname and device state
E_ERROR_FILE_ACCESS_PROBLEMS
1102 File could not be opened - Check file pathname, troubleshoot disk device
E_ERROR_FILE_COULD_NOT_BE_OPENED
1103 File error while reading - Check file integrity, troubleshoot disk device
E_ERROR_FILE_ERROR_WHILE_READING
1104 File error while writing - Check free disk space, troubleshoot disk device
E_ERROR_FILE_ERROR_WHILE_WRITING
1106 File could not be closed - Check free disk space, troubleshoot disk device
E_ERROR_FILE_COULD_NOT_BE_CLOSED
1111 The archive does not contain the correct object type - Check your archiving routines please
E_ERROR_UNSUPPORTED_OBJECT_TYPE_IN_ARCHIVE
1113 Attempting to read with a serializer not open for read access
E_ERROR_SERIALIZER_SHOULD_BE_IN_READ_MODE
1114 Attempting to write with a serializer not open for write access
E_ERROR_SERIALIZER_SHOULD_BE_IN_WRITE_MODE
1150 Missing or invalid AVI stream - File must contain video data
E_ERROR_MISSING_OR_INVALID_AVI_STREAM
584
Appendix
1153 AVI compressor does not support this image format - Check codec documentation
E_ERROR_AVI_COMPRESSOR_DOES_NOT_SUPPORT_THIS_IMAGE_FORMAT
1204 Disk image too wide for block - Contact Technical Support
E_ERROR_DISK_IMAGE_TOO_WIDE_FOR_BLOCK
1301 Unable to allocate temporary memory - Fix memory leaks or release memory
E_ERROR_UNABLE_TO_ALLOCATE_TEMPORARY_MEMORY
585
1404 Images not of the same depth (bits per pixel) - Choose compatible types
E_ERROR_IMAGES_NOT_SAME_BITS_PER_PIXEL
586
Appendix
1421 The hierarchy of ROI has been corrupted (inconsistent parent/daughters relationship) - Contact
Technical Support
E_ERROR_INCONSISTENT_ROI_HIERARCHY
1900 The license for this library is not granted - Launch license manager
E_ERROR_LICENSE_MISSING
1901 The dongle for a library is missing (see license file) - Launch license manager
E_ERROR_LICENSE_KEY_MISSING
1902 The dongle for a library is of the wrong type (see license file) - Launch license manager
E_ERROR_LICENSE_WRONG_KEY_TYPE
1903 The license for a library has expired (see license file) - Launch license manager
E_ERROR_LICENSE_EXPIRED
1904 The license for EasyAccess is not granted - Launch license manager
E_ERROR_EASY_ACCESS_LICENSE_MISSING
1905 The license for EasyImage is not granted - Launch license manager
E_ERROR_EASY_IMAGE_LICENSE_MISSING
1906 The license for EasyObject is not granted - Launch license manager
E_ERROR_EASY_OBJECT_LICENSE_MISSING
1907 The license for EasyMeasure is not granted - Launch license manager
E_ERROR_EASY_MEASURE_LICENSE_MISSING
1908 The license for EasyOCR is not granted - Launch license manager
E_ERROR_EASY_OCR_LICENSE_MISSING
1910 The license for EasyMatch is not granted - Launch license manager
E_ERROR_EASY_MATCH_LICENSE_MISSING
Appendix
E_ERROR_EASY_GRANULA_LICENSE_MISSING
1913 The license for EasyColor is not granted - Launch license manager
E_ERROR_EASY_COLOR_LICENSE_MISSING
1914 The license for EasyOCV is not granted - Launch license manager
E_ERROR_EASY_OCV_LICENSE_MISSING
1915 The license for EasyMatrixCode is not granted - Launch license manager
E_ERROR_EASY_MATRIX_CODE_LICENSE_MISSING
1916 The license for EasyInspect is not granted - Launch license manager
E_ERROR_EASY_INSPECT_LICENSE_MISSING
1917 The license for EasyBGA is not granted - Launch license manager
E_ERROR_EASY_BGA_LICENSE_MISSING
1918 The license for EasyFind is not granted - Launch license manager
E_ERROR_EASY_FIND_LICENSE_MISSING
1919 The license for EasyGauge is not granted - Launch license manager
E_ERROR_EASY_GAUGE_LICENSE_MISSING
1920 The license for EasyBarCode is not granted - Launch license manager
E_ERROR_EASY_BAR_CODE_LICENSE_MISSING
1955 SetOemKey could not find a place to write the OEM Key in
E_ERROR_NO_PLACE_TO_WRITE_OEM_KEY_IN
1956 SetOemKey could not find a Sentinel Dongle to write the OEM Key in
E_ERROR_NO_SENTINEL_DONGLE_TO_WRITE_OEM_KEY_IN
1957 SetOemKey could not find an EureCard to write the OEM Key in
E_ERROR_NO_EURECARD_TO_WRITE_OEM_KEY_IN
1958 SetOemKey could not write the OEM Key in the specified Sentinel Dongle
E_ERROR_CANNOT_WRITE_KEY_IN_SENTINEL_DONGLE
1959 SetOemKey could not write the OEM Key in the specified EureCard
E_ERROR_CANNOT_WRITE_KEY_IN_EURECARD
2000 Could not read the license file (LICENSE.KEY) - Check installation
E_ERROR_COULD_NOT_READ_THE_LICENSE_FILE
2002 The path to the license file could not be read - Install eVision if you are using a memoryless dongle
E_ERROR_LICENSE_PATH_NOT_DEFINED
2015 No license file (LICENSE.KEY) found - Install one if your are using a memoryless dongle
E_ERROR_LICENSE_FILE_NOT_FOUND
2021 Host Signature licensing not possible - Try with another PC or use an EureCard or a Dongle
E_ERROR_IDENTIFICATION_UNAVAILABLE
2022 The entered code is invalid - Please check it and try again
E_ERROR_INVALID_CHECKSUM
2026 Hardware for Host Signature has changed - Restore the PC in its initial state or contact Technical
Support
E_ERROR_IDENTIFICATION_ALTERED
2101 Dallas Semiconductor driver not found - Install it if you are using a Dallas Semiconductor dongle
E_ERROR_DALSEMI_DRIVER_NOT_FOUND
590
Appendix
2107 This is not a suitable dongle type (DS1427 Time button required)
E_ERROR_DALSEMI_NOT_A_TIME_BUTTON
2110 This is not a suitable dongle type (DS1425 Multi button required)
E_ERROR_DALSEMI_NOT_A_MULTI_BUTTON
2120 Domino driver not found or out-of-date - (Re)install it if you are using a Domino with on-board
licences
E_ERROR_DOMINO_DRIVER_NOT_FOUND
2130 Picolo driver not found or out-of-date - (Re)install it if you are using a Picolo with on-board licences
E_ERROR_PICOLO_DRIVER_NOT_FOUND
2133 MultiCam driver not found or out-of-date - (Re)install it if you are using a
Picolo/Grablink/Quickpack/Domino/Multi with on-board licences
E_ERROR_MULTI_DRIVER_NOT_FOUND
2137 Sentinel driver not found - Install it if you are using a Sentinel dongle
E_ERROR_SENTINEL_DRIVER_NOT_FOUND
2140 Cannot read the external serial number of an EureCard - Update driver
E_ERROR_CANNOT_READ_EURECARD_EXTERNAL_NUMBER
2141 SirCam driver not found or out-of-date - (Re)install it if you are using a Grablink/Domino/Multi with
on-board licences
E_ERROR_SIRCAM_DRIVER_NOT_FOUND
591
4001 Measure object must not be a point - Use line or circle measure probe
E_ERROR_MEASURE_OBJ_MUST_NOT_BE_POINT
Appendix
E_ERROR_BROKEN_OBJECT
6007 The number of degrees of freedom must be at least one, and no more than five - Use a value in this
range
E_ERROR_WRONG_NUMBER_OF_DEGREES_OF_FREEDOM
6500 Not enough feature points - Use a more contrasted pattern or reduce the Don't Care mask
E_ERROR_INSUFFICIENT_CONTRAST
6503 Pattern is too close to image border - Leave a margin around the pattern
E_ERROR_PATTERN_TOO_CLOSE_TO_IMAGE_BORDER
7001 No patterns in these classes - Check pattern and text class assignments
E_ERROR_NO_PATTERNS_IN_THESE_CLASSES
593
10009 Unknown ECC family (ECC 000/050/080/100/140/200 only) - Contact Technical Support
E_ERROR_UNKNOWN_ECC_FAMILY
10011 Too many errors, cannot correct contents - See Reference Manual
E_ERROR_UNCORRECTABLE_ERRORS
10012 Could not locate the dot matrix symbol (no good candidate object) - See Reference Manual
E_ERROR_COULD_NOT_LOCATE_SYMBOL
10013 Unknown Format ID in ECC 000-140 symbol (Base 11/27/41/37 and ASCII 7/8 only) - See
Reference Manual
E_ERROR_UNKNOWN_FORMAT_ID
10014 Invalid CRC after error correction in ECC 000-140 symbol - See Reference Manual
E_ERROR_INVALID_CRC
10017 Could not locate the dot matrix symbol (no object of acceptable area) - See Reference Manual
E_ERROR_COULD_NOT_LOCATE_SYMBOL_AREA
10018 Could not locate the dot matrix symbol (no object of acceptable size) - See Reference Manual
E_ERROR_COULD_NOT_LOCATE_SYMBOL_SIZE
10019 Could not locate the dot matrix symbol (too many candidate objects) - See Reference Manual
E_ERROR_COULD_NOT_LOCATE_SINGLE_SYMBOL
Appendix
E_ERROR_COULD_NOT_DETERMINE_SYMBOL_SIZE
10501 Could not locate bar code symbol - Improve contrast, avoid clutter
E_ERROR_COULD_NOT_LOCATE_BARCODE
10502 Could not locate single bar code symbol - Reduce field-of-view
E_ERROR_COULD_NOT_LOCATE_SINGLE_BARCODE
595
12009 Not in indexed attachment mode - Detach daughters and call SetIndexed first
E_ERROR_NOT_IN_INDEXED_ATTACHMENT_MODE
12014 Not enough landmarks to calibrate - Add landmarks or check calibration mode categories
E_ERROR_NOT_ENOUGH_LANDMARKS
12015 Unexpected shape type in file - Check target shape against file model root
E_ERROR_UNEXPECTED_SHAPE_TYPE_IN_FILE
12017 Cannot Attach or Detach World shape - World shapes never have a mother
E_ERROR_CANNOT_ATTACH_DETACH_WORLD_SHAPES
12018 Unexpected World Shape in file - Check target shape against file model root
E_ERROR_UNEXPECTED_WORLD_SHAPE_IN_FILE
12019 Unexpected Frame Shape in file - Check target shape against file model root
E_ERROR_UNEXPECTED_FRAME_SHAPE_IN_FILE
12020 Unexpected Point Shape in file - Check target shape against file model root
E_ERROR_UNEXPECTED_POINT_SHAPE_IN_FILE
12021 Unexpected Line Shape in file - Check target shape against file model root
E_ERROR_UNEXPECTED_LINE_SHAPE_IN_FILE
12022 Unexpected Circle Shape in file - Check target shape against file model root
E_ERROR_UNEXPECTED_CIRCLE_SHAPE_IN_FILE
12023 Unexpected Rectangle Shape in file - Check target shape against file model root
E_ERROR_UNEXPECTED_RECTANGLE_SHAPE_IN_FILE
12024 Unexpected Wedge Shape in file - Check target shape against file model root
E_ERROR_UNEXPECTED_WEDGE_SHAPE_IN_FILE
12025 Unexpected Point Gauge in file - Check target shape against file model root
E_ERROR_UNEXPECTED_POINT_GAUGE_IN_FILE
12026 Unexpected Line Gauge in file - Check target shape against file model root
E_ERROR_UNEXPECTED_LINE_GAUGE_IN_FILE
12027 Unexpected Circle Gauge in file - Check target shape against file model root
E_ERROR_UNEXPECTED_CIRCLE_GAUGE_IN_FILE
596
Appendix
12028 Unexpected Rectangle Gauge in file - Check target shape against file model root
E_ERROR_UNEXPECTED_RECTANGLE_GAUGE_IN_FILE
12029 Unexpected Wedge Gauge in file - Check target shape against file model root
E_ERROR_UNEXPECTED_WEDGE_GAUGE_IN_FILE
12030 Unexpected Find Model in file - Check target shape against file model root
E_ERROR_UNEXPECTED_FIND_IN_FILE
12031 Unexpected Bar Code Model in file - Check target shape against file model root
E_ERROR_UNEXPECTED_BAR_CODE_IN_FILE
12032 Unexpected BGA Model in file - Check target shape against file model root
E_ERROR_UNEXPECTED_BGA_IN_FILE
12033 Unexpected BGA Component in file - Check target shape against file model root
E_ERROR_UNEXPECTED_BGA_COMPONENT_IN_FILE
12034 Unexpected BGA Array in file - Check target shape against file model root
E_ERROR_UNEXPECTED_BGA_ARRAY_IN_FILE
12035 Unexpected BGA Ball in file - Check target shape against file model root
E_ERROR_UNEXPECTED_BGA_BALL_IN_FILE
12100 At least one curved edge must be active - Activate r and/or R edges
E_ERROR_AN_ACTIVE_CURVED_EDGE_IS_REQUIRED
13010 This obsolete method may not be used with new measure assessment mode - Please see the
documentation
E_ERROR_INVALID_MEASURE_ASSESSMENT_FLAGS
13011 This obsolete method may not be used with new circularity assessment mode - Please see the
documentation
E_ERROR_INVALID_CIRCULARITY_ASSESSMENT_FLAGS
14001 Cannot link the new channel with selected board - Check consistency of the Model, CAM
file, board index and topology parameters
E_ERROR_CANNOT_LINK_CHANNEL_TO_BOARD
14002 Cannot link the processor with selected board - Make sure you have a MultiPlus or MultiExpress
board
E_ERROR_CANNOT_LINK_PROCESSOR_TO_BOARD
597
14004 No Board corresponding to BoardIdentifier parameter - Check board type and serial number
E_ERROR_NO_BOARD_CORRESPONDING_TO_BOARDIDENTIFIER
14005 No Board corresponding to DriverIndex parameter - The system seems to contain less boards than
expected
E_ERROR_NO_BOARD_CORRESPONDING_TO_DRIVERINDEX
14007 Model load has failed - The specified Model is not compatible with this version of the drivers
E_ERROR_MODEL_LOAD_FAILED
14008 The configuration file (.cam) load has failed - Check the cam file for any misspelled or invalid
parameter
E_ERROR_CAM_FILE_LOAD_FAILED
14009 Not enough resources to load the processor - Use a MultiExpress or reduce the number of
processor
E_ERROR_CANNOT_FIND_FREE_PROCESSOR
14012 The channel could not be activated - Another channel may be using too many resources
E_ERROR_CANNOT_ACTIVATE_THE_CHANNEL
14013 The channel could not be deactivated - An acquisition may still be pending
E_ERROR_CANNOT_DESACTIVATE_THE_CHANNEL
14015 EMCOpen( ) must be called before using any object of the EasyMultiCam library - Make sure you
call EMCOpen( ) once before using any of the EasyMultiCam objects
E_ERROR_NULL_EMCCONFIGURATION_POINTER
14021 Model names must be of the form "PICOLO_n" - Adjust Model name
E_ERROR_INVALID_MODEL
14026 Invalid video standard - Use one of CCIR, EIA, PAL, NTSC, SECAM
E_ERROR_INVALID_STANDARD
14027 This function is not supported for Picolo boards - Do not use
E_ERROR_UNSUPPORTED_FUNCTION
14028 Inconsistent Model for specified board - Check matching between the source descriptor and the
selected board
E_ERROR_INCONSISTENT_MODEL_FOR_SPECIFIED_BOARD
598
Appendix
E_ERROR_EMCIMAGE_NOT_ASSIGNED
14030 Channel creation wizard failed - Check your MultiCam installation and presence of MultiCam
compliant board
E_ERROR_CHANNEL_CREATION_WIZARD_FAILURE
14031 The EMCImage type does not match the selected source - Adjust the EMCImage type
E_ERROR_IMAGE_TYPE_DIFFERS_FROM_SOURCE
14027 This function is not supported for Picolo boards - Do not use
E_ERROR_UNSUPPORTED_FUNCTION
14101 The system contains no MultiCam compliant board or the drivers are not properly installed - You
need to install a board and its drivers
E_ERROR_MULTICAM_NO_BOARD_FOUND
14102 The requested parameter does not exist - Check its spelling, identifier or availability for your
configuration
E_ERROR_MULTICAM_BAD_PARAMETER
14105 Too many system resources are in use - Try using less memory
E_ERROR_MULTICAM_NO_MORE_RESOURCES
14106 One or more MultiCam resources cannot be freed because they are still in use - Make sure to
delete objects in the right order
E_ERROR_MULTICAM_IN_USE
14108 The MultiCam database encountered an error - Make sure the Model file is valid for your
configuration or driver version
E_ERROR_MULTICAM_DATABASE_ERROR
14111 The specified MultiCam handle is not a valid handle for the requested type of objects
E_ERROR_MULTICAM_INVALID_HANDLE
14112 The specified operation could not complete - Check the camera connection and settings
E_ERROR_MULTICAM_TIMEOUT
14114 The specified value is not in the range allowed by the parameter
E_ERROR_MULTICAM_RANGE_ERROR
14115 The current hardware configuration does not allow the requested operation
E_ERROR_MULTICAM_BAD_HW_CONFIG
14117 A license is needed to use the specified processor - Contact the Sales department to obtain a
license
E_ERROR_MULTICAM_LICENSE_NOT_GRANTED
599
14118 An unrecoverable error occurred - The object must be deleted and created again
E_ERROR_MULTICAM_FATAL_ERROR
14119 The value for the parameter is not allowed by the hardware - Change it slightly.
E_ERROR_MULTICAM_HW_EVENT_CONFLICT
14120 The specified file cannot be found - Check the drive, path and file name
E_ERROR_MULTICAM_FILE_NOT_FOUND
600
Appendix
601
32765 Cannot trace errors because of a system failure - Contact Technical Support
E_ERROR_CANNOT_TRACE_ERRORS
602
Appendix
3.
Symbol Size
Rows
Numeric
Alphanumeric
Byte
11
12
13
24
16
10
15
37
25
16
17
53
35
23
19
72
48
31
21
92
61
40
23
115
76
50
25
140
93
61
27
168
112
73
29
197
131
86
31
229
153
100
33
264
176
115
35
300
200
131
37
339
226
148
39
380
253
166
41
424
282
185
43
469
313
205
45
500
345
226
47
560
378
248
49
596
413
271
603
ECC 050
604
Data Capacity
Symbol Size
Rows
Numeric
Alphanumeric
Byte
11
Not possible
13
10
15
20
13
17
32
21
14
19
46
30
20
21
61
41
27
23
78
52
34
25
97
65
42
27
118
78
51
29
140
93
61
31
164
109
72
33
190
126
83
35
217
145
95
37
246
164
108
39
277
185
121
41
310
206
135
43
344
229
150
45
380
253
166
47
418
278
183
49
457
305
200
Appendix
ECC 080
Data Capacity
Symbol Size
Rows
Numeric
Alphanumeric
Byte
13
15
13
17
24
16
10
19
36
24
16
21
50
33
22
23
65
43
28
25
82
54
36
27
100
67
44
29
120
80
52
31
141
94
62
33
164
109
72
35
188
125
82
37
214
143
94
39
242
161
106
41
270
180
118
43
301
201
132
45
333
222
146
47
366
244
160
49
402
268
176
605
ECC 100
606
Data Capacity
Symbol Size
Rows
Numeric
Alphanumeric
Byte
13
Not possible
15
17
16
11
19
25
17
11
21
36
24
15
23
47
31
20
25
60
40
26
27
73
49
32
29
88
59
38
31
104
69
45
33
121
81
53
35
140
93
61
37
159
106
69
39
180
120
78
41
201
134
88
43
224
149
98
45
248
165
108
47
273
182
119
49
300
200
131
Appendix
ECC 140
Data Capacity
Symbol Size
Rows
Numeric
Alphanumeric
Byte
17
19
21
12
23
17
11
25
24
16
10
27
30
20
13
29
38
25
16
31
46
30
20
33
54
36
24
35
64
42
28
37
73
49
32
39
84
56
36
41
94
63
41
43
106
70
46
45
118
78
51
47
130
87
57
49
144
96
63
607
ECC 200
608
Data Capacity
Symbol Size
Rows
Numeric
Alphanumeric
Byte
10
12
10
14
16
10
16
24
16
10
18
36
25
16
20
44
31
20
22
60
43
28
24
72
52
34
26
88
64
42
32
124
91
60
36
172
127
84
40
228
169
112
44
288
214
142
48
348
259
172
52
408
304
202
64
560
418
278
72
736
550
366
80
912
682
454
88
1152
862
574
96
1392
1042
694
104
1632
1222
814
120
2100
1573
1048
132
2608
1954
1302
144
3116
2335
1556
Appendix
Symbol Size
Data Capacity
Rows
Columns
Numeric
Alphanumeric
Byte
18
10
32
20
13
12
26
32
22
14
12
36
44
31
20
16
36
64
46
30
16
48
98
72
47
609
4.
This informational topic is taken from the AIM "Internaltional Symbology Specification - Data Matrix".
(...)
N.2.2 Symbol Contrast
Within the gray-scale image, all of the image pixels which fall within the area of the test symbol, extending
outward to the limits of any required quiet zones, shall be sorted by their reflectance values to select the
darkest 10% of the pixels and the lightest 10% of the pixels. Calculate the arithmetic mean of the
reflectance of the darkest 10% and the arithmetic mean of the reflectance of the lightest 10%. The
difference of the two means is the Symbol Contrast, SC.
The Symbol Contrast grade is determined by
A (4.0) if SC> 70%
B (3.0) if SC> 55%
C (2.0) if SC> 40%
D (1.0) if SC> 20%
F (0.0) if SC< 20%
Symbol Contrast tests that the two reflective states in the symbol, namely light and dark, are sufficiently
and consistently distinct throughout the symbol.
N.2.3 "Print" Growth
Calculate a reflectance threshold halfway between the dark and light means from Annexe N.2.2. Create a
secondary binary image distinguishing dark and light regions using the threshold.
The print growth parameter, the extent to which dark or light markings appropriately fill their module
boundaries, is an important indication of process quality which affects reading performance. The particular
graphical structures most indicative of element growth or shrinkage from nominal dimensions will vary
widely between symbologies, and shall be defined within their specifications, but will generally be either
fixed structures or isolated elements whose dimension(s) D is/are determined by counting pixels in the
binary digitized image. More than one dimension, for example both horizontal and vertical growth, may be
specified and checked independently. Each checked dimension shall have specified both a nominal value
DNOM and maximum DMAX and minimum DMIN allowed values. Each measured D shall be normalized to its
corresponding nominal and limit values:
D' = (D - DNOM) / (DMAX - DNOM) if D > DNOM
= (D - DNOM) / (DNOM - DMIN) otherwise.
Print growth is then graded according to:
A (4.0) if -0.50 <= D' <= 0.50
B (3.0) if -0.70 <= D' <= 0.70
C (2.0) if -0.85 <= D' <= 0.85
D (1.0) if -1.00 <= D' <= 1.00
F (0.0) if D' < -1.00 or D' > 1.00
Print Growth tests that the graphical features comprising the symbol have not grown or shrunk from
nominal so much as to hinder readability with less optimum imaging conditions than the test condition.
N.2.4 Axial Nonuniformity
2D matrix symbols include data fields of modules nominally lying in a regular polygonal grid, and any
reference decode algorithm must adaptively map the enter positions of those modules to extract the data.
Axial Nonuniformity measures and grades the spacing of the mapping centers, i.e. the sampling points, in
the direction of each of the grid's major axes.
The spacings between adjacent sampling points are independently sorted for each polygonal axis, then
the average spacing XAVG along each axis is computed. Axial Nonuniformity is a measure of how much the
sampling point spacing differs from one axis to another, namely:
610
Appendix
Grade
Reference
Decode
Symbol Contrast
"Print" Growth
Axial
Nonuniformity
Unused Error
Correction
A (4.0)
Passes
SC >= 70%
-0.50<=D'<=0.50
AN <= 0.06
B (3.0)
SC >= 55%
-0.70<=D'<=0.70
AN <= 0.08
C (2.0)
SC >= 40%
-0.85<=D'<=0.85
AN <= 0.10
D (1.0)
SC >= 20%
-1.00<=D'<=1.00
AN <= 0.12
SC < 20%
AN > 0.12
F (0.0)
Fails
611
Index
A
AddArray......................................................507
AddChar (EOCR).........................................339
AddElement ...................................................62
AddImage ......................................................71
AddImageData...............................................71
AddImages ....................................................72
AdditionalSymbologies, Get/Set (EBarCode)455
AddLandmark ..............................................537
AddPathName (EChecker) ..........................443
AddPatternFromImage (EOCR) ..................345
AddPoint ......................................................536
AddSkipRange.............................................275
AdjustCharsLocationRanges .......................424
AdjustCharsQualityRanges .........................425
AdjustGainOffset .........................................196
AdjustShiftTolerances..................................426
AdjustTextsLocationRanges........................424
AdjustTextsQualityRanges ..........................424
AnalyseObjects (ECodedImage) .................229
Angle......................................................91, 363
Angle (FoundPattern) ..................................363
Angle (MatrixCode)......................................468
AngleBias.....................................................358
Average....................................................... 109
Average....................................................... 109
Average....................................................... 164
Average....................................................... 164
Average, Get (EChecker) ........................... 441
AverageSamples, GetNum (EChecker)...... 446
613
B
b
CIE L*a*b* Color System ................................ 573
b 573
BatchLearn (EChecker) ...............................444
BGA_ALL_QUALITIES................................527
BGA_BAD_BALL_COLOR ..........................527
BGA_BAD_BALL_DIAMETER ....................527
BGA_BAD_BALL_OFFSET.........................527
BGA_BAD_BALL_PITCH ............................527
BGA_BAD_BALL_SHAPE...........................527
BGA_CIRCULARITY_QUALITY .................527
BGA_CLUTTER ..........................................527
BGA_DIAGNOSTICS ..................................527
BGA_DIAMETER_QUALITY .......................527
BGA_MISSING_BALLS...............................527
BGA_OFFSET_QUALITY ...........................527
BGA_PER_BATCH_QUALITY ....................527
BGA_PITCH_QUALITY...............................527
BGA_SYMMETRY_2H ................................527
BGA_SYMMETRY_2V ................................527
BGA_SYMMETRY_4...................................527
BGA_SYMMETRY_8...................................527
BGA_SYMMETRY_NONE ..........................527
Black ............................................................573
BlackClass, Get/Set (ECodedImage) ..........224
BlackTopHat
ImgBlackTopHatBox ....................................... 145
ImgBlackTopHatDisk ...................................... 146
BlackTopHat ................................................145
BlackTopHat ................................................146
BlankFeatures .............................................250
Blob
BuildLabeledObjects....................................... 228
BuildObjects ................................................... 228
Blob..............................................................228
Blob..............................................................228
Blue
RGB Color System ......................................... 575
Blue..............................................................575
Board ...........................................................559
BoardList......................................................565
BOOL.............................................................12
614
C
Calibrate.............................................. 197, 534
CalibrationSucceeded................................. 534
Center ......................................................... 363
Center (FoundPattern)................................ 363
Center (MatrixCode) ................................... 468
Channel....................................................... 560
Char, Match (EOCR) .................................. 340
CharGetDstX (EOCR)................................. 342
CharGetDstY (EOCR)................................. 342
CharGetHeight (EOCR) .............................. 343
CharGetOrgX (EOCR) ................................ 342
CharGetOrgY (EOCR) ................................ 342
CharGetTotalDstX (EOCR)......................... 343
CharGetTotalDstY (EOCR)......................... 344
CharGetTotalOrgX (EOCR) ........................ 343
CharGetTotalOrgY (EOCR) ........................ 343
CharGetWidth (EOCR) ............................... 343
Chars, Empty (EOCR) ................................ 339
Chars, FindAll (EOCR) ............................... 340
Chars, GetNum (EOCR) ............................. 342
CharSpacing, Get/Set (EOCR) ................... 333
CheckOemKey.............................................. 93
Chroma
CIE LCH Color System ................................... 573
Close........................................................... 141
Index
Close............................................................142
CloseFile........................................................70
ClrAssignNearestClass................................212
ClrAssignNearestClassCenter.....................212
ClrBayerToC24............................................210
ClrC24ToBayer............................................211
ClrClassAverages........................................213
ClrClassVariances .......................................214
ClrCompose.................................................204
ClrDecompose.............................................204
ClrDequantize..............................................203
ClrFormat422To444 ....................................209
ClrFormat444To422 ....................................209
ClrGetComponent........................................204
ClrGetDstQuantization.................................208
ClrGetRGBStandard....................................208
ClrGetSrcQuantization.................................208
ClrImproveClassCenters .............................213
ClrISHToRGB ......................................200, 201
ClrLABToRGB .....................................200, 201
ClrLABToXYZ ......................................200, 201
ClrLCHToRGB.....................................200, 201
ClrLSHToRGB .....................................200, 201
ClrLUVToRGB .....................................200, 201
ClrLUVToXYZ......................................200, 201
ClrPseudoColor ...........................................207
ClrQuantize..................................................202
ClrRegisterPlanes........................................205
ClrRGBToISH ......................................200, 201
ClrRGBToLAB .....................................200, 201
ClrRGBToLCH.....................................200, 201
ClrRGBToLSH .....................................200, 201
ClrRGBToLUV .....................................200, 201
ClrRGBToReducedXYZ.......................200, 201
ClrRGBToVSH.....................................200, 201
ClrRGBToXYZ .....................................200, 201
ClrRGBToYIQ......................................200, 201
ClrRGBToYSH.....................................200, 201
ClrRGBToYUV.....................................200, 201
ClrSetComponent ........................................205
ClrSetDstQuantization .................................208
ClrSetRGBStandard ....................................208
ClrSetSrcQuantization .................................208
ClrTransform................................................206
ClrTransformBayer ......................................207
615
Convolution..................................................128
Convolution..................................................128
Convolution..................................................129
Convolution..................................................129
Convolution..................................................130
Convolution..................................................130
Convolution..................................................131
Convolution..................................................131
Convolution..................................................131
Convolution..................................................132
Convolution..................................................132
Convolution..................................................133
Convolution..................................................133
Convolution..................................................133
Convolution..................................................134
Convolution..................................................134
Convolution..................................................135
Convolution..................................................135
Convolution..................................................135
Convolution..................................................136
Convolution..................................................136
Convolution..................................................137
Convolution..................................................137
Convolution..................................................177
Copy, CreatePattern (EMatch) ....................374
CopyTo ..................................................15, 264
CopyTo (EMatch) ........................................373
Corners[4] (MatrixCode) ..............................468
CorrelationMode, Get/Set (EMatch) ............376
CreatePatternCopy (EMatch) ......................374
616
CreateSurface............................................. 568
CreateTemplateChars ................................ 409
CreateTemplateObjects.............................. 408
CreateTemplateTexts ................................. 410
CurrentObjData, Get (ECodedImage) ........ 237
CurrentObjPtr, Get (ECodedImage) ........... 238
CurrentRunData, Get (ECodedImage) ....... 245
CurrentRunPtr, Get (ECodedImage) .......... 246
CutLargeChars, Get/Set (EOCR) ............... 336
D
DarkGray, Get (EChecker) ......................... 442
Data Types, Predefined ................................ 12
DATA_SIZE, enum ....................................... 94
DATA_TYPE, enum...................................... 94
Decode (EBarCode) ................................... 452
DecodedAngle, Get (EBarCode) ................ 454
DecodedDirection, Get (EBarCode) ........... 454
DecodedRectangle, Get (EBarCode) ......... 455
DecodedString (MatrixCode) ...................... 468
DecodedSymbologies, GetNum (EBarCode)453
DecodedSymbology, Get (EBarCode)........ 453
DegreesOfFreedom, Get/Set (EChecker) .. 441
DeleteTemplateChars................................. 410
DeleteTemplateObjects .............................. 408
DeleteTemplateTexts.................................. 411
Destructor (EBarCode) ............................... 452
Detach................................................... 24, 266
DetachDaughters ........................................ 318
Detect (EBarCode) ..................................... 452
Deviation, Get (EChecker).......................... 441
DeviationSamples, GetNum (EChecker) .... 446
Device context ............................................ 574
Dilate
ImgDilateBox...................................................142
ImgDilateDisk .................................................. 143
Dilate........................................................... 142
Dilate........................................................... 143
DisableBehaviorFilter.................................. 506
DisableInnerFiltering (ECircleGauge)......... 298
DisableInnerFiltering (ERectangleGauge).. 305
Distance .............................................. 149, 279
DO_NOT_RECTIFY ................................... 184
DontCareThreshold, Get/Set (EMatch) ...... 375
DoubleThreshold......................................... 120
Index
Drag
EROI................................................................. 18
Drag ...............................................................18
Drag .............................................................281
Drag .............................................................445
Drag (EBarCode).........................................459
Drag (EChecker)..........................................445
DraggingMode .............................................283
Draw
EBGA.............................................................. 504
EImage... .......................................................... 36
EImage/ROI...................................................... 16
EVectorTemplate.............................................. 62
Draw ..............................................................16
Draw ..............................................................36
Draw ..............................................................62
Draw ............................................................280
Draw ............................................................364
Draw ............................................................364
Draw ............................................................444
Draw ............................................................504
Draw ............................................................548
Draw (EBarCode) ........................................459
Draw (EChecker) .........................................444
Draw (FoundPattern) ...................................364
Draw (MatrixCode) ......................................473
DrawChar (EOCR).......................................349
DrawChars (EOCR).....................................349
DrawClutter..................................................503
DrawCrossGrid ............................................548
DrawDiagonals, Get/Set (ECodedImage) ...234
DrawErrors (MatrixCode).............................473
DrawExtraBalls ............................................503
DrawFrame ....................................................17
DrawGrid......................................................548
DrawModel ..................................................361
DrawnFeatures (ECodedImage) .................237
DrawObject (ECodedImage) .......................235
DrawObjectFeature (ECodedImage)...........236
DrawObjects (ECodedImage) .....................234
DrawObjectsFeature (ECodedImage) .........235
DrawPackages ............................................503
DrawPosition (EMatch)................................383
DrawPositions (EMatch) ..............................384
DrawTemplateChars....................................402
DrawTemplateObjects .................................402
DrawTemplateTexts.................................... 403
DrawTemplateTextsChars .......................... 403
DrawText..................................................... 404
DrawTextChars ........................................... 404
DrawTexts................................................... 404
DrawTextsChars ......................................... 405
Dump (EOCR)............................................. 348
Dump (EOCV)............................................. 402
E
E...Gauge Get/Set Active............................ 267
E...Gauge Get/Set DraggingMode.............. 283
E...Gauge Get/Set Labeled......................... 267
E...Gauge Get/Set OptionalDraw................ 268
E...Gauge Get/Set QuickDraw.................... 268
E...Gauge Process...................................... 272
E_1_BIT_DATA ............................................ 94
E_1_BIT_PER_PIXEL .................................. 94
E_16_BIT_DATA .......................................... 94
E_16_BITS_PER_PIXEL.............................. 94
E_24_BIT_DATA .......................................... 94
E_24_BITS_PER_PIXEL.............................. 94
E_32_BIT_DATA .......................................... 94
E_32_BITS_PER_PIXEL.............................. 94
E_64_BIT_DATA .......................................... 94
E_64_BITS_PER_PIXEL.............................. 94
E_8_BIT_DATA ............................................ 94
E_8_BITS_PER_PIXEL................................ 94
E_ANGLE_UNIT_DEGREES ....................... 94
E_ANGLE_UNIT_GRADES.......................... 94
E_ANGLE_UNIT_RADIANS......................... 94
E_ANGLE_UNIT_REVOLUTIONS ............... 94
E_ANGLE_UNITS ........................................ 94
E_BLACK_SKELET_KRNL ........................ 185
E_BW1.......................................................... 97
E_BW16........................................................ 97
E_BW32........................................................ 97
E_BW8.......................................................... 97
E_C15 ........................................................... 97
E_C16 ........................................................... 97
E_C24 ........................................................... 97
E_C24A......................................................... 97
E_COLOR_QUANTIZATION...................... 216
E_COLOR_QUANTIZATION_CCIR_601... 216
E_COLOR_QUANTIZATION_FULL_RANGE216
617
E_COLOR_SYSTEM...................................215
E_COLOR_SYSTEM_BILEVEL ..................215
E_COLOR_SYSTEM_GRAY_LEVEL .........215
E_COLOR_SYSTEM_ISH...........................215
E_COLOR_SYSTEM_LAB..........................215
E_COLOR_SYSTEM_LABELIZED .............215
E_COLOR_SYSTEM_LCH .........................215
E_COLOR_SYSTEM_LSH..........................215
E_COLOR_SYSTEM_LUV..........................215
E_COLOR_SYSTEM_NONE ......................215
E_COLOR_SYSTEM_RGB.........................215
E_COLOR_SYSTEM_VSH .........................215
E_COLOR_SYSTEM_XYZ..........................215
E_COLOR_SYSTEM_YIQ ..........................215
E_COLOR_SYSTEM_YSH .........................215
E_COLOR_SYSTEM_YUV .........................215
E_COMPLEX64.............................................97
E_CORRELATION_MODE, enum ..............388
E_DATA_TYPE_FLOAT................................94
E_DATA_TYPE_SIGNED_INT .....................94
E_DATA_TYPE_UNSIGNED_INT ................94
E_EDGE_KRNL ..........................................185
E_ERROR ...................................................582
E_FILE_FORMAT_AUTO .............................96
E_FILE_FORMAT_BILEVEL_BMP...............96
E_FILE_FORMAT_BILEVEL_TIFF ...............96
E_FILE_FORMAT_BMP................................96
E_FILE_FORMAT_COLOR_BMP.................96
E_FILE_FORMAT_COLOR_JPEG ...............96
E_FILE_FORMAT_COLOR_TIFF.................96
E_FILE_FORMAT_GRAY_LEVEL_BMP ......96
E_FILE_FORMAT_GRAY_LEVEL_JPEG ....96
E_FILE_FORMAT_GRAY_LEVEL_TIFF ......96
E_FILE_FORMAT_JPEG ..............................96
E_FILE_FORMAT_PACKED_BILEVEL_TIFF96
E_FILE_FORMAT_PACKED_GRAY_LEVEL_TI
FF...............................................................96
E_FILE_FORMAT_TIFF................................96
E_FRAME_INSIDE........................................95
E_FRAME_ON ..............................................95
E_FRAME_OUTSIDE....................................95
E_FRAME_POSITION ..................................95
E_HANDLE_EAST ........................................95
E_HANDLE_INSIDE......................................95
E_HANDLE_NONE .......................................95
618
E_HANDLE_NORTH .................................... 95
E_HANDLE_NORTH_EAST......................... 95
E_HANDLE_NORTH_WEST........................ 95
E_HANDLE_SOUTH .................................... 95
E_HANDLE_SOUTH_EAST......................... 95
E_HANDLE_SOUTH_WEST........................ 95
E_HANDLE_WEST ...................................... 95
E_HANDLES................................................. 95
E_HIGHPASS1_KRNL ............................... 185
E_HIGHPASS2_KRNL ............................... 185
E_IMAGE_TYPES ........................................ 97
E_INFO ....................................................... 582
E_LAPLACIAN4_KRNL .............................. 185
E_LAPLACIAN8_KRNL .............................. 185
E_LOWPASS1_KRNL ................................ 185
E_LOWPASS2_KRNL ................................ 185
E_LOWPASS3_KRNL ................................ 185
E_MATCH_GAIN_NORMALIZED .............. 388
E_MATCH_NORMALIZED ......................... 388
E_MATCH_OFFSET_NORMALIZED......... 388
E_MATCH_SEMI_NORMALIZED .............. 388
E_MATCH_STANDARD............................. 388
E_PREWITX_KRNL ................................... 185
E_PREWITY_KRNL ................................... 185
E_RGB_STANDARD.................................. 215
E_RGB_STANDARD_NTSC ...................... 215
E_RGB_STANDARD_PAL ......................... 215
E_RGB_STANDARD_SMPTE ................... 215
E_SELECTED_ANY ..................................... 95
E_SELECTED_FALSE ................................. 95
E_SELECTED_TRUE................................... 95
E_SELECTION_MODE ................................ 95
E_SOBELX_KRNL ..................................... 185
E_SOBELY_KRNL ..................................... 185
E_STATE ...................................................... 97
E_STATE_ACTIVE....................................... 97
E_STATE_INACTIVE ................................... 97
E_TRACE_DISPLAY_FULL_MESSAGE ..... 95
E_TRACE_DISPLAY_MESSAGE ................ 95
E_TRACE_MODE......................................... 95
E_TRACE_SILENT....................................... 95
E_UNIT_CM.................................................. 94
E_UNIT_DAM ............................................... 94
E_UNIT_DM.................................................. 94
E_UNIT_FOOT ............................................. 94
Index
E_UNIT_HM ..................................................94
E_UNIT_INCH ...............................................94
E_UNIT_KM ..................................................94
E_UNIT_M .....................................................94
E_UNIT_MIL..................................................94
E_UNIT_MILE ...............................................94
E_UNIT_MM..................................................94
E_UNIT_UM ..................................................94
E_UNIT_UNKNOWN.....................................94
E_UNIT_YARD..............................................94
E_UNKNOWN ...............................................97
E_VECT_TYPE_CONTOUR .........................97
E_VECT_TYPE_HIST ...................................97
E_VECT_TYPE_LUT_FLOAT32...................97
E_VECT_TYPE_LUT_UINT8 ........................97
E_VECT_TYPE_MEASURE .........................97
E_VECT_TYPE_PEAK..................................97
E_VECT_TYPE_SEG....................................97
E_WHITE_SKELET_KRNL .........................185
Easy Introduction.............................................5
EasyBarCode Introduction...........................451
EasyFind Introduction..................................355
EasyGauge..................................................263
EasyMatch Introduction ...............................369
EasyMatrixCode Introduction ......................465
EasyMatrixCode Introduction to classes .....467
EasyMultiCam .....................................555, 556
EasyOCR Introduction.................................329
EBarCode Constructor ................................452
EBarCode Decode.......................................452
EBarCode Destructor ..................................452
EBarCode Detect.........................................452
EBarCode Drag ...........................................459
EBarCode Draw...........................................459
EBarCode Get/Set AdditionalSymbologies .455
EBarCode Get/Set KnownLocation .............456
EBarCode Get/Set KnownModule...............456
EBarCode Get/Set Module ..........................456
EBarCode Get/Set ReadingAngle ...............459
EBarCode Get/Set StandardSymbologies ..455
EBarCode Get/Set ThicknessRatio .............457
EBarCode Get/Set VerifyChecksum ...........457
EBarCode GetDecodedAngle .....................454
EBarCode GetDecodedDirection ................454
EBarCode GetDecodedRectangle ..............455
EChecker EmptyPathNames.......................443
EChecker Get/Set DegreesOfFreedom.......441
EChecker Get/Set Normalize ......................441
EChecker Get/Set RelativeTolerance .........443
EChecker GetAverage.................................441
EChecker GetDarkGray...............................442
EChecker GetDeviation ...............................441
EChecker GetHitHandle ..............................444
EChecker GetHitRoi ....................................444
EChecker GetLightGray ..............................442
EChecker GetNumAverageSamples...........446
EChecker GetNumDeviationSamples .........446
EChecker GetPanX/Y..................................445
EChecker GetSrcImage...............................440
EChecker GetToleranceX/Y ........................440
EChecker GetZoomX/Y ...............................445
EChecker HitTest ........................................444
EChecker Introduction .................................439
EChecker Learn...........................................442
EChecker Load............................................446
EChecker Overview.....................................440
EChecker Register ......................................442
EChecker Save............................................446
EChecker SetPan ........................................445
EChecker SetTolerance ..............................441
EChecker SetZoom .....................................445
ECircleGauge
Set .............................................................. 294
ECircleGauge ..............................................292
ECircleGauge Constructor...........................293
ECloseImageDC............................................89
ECodedImage AnalyseObjects ...................229
ECodedImage BlankFeatures .....................250
ECodedImage BuildHoles ...........................241
ECodedImage BuildLabeledObjects ...........228
ECodedImage BuildLabeledRuns ...............244
ECodedImage BuildObjects ........................228
ECodedImage BuildRuns ............................244
ECodedImage Construction ........................224
ECodedImage DrawnFeatures....................237
ECodedImage DrawObject..........................235
ECodedImage DrawObjectFeature .............236
ECodedImage DrawObjects ........................234
ECodedImage DrawObjectsFeature ...........235
ECodedImage FeatureAverage...................230
620
Index
ECodedImage GetNumHoles......................241
ECodedImage GetNumObjectRuns ............248
ECodedImage GetNumObjects...................239
ECodedImage GetNumRuns.......................248
ECodedImage GetNumSelectedObjects.....231
ECodedImage GetObjDataPtr .....................239
ECodedImage GetObjectData.....................239
ECodedImage GetObjectFeature................249
ECodedImage GetObjFirstRunPtr...............248
ECodedImage GetObjLastRunPtr ...............240
ECodedImage GetObjPtr.............................239
ECodedImage GetObjPtrByCoordinates.....240
ECodedImage GetObjPtrByPos ..................240
ECodedImage GetPreviousObjData ...........238
ECodedImage GetPreviousObjPtr ..............238
ECodedImage GetPreviousRunData ..........245
ECodedImage GetPreviousRunPtr .............247
ECodedImage GetRunData ........................247
ECodedImage GetRunDataPtr....................247
ECodedImage GetRunPtr............................249
ECodedImage GetRunPtrByCoordinates....249
ECodedImage GetTrueThreshold ...............227
ECodedImage GetYOriginOffset .................253
ECodedImage IsHole ..................................241
ECodedImage IsObjectSelected .................231
ECodedImage ObjectConvexHull................230
ECodedImage Overview..............................224
ECodedImage RemoveAllFeats ..................252
ECodedImage RemoveAllObjects...............240
ECodedImage RemoveAllRuns...................249
ECodedImage RemoveHoles......................244
ECodedImage RemoveObject.....................240
ECodedImage RemoveRun ........................249
ECodedImage SelectAllObjects ..................231
ECodedImage SelectHoles .........................243
ECodedImage SelectObject ........................232
ECodedImage SelectObjectsUsingFeature.233
ECodedImage SelectObjectsUsingPosition 233
ECodedImage SetFeatInfo ..........................252
ECodedImage SetLastRunPtr .....................246
ECodedImage SetNumSelectedObjects .....231
ECodedImage SetThresholdImage .............227
ECodedImage SortObjectsUsingFeature ....234
ECodedImage UnselectAllObjects ..............232
ECodedImage UnselectHoles .....................243
EImage/ROI... ............................................... 15
EImageBW1.................................................. 33
EImageBW16................................................ 37
EImageBW8............................................ 34, 35
EImageC15 ............................................. 42, 43
EImageC16 ................................................... 44
EImageC24 ................................................... 39
EImageC24A........................................... 40, 41
EImageSequence ................................... 68, 69
EISH............................................................ 576
EJpegHandler ............................................... 80
EKernel ....................................................... 103
ELAB........................................................... 576
ELCH .......................................................... 576
ELineGauge
Set............................................................... 289
621
EMatch CopyTo...........................................373
EMatch CreatePatternCopy.........................374
EMatch DrawPosition ..................................383
EMatch DrawPositions ................................384
EMatch Get/Set ContrastMode ...................376
EMatch Get/Set CorrelationMode ...............376
EMatch Get/Set DontCareThreshold...........375
EMatch Get/Set FilteringMode ....................375
EMatch Get/Set FinalReduction ..................377
EMatch Get/Set InitialMinScore ..................378
EMatch Get/Set Interpolate .........................376
EMatch Get/Set MaxAngle ..........................380
EMatch Get/Set MaxInitialPositions ............378
EMatch Get/Set MaxPositions.....................377
EMatch Get/Set MaxScale ..........................380
EMatch Get/Set MaxScaleX ........................381
EMatch Get/Set MaxScaleY ........................382
EMatch Get/Set MinAngle ...........................379
EMatch Get/Set MinReducedArea ..............374
EMatch Get/Set MinScale ...........................380
EMatch Get/Set MinScaleX .........................381
EMatch Get/Set MinScaleY .........................381
EMatch Get/Set MinScore ...........................378
EMatch Get/Set PixelDimensions ...............379
EMatch GetAngleStep .................................382
EMatch GetNumPositions ...........................383
EMatch GetNumReductions ........................377
EMatch GetPatternHeight............................376
EMatch GetPatternWidth.............................376
EMatch GetPosition.....................................383
EMatch GetScaleStep .................................382
EMatch GetScaleX/YStep ...........................382
EMatch GetVersion .....................................386
EMatch IsPatternLearnt...............................373
EMatch LearnPattern...................................373
EMatch Load ...............................................384
EMatch Match..............................................374
EMatch Operator= .......................................373
EMatch Overview ........................................372
EMatch Save ...............................................385
EMatch SetExtension ..................................383
EMatchPosition Class Members .................387
EMovingAverage .........................................107
Empty.............................................................63
EmptyChars (EOCR) ...................................339
622
enum Flipping
Type ............................................................ 482
enum IMAGE_FILE_TYPES......................... 96
enum IMG_HISTOGRAM_FEATURE ........ 183
enum IMG_REFERENCE_NOISE.............. 184
enum IMG_THRESHOLD_MODES............ 184
enum INS_CALIBRATION_MODES........... 550
enum INS_DRAGGING_MODES ............... 324
enum INS_DRAWING_MODES ......... 321, 527
enum INS_HANDLES................................. 321
enum INS_SHAPE_BEHAVIOR ................. 324
Index
enum INS_SHAPE_TYPES.........................321
enum KERNEL_RECTIFIER .......................184
enum KERNEL_ROTATION........................185
enum KERNEL_TYPE.................................185
enum LearnParams
Type............................................................ 481
enum LogicalSize
Type............................................................ 481
enum MCH_CONTRAST_MODE................388
enum MCH_FILTERING_MODE.................388
enum OBJECT_CONNEXITY .....................255
enum OBJECT_FEATURES .......................255
enum OCR_MATCHING_MODES ..............351
enum OCR_SHIFTING_MODES ................351
enum OCRClasses......................................350
enum OCRColor ..........................................350
enum OCRSegmentationMode ...................351
enum OCV_CHAR_CREATION_MODES...434
enum OCV_DEGREES_OF_FREEDOM ....447
enum OCV_DIAGNOSTICS ........................434
enum OCV_DRAWING_MODE ..................447
enum OCV_LEARNING_MODE .................447
enum OCV_LOCATION_MODE .................434
enum OCV_NORMALIZATION_MODE ......447
enum OCV_QUALITY_INDICATORS .........434
enum ROI_HIT ............................................447
enum RUN_TYPE .......................................256
enum SELECT_BY_POSITION ..................257
enum SELECT_OPTIONS ..........................257
enum SORT_OPTIONS ..............................257
enum VECT_TYPE........................................97
EObjectData ................................................258
EOCR AddChar ...........................................339
EOCR AddPatternFromImage.....................345
EOCR BuildObjects .....................................340
EOCR CharGetDstX....................................342
EOCR CharGetDstY....................................342
EOCR CharGetHeight .................................343
EOCR CharGetOrgX ...................................342
EOCR CharGetOrgY ...................................342
EOCR CharGetTotalDstX............................343
EOCR CharGetTotalDstY............................344
EOCR CharGetTotalOrgX ...........................343
EOCR CharGetTotalOrgY ...........................343
EOCR CharGetWidth ..................................343
Erode ...........................................................143
Erode ...........................................................144
EROI... Draw .................................................50
EROIBW1 ................................................46, 47
EROIBW16 ..............................................51, 52
EROIBW8 ................................................48, 49
EROIC15 .................................................57, 58
EROIC16 .................................................59, 60
EROIC24 .................................................53, 54
EROIC24A...............................................55, 56
Errors .........................................86, 87, 88, 582
ERunData ....................................................259
ESerializer
Overview........................................................... 76
ESetAngleUnit ...............................................91
ESetJpegQuality............................................84
ESetRecursiveCopyBehavior ........................85
ESetTiffThreshold..........................................83
ESetTraceMode.............................................87
EStartTiming..................................................92
EStopTiming ..................................................92
624
ESuccess ...................................................... 87
eTextsSelectionMode ................................. 417
EToRadians .................................................. 92
ETrace .......................................................... 87
ETraceR........................................................ 88
ETraceRS ..................................................... 88
EVectorTemplate Overview .......................... 61
EVSH .......................................................... 576
EWedgeGauge
Set............................................................... 308
F
Family
Type, enum .................................................482
Index
ObjContourArea.............................................. 254
ObjContourGravityCenter ............................... 254
ObjContourInertia ........................................... 254
FoundPattern Angle.....................................363
FoundPattern Center ...................................363
FoundPattern Draw .....................................364
FoundPattern Overview...............................363
FoundPattern Scale.....................................363
FoundPattern Score ....................................363
FOURCC .....................................................574
Frame ..................................................179, 180
Free .............................................................564
G
Gain ............................................................ 114
GatherTextsCharsParameters.................... 416
GatherTextsParameters ............................. 413
Get DraggingMode ..................................... 283
Get Inner/Outer Apex.................................. 311
Get Inner/Outer ArcLength ......................... 310
Get Inner/Outer Diameter ........................... 310
Get Inner/Outer End ................................... 313
Get Inner/Outer Org.................................... 312
Get Inner/Outer Radius............................... 310
Get Org/End................................................ 290
Get X/Y Resolution ..................................... 540
Get/Set Active ............................................. 267
Get/Set ActiveEdges................................... 314
Get/Set ActualShape .................................. 273
Get/Set AdditionalSymbologies (EBarCode)455
Get/Set Angle.............................................. 303
Get/Set CalibrationModes........................... 542
Get/Set CharSpacing (EOCR) .................... 333
Get/Set CompareAspectRatio (EOCR) ...... 335
Get/Set ContrastMode (EMatch) ................ 376
Get/Set CorrelationMode (EMatch) ............ 376
Get/Set CutLargeChars (EOCR) ................ 336
Get/Set DegreesOfFreedom (EChecker) ... 441
Get/Set Diameter ........................................ 295
Get/Set Distortion........................................ 544
Get/Set DontCareThreshold (EMatch) ....... 375
Get/Set Dragable ........................................ 319
Get/Set DraggingMode ............................... 283
Get/Set FilteringMode................................. 375
Get/Set FilteringMode (EMatch) ................. 375
Get/Set FilteringThreshold.......................... 273
Get/Set FinalReduction (EMatch) ............... 377
Get/Set HVConstraint ................................. 274
Get/Set InitialMinScore (EMatch) ............... 378
Get/Set InnerFilteringThreshold (ECircleeGauge)
................................................................. 298
Get/Set InnerFilteringThreshold
(ERectangleGauge) ................................ 305
Get/Set Interpolate (EMatch) ...................... 376
Get/Set InverseColNumbering.................... 522
Get/Set InverseRowNumbering .................. 521
Get/Set KnownAngle .................................. 291
Get/Set KnownLocation (EBarCode) .......... 456
625
626
Index
GetBallDiameter ..........................................507
GetBallDiameterTolerance ..........................487
GetBallDoughnutnessTolerance .................489
GetBallOffsetXTolerance.............................488
GetBallOffsetYTolerance.............................488
GetBallPitchXTolerance ..............................488
GetBallPitchYTolerance ..............................488
GetBitsPerPixel .............................................31
GetBlackClass (ECodedImage) ..................224
GetBlobThreshold........................................490
GetBoardByBoardIdentifier..........................565
GetBoardByBoardName..............................565
GetBoardByDriverIndex...............................565
GetBoardByPciPosition ...............................566
GetBreadth ..................................................310
GetCenter ....................................................266
GetCenter X/Y .............................................541
GetCharSpacing (EOCR) ............................333
GetClosed......................................................61
GetCodecFourcc ...........................................74
GetColorSystem ............................................30
GetColorSystemIn .......................................195
GetColorSystemOut ....................................195
GetColPitch ...................................................28
GetComment .................................................29
GetCompareAspectRatio (EOCR)...............335
GetComponent ............................................511
GetComponentNumBalls.............................504
GetComponentPitchX..................................511
GetComponentPitchY..................................511
GetCompressionQuality ................................76
GetConfidenceRatio (EOCR) ......................344
GetConnexity (ECodedImage) ....................226
GetContrastMode (EMatch).........................376
GetCorners ..................................................313
GetCorrelationMode (EMatch) ....................376
GetCount ...............................................70, 566
GetCurrentArray ..........................................507
GetCurrentObjData (ECodedImage) ...........237
GetCurrentObjPtr (ECodedImage) ..............238
GetCurrentRunData (ECodedImage) ..........245
GetCurrentRunPtr (ECodedImage) .............246
GetCutLargeChars (EOCR).........................336
GetDarkGray (EChecker) ............................442
GetDataPtr
EVectorTemplate ..............................................62
GetDataPtr .................................................... 62
GetDataRate ................................................. 75
GetDate......................................................... 29
GetDaughter ............................................... 318
GetDecodedAngle (EBarCode) .................. 454
GetDecodedDirection (EBarCode) ............. 454
GetDecodedRectangle (EBarCode) ........... 455
GetDecodedSymbology (EBarCode).......... 453
GetDegreesOfFreedom (EChecker) ........... 441
GetDenomRate ............................................. 75
GetDeviation (EChecker)............................ 441
GetDeviationCircularity ............... 501, 518, 525
GetDeviationDiameter ................ 500, 517, 525
GetDeviationDoughnutness........ 502, 518, 526
GetDeviationOffset ..................... 498, 516, 524
GetDeviationPitch ....................... 499, 517, 524
GetDiagnostic ............................. 496, 514, 523
GetDiagnostics............................ 496, 514, 523
GetDirect..................................................... 313
GetDistortionStrength (EWorldShape) ....... 544
GetDistortionStrength2 (EWorldShape) ..... 544
GetDontCareThreshold (EMatch) ............... 375
GetDrawDiagonals (ECodedImage) ........... 234
GetEdges .................................................... 314
GetEnabledQualityDiagnostics ................... 495
GetEnabledQualityStatistics ....................... 495
GetEnd........................................................ 297
GetEndAngle............................................... 312
GetFeatArrayPtr (ECodedImage) ............... 250
GetFeatDataPtr (ECodedImage) ................ 251
GetFeatDataSize (ECodedImage).............. 251
GetFeatDataType (ECodedImage)............. 251
GetFeatNum (ECodedImage)..................... 251
GetFeatPtrByNum (ECodedImage) ............ 252
GetFeatSize (ECodedImage) ..................... 252
GetField Width/Height................................. 540
GetFilteringMode (EMatch)......................... 375
GetFinalReduction (EMatch) ...................... 377
GetFineBallMeasure ................................... 494
GetFineCircularity ....................................... 495
GetFirstCharCode (EOCR)......................... 344
GetFirstCharDistance (EOCR) ................... 344
GetFirstHole (ECodedImage) ..................... 242
GetFirstObjData (ECodedImage) ............... 237
627
628
GetMagnitude ............................................... 66
GetMatchingMode (EOCR)......................... 338
GetMaxAngle (EMatch) .............................. 380
GetMaxBlobArea......................................... 490
GetMaxCharHeight (EOCR) ....................... 333
GetMaxCharWidth (EOCR) ........................ 334
GetMaximumCircularity .............. 500, 518, 525
GetMaximumDiameter................ 499, 517, 525
GetMaximumDoughnutness ....... 501, 518, 525
GetMaximumOffset..................... 497, 516, 524
GetMaximumPitch ...................... 498, 517, 524
GetMaxInitialPositions (EMatch)................. 378
GetMaxMissingBalls ................................... 491
GetMaxObjects (ECodedImage)................. 229
GetMaxPositions (EMatch) ......................... 377
GetMaxScale (EMatch)............................... 380
GetMaxScaleX (EMatch) ............................ 381
GetMaxScaleY (EMatch) ............................ 382
GetMeasuredCircle..................................... 299
GetMeasuredCircularity .............................. 515
GetMeasuredDiameter ............................... 515
GetMeasuredDoughnutness....................... 515
GetMeasuredLine ....................................... 291
GetMeasuredOffsetX .................................. 515
GetMeasuredOffsetY .................................. 515
GetMeasuredPeak...................................... 279
GetMeasuredPitchX.................................... 515
GetMeasuredPitchY.................................... 515
GetMeasuredPoint...................................... 277
GetMeasuredRectangle.............................. 306
GetMeasuredWedge................................... 315
GetMidEdges .............................................. 313
GetMinAngle (EMatch) ............................... 379
GetMinBlobArea.......................................... 491
GetMinCharHeight (EOCR) ........................ 334
GetMinCharWidth (EOCR) ......................... 334
GetMinimumCircularity ............... 500, 517, 525
GetMinimumDiameter................. 499, 517, 524
GetMinimumDoughnutness ........ 501, 518, 525
GetMinimumOffset...................... 497, 516, 524
GetMinimumPitch ....................... 498, 516, 524
GetMinNumFitSamples............................... 275
GetMinReducedArea (EMatch)................... 374
GetMinScale (EMatch)................................ 380
GetMinScaleX (EMatch) ............................. 381
Index
GetNumTextChars...................................... 414
GetNumValidSamples ................................ 279
GetObjDataPtr (ECodedImage).................. 239
GetObjectData (ECodedImage).................. 239
GetObjectFeature ....................................... 249
GetObjFirstRunPtr (ECodedImage)............ 248
GetObjLastRunPtr (ECodedImage) ............ 240
GetObjPtr (ECodedImage) ......................... 239
GetObjPtrByCoordinates (ECodedImage).. 240
GetObjPtrByPos (ECodedImage) ............... 240
GetOffset..................................................... 105
GetOrg ........................................................ 297
GetOrgAngle ............................................... 311
GetOrgX........................................................ 23
GetOrgY........................................................ 23
GetOuterRoiDiameter ................................. 492
GetOutsideValue......................................... 106
GetPackageCenter X/Y .............................. 496
GetPackageName ...................................... 506
GetPanX/Y (EBarCode).............................. 460
GetPanX/Y (EChecker)............................... 445
GetPanX/Y (EWorldShape) ........................ 549
GetParam.................................................... 557
GetParent...................................................... 25
GetPatternBitmap (EOCR) ......................... 347
GetPatternClass (EOCR)............................ 347
GetPatternCode (EOCR) ............................ 347
GetPatternHeight (EMatch) ........................ 376
GetPatternHeight (EOCR) .......................... 348
GetPatternWidth (EMatch).......................... 376
GetPatternWidth (EOCR) ........................... 348
GetPixel ........................................................ 26
GetPixelDimensions
EImage/ROI... ...................................................31
GetPixelDimensions ..................................... 31
GetPixelDimensions (EMatch).................... 379
GetPlanesPerPixel........................................ 31
GetPoint ...................................................... 299
GetPosition (EMatch).................................. 383
GetPreviousObjData (ECodedImage) ........ 238
GetPreviousObjPtr (ECodedImage) ........... 238
GetPreviousRunData (ECodedImage) ....... 245
GetPreviousRunPtr (ECodedImage) .......... 247
GetProfilePeaks .......................................... 176
GetRatio...................................................... 541
629
Index
Green...........................................................575
H
Handles
Type, enum................................................. 482
Highpass......................................................129
Highpass......................................................129
HighThreshold, Get/Set (ECodedImage) ....225
Histogram
ImgAnalyseHistogram..................................... 156
ImgCumulateHistogram .................................. 155
ImgEqualize.................................................... 156
ImgHistogram ................................................. 155
ImgHistogramThreshold ................................. 121
ImgSetupEqualize .......................................... 157
Histogram ....................................................121
Histogram ....................................................155
Histogram ....................................................155
Histogram ....................................................156
Histogram ....................................................156
Histogram ....................................................157
HitChars (EOCR).........................................346
HitHandle, Get (EChecker)..........................444
HitRoi, Get (EChecker)................................444
HitTest
EROI................................................................. 17
HitTest ...........................................................17
HitTest .........................................................318
HitTest .........................................................444
HitTest (EBarCode) .....................................459
HitTest (EChecker) ......................................444
Hole .............................................................574
HoleParentObject, Get (ECodedImage)......242
Horizontal.....................................................151
Hue
CIE LCH Color System ................................... 573
ISH Color System ........................................... 574
LSH Color System .......................................... 575
Hue ..............................................................573
Hue ..............................................................574
Hue ..............................................................575
I
Image
EImageBW16 ....................................................37
EImageBW8 ......................................................34
EImageC15 .......................................................42
EImageC16 .......................................................44
EImageC24 .......................................................39
EImageC24A.....................................................40
Image ............................................................ 34
Image ............................................................ 37
Image ............................................................ 39
Image ............................................................ 40
Image ............................................................ 42
Image ............................................................ 44
Image pixel types .......................................... 12
Image types .................................................... 6
image/ROI................................................... 209
IMAGE_FILE_TYPES................................... 96
ImageToLineSegment ................................ 174
ImageToPath .............................................. 175
IMC_COMPARE ......................................... 182
IMG_ABSOLUTE_THRESHOLD................ 184
IMG_ADD.................................................... 182
IMG_AND.................................................... 182
IMG_AVERAGE.......................................... 182
IMG_AVERAGE_PIXEL_VALUE................ 183
IMG_BITWISE_AND................................... 182
IMG_BITWISE_NOT................................... 182
IMG_BITWISE_OR ..................................... 182
IMG_BITWISE_XOR .................................. 182
IMG_CONTOUR_ABOVE_THRESHOLD .. 183
IMG_CONTOUR_ANTICLOCKWISE ......... 183
IMG_CONTOUR_ANTICLOCKWISE_ALWAYS_
CLOSED.................................................. 183
IMG_CONTOUR_ANTICLOCKWISE_CONTINU
E_IF_BORDER ....................................... 183
IMG_CONTOUR_BELOW_THRESHOLD . 183
IMG_CONTOUR_CLOCKWISE ................. 183
IMG_CONTOUR_CLOCKWISE_ALWAYS_CLO
SED ......................................................... 183
IMG_CONTOUR_CLOCKWISE_CONTINUE_IF
_BORDER ............................................... 183
IMG_CONTOUR_CONNEXITY_4.............. 183
IMG_CONTOUR_CONNEXITY_8.............. 183
IMG_COPY ................................................. 182
IMG_DIVIDE ............................................... 182
631
IMG_EQUAL................................................182
IMG_GREATER ..........................................182
IMG_GREATER_OR_EQUAL.....................182
IMG_GREATEST_PIXEL_VALUE ..............183
IMG_HISTOGRAM_FEATURE ...................183
IMG_INVERT...............................................182
IMG_ISODATA_THRESHOLD....................184
IMG_LEAST_FREQUENT_PIXEL_FREQUENC
Y...............................................................183
IMG_LEAST_FREQUENT_PIXEL_VALUE 183
IMG_LESSER..............................................182
IMG_LESSER_OR_EQUAL ........................182
IMG_LOGICAL_AND...................................182
IMG_LOGICAL_OR.....................................182
IMG_LOGICAL_XOR ..................................182
IMG_MAX ....................................................182
IMG_MAX_ENTROPY_THRESHOLD ........184
IMG_MIN .....................................................182
IMG_MIN_RESIDUE_THRESHOLD...........184
IMG_MODULO ............................................182
IMG_MOST_FREQUENT_PIXEL_FREQUENCY
.................................................................183
IMG_MOST_FREQUENT_PIXEL_VALUE .183
IMG_MULTIPLY ..........................................182
IMG_NOISE_NONE ....................................184
IMG_NOISE_SAME_AS_IMAGE................184
IMG_NOISE_SAME_AS_IMAGE_INCLUSIVE
.................................................................184
IMG_NOT_EQUAL ......................................182
IMG_OR.......................................................182
IMG_OVERLAY...........................................182
IMG_PIXEL_COUNT...................................183
IMG_PIXEL_VALUE_STD_DEV .................183
IMG_REFERENCE_NOISE ........................184
IMG_RELATIVE_THRESHOLD ..................184
IMG_SCALED_ADD....................................182
IMG_SCALED_DIVIDE ...............................182
IMG_SCALED_MULTIPLY..........................182
IMG_SCALED_SUBTRACT ........................182
IMG_SET .....................................................182
IMG_SET_NON_ZERO...............................182
IMG_SET_ZERO.........................................182
IMG_SHIFT_LEFT.......................................182
IMG_SHIFT_RIGHT ....................................182
IMG_SMALLEST_PIXEL_VALUE...............183
632
IMG_SUBTRACT........................................ 182
IMG_THRESHOLD_MODES...................... 184
IMG_XOR ................................................... 182
ImgAnalyseHistogram................................. 156
ImgArea ...................................................... 160
ImgAreaDoubleThreshold........................... 160
ImgArgumentImage .................................... 138
ImgAutoThreshold............................... 118, 122
ImgBinaryMoments..................................... 160
ImgBlackTopHatBox ................................... 145
ImgBlackTopHatDisk .................................. 146
ImgCloseBox............................................... 141
ImgCloseDisk.............................................. 142
ImgContour ................................................. 157
ImgConvert ................................................. 171
ImgConvertTo422 ....................................... 173
ImgConvolGaussian ................................... 137
ImgConvolGradient..................................... 133
ImgConvolGradientX .................................. 133
ImgConvolGradientY .................................. 133
ImgConvolHighpass1.................................. 129
ImgConvolHighpass2.................................. 129
ImgConvolKernel ........................................ 128
ImgConvolLaplacian4 ................................. 131
ImgConvolLaplacian8 ................................. 131
ImgConvolLaplacianX................................. 130
ImgConvolLaplacianY................................. 130
ImgConvolLowpass1 .................................. 131
ImgConvolLowpass2 .................................. 132
ImgConvolLowpass3 .................................. 132
ImgConvolPrewitt........................................ 135
ImgConvolPrewittX ..................................... 134
ImgConvolPrewittY ..................................... 134
ImgConvolRoberts ...................................... 136
ImgConvolSobel.......................................... 136
ImgConvolSobelX ....................................... 135
ImgConvolSobelY ....................................... 135
ImgConvolSymmetricKernel ....................... 128
ImgConvolUniform
Images .................................................... 137, 177
Index
ImgDilateBox ...............................................142
ImgDilateDisk ..............................................143
ImgDistance.................................................149
ImgDoubleThreshold ...........................118, 120
ImgEqualize.................................................156
ImgErodeBox...............................................143
ImgErodeDisk ..............................................144
ImgFocusing ................................................181
ImgGainOffset .............................................114
ImgGet/SetFrame ........................................178
ImgGetOverlayColor....................................128
ImgGetProfilePeaks.....................................176
ImgGradientScalar.......................................139
ImgGravityCenter ........................................162
ImgHistogram ..............................................155
ImgHistogramThreshold ......................118, 121
ImgHorizontalMirror .....................................151
ImgImageToLineSegment ...........................174
ImgImageToPath .........................................175
ImgIsodataThreshold...................................121
ImgIsodataThresholdBW16 .........................121
ImgLinearTransform ....................................154
ImgLineSegmentToImage ...........................174
ImgLocalAverage.........................................164
ImgLocalDeviation .......................................165
ImgLut..........................................................115
ImgMatchFrames.........................................180
ImgMedian ...................................................147
ImgModulusImage .......................................138
ImgMorphoGradientBox ..............................146
ImgMorphoGradientDisk..............................147
ImgMultiLevelsMinResidueThreshold .........124
ImgNormalize ..............................................115
ImgOpenBox................................................140
ImgOpenDisk...............................................140
ImgOper...............................................124, 128
ImgPathToImage .........................................175
ImgPixelAverage .........................................164
ImgPixelCompare ........................................167
ImgPixelCount .............................................163
ImgPixelMax ................................................166
ImgPixelMin .................................................166
ImgPixelStat ................................................167
ImgPixelStdDev ...........................................164
ImgPixelVariance.........................................165
ImgProfileDerivative.................................... 176
ImgProjectOnAColumn ............................... 158
ImgProjectOnARow .................................... 159
ImgRealignFrame ....................................... 179
ImgRebuildFrame ....................................... 179
ImgRecursiveAverage ................................ 170
ImgRegister................................................. 149
ImgRmsNoise ............................................. 168
ImgSetCircleWarp....................................... 152
ImgSetOverlayColor ................................... 128
ImgSetRecursiveAverageLUT .................... 169
ImgSetupEqualize....................................... 157
ImgShrink.................................................... 154
ImgSignalNoiseRatio .................................. 169
ImgSwapFrames......................................... 181
ImgThick ..................................................... 148
ImgThin ....................................................... 148
ImgThreeLevelsMinResidueThreshold....... 123
ImgThreshold .............................................. 118
ImgTransform.............................................. 116
ImgTwoLevelsMinResidueThreshold.......... 123
ImgUniformize............................................. 116
ImgVerticalMirror......................................... 151
ImgWarp ..................................................... 152
ImgWeightedMoments................................ 161
ImgWhiteTopHatBox................................... 144
ImgWhiteTopHatDisk.................................. 145
InitialMinScore, Get/Set (EMatch) .............. 378
Inphase
CCIR YIQ Color System.................................. 573
Intensity....................................................... 574
Interpolate (PatternFinder).......................... 359
Interpolate, Get/Set (EMatch) ..................... 376
Introduction (Easy).......................................... 5
Introduction (EasyBarCode) ....................... 451
633
Introduction (EasyBGA)...............................485
Introduction (EasyColor)..............................189
Introduction (EasyFind) ...............................355
Introduction (EasyGauge)............................263
Introduction (EasyImage) ............................101
Introduction (EasyMatch).............................369
Introduction (EasyMatrixCode)....................465
Introduction (EasyObject) ............................221
Introduction (EasyOCR) ..............................329
Introduction (EasyOCV)...............................393
Introduction (EChecker)...............................439
Introduction (EWorldShape) ........................533
InverseColNumbering..................................522
InverseRowNumbering ................................521
IsAnROI .........................................................30
IsFound (MatrixCode)..................................469
IsHole (ECodedImage) ................................241
IsInnerFilteringEnabled (ECircleGauge)......299
IsInnerFilteringEnabled (ERectangleGauge)305
IsObjectSelected (ECodedImage)...............231
IsPatternLearnt (EMatch) ............................373
K
Kernel
EKernel........................................................... 103
ImgConvolKernel ............................................ 128
ImgConvolSymmetricKernel ........................... 128
Kernel ..........................................................103
Kernel ..........................................................128
Kernel ..........................................................128
KERNEL_RECTIFIER .................................184
KERNEL_ROTATION..................................185
KERNEL_TYPE...........................................185
Key Frame ...................................................575
KnownLocation, Get/Set (EBarCode)..........456
KnownModule, Get/Set (EBarCode) ...........456
L
L
CIE L*a*b* Color System ................................ 573
CIE L*u*v* Color System ................................ 573
L 573
L 573
Labeled ........................................................267
Laplacian
ImgConvolLaplacian4 ..................................... 131
634
ImgConvolLaplacian8...................................... 131
ImgConvolLaplacianX ..................................... 130
ImgConvolLaplacianY ..................................... 130
Laplacian..................................................... 130
Laplacian..................................................... 130
Laplacian..................................................... 131
Laplacian..................................................... 131
LastObjData, Get (ECodedImage).............. 238
LastObjPtr, Get (ECodedImage)................. 238
LastRunData, Get (ECodedImage)............. 245
LastRunPtr, Get (ECodedImage)................ 246
LastRunPtr, Set (ECodedImage) ................ 246
Learn........................................................... 361
Learn (EChecker)........................................ 442
Learn (EOCV) ............................................. 418
Learn (MatrixCodeReader) ......................... 477
Learn (PatternFinder) ................................. 361
LEARN_0 .................................................... 447
LEARN_1 .................................................... 447
LearningDone ............................................. 361
LearningDone (PatternFinder) .................... 361
LearnMask (MatrixCodeReader) ................ 475
LearnMore (MatrixCodeReader)................. 477
LearnParams
Type, enum .................................................481
Lightness..................................................... 575
LimitAngle, Get/Set (EcodedImage) ........... 231
LineSegmentToImage ................................ 174
Load
EBGA .............................................................. 504
EGauge ........................................................... 283
EImage/ROI... ...................................................18
EOCV .............................................................. 401
EWorldShape ..................................................547
Load .............................................................. 18
Load ............................................................ 361
Load ............................................................ 401
Load ............................................................ 446
Load ............................................................ 504
Index
Load.............................................................547
Load (EChecker) .........................................446
Load (EMatch) .............................................384
Load (EOCR)...............................................348
Load (MatrixCode).......................................478
Load (PatternFinder) ...................................361
LoadFont......................................................348
LocationThreshold (MatrixCode) .................469
Logical .........................................................124
LogicalSize
Type, enum................................................. 481
Lowpass.......................................................131
Lowpass.......................................................132
Lowpass.......................................................132
LowThreshold, Get/Set (ECodedImage) .....226
Luminance
CCIR YIQ Color System ................................. 573
CCIR YUV Color System ................................ 573
CIE L*a*b* Color System ................................ 573
CIE L*u*v* Color System ................................ 573
CIE LCH Color System ................................... 573
Luminance ...................................................573
Luminance ...................................................573
Luminance ...................................................573
Luminance ...................................................573
Luminance ...................................................573
Lut........................................................115, 193
M
m_bInterpolate (EMatchPosition) ................387
m_bSelected........................................429, 433
m_bWhiteOnBlack.......................................429
m_f32Angle (EMatchPosition).....................387
m_f32BackgroundAreaAverage ..........428, 432
m_f32BackgroundAreaDeviation.........428, 432
m_f32BackgroundSumAverage ..........428, 432
Index
Mirror ...........................................................151
Mirror ...........................................................151
Module, Get/Set (EBarCode) ......................456
Morphology
ImgBlackTopHatBox ....................................... 145
ImgBlackTopHatDisk ...................................... 146
ImgCloseBox .................................................. 141
ImgCloseDisk ................................................. 142
ImgDilateBox .................................................. 142
ImgDilateDisk ................................................. 143
ImgDistance.................................................... 149
ImgErodeBox.................................................. 143
ImgErodeDisk ................................................. 144
ImgMedian...................................................... 147
ImgMorphoGradientBox.................................. 146
ImgMorphoGradientDisk................................. 147
ImgOpenBox................................................... 140
ImgOpenDisk.................................................. 140
ImgThick ......................................................... 148
ImgThin........................................................... 148
ImgWhiteTopHatBox ...................................... 144
ImgWhiteTopHatDisk...................................... 145
Morphology..................................................140
N
NeutralClass, Get/Set (ECodedImage) ...... 224
NewFont (EOCR)........................................ 348
NextHole, Get (EcodedImage).................... 242
NextObjData, Get (ECodedImage) ............. 238
NextObjPtr, Get (ECodedImage) ................ 239
NextRunData, Get (ECodedImage) ............ 246
NextRunPtr, Get (ECodedImage) ............... 247
NO_ROTATION .......................................... 185
NoiseArea, Get/Set (EOCR) ....................... 335
NoiseReduction........................................... 107
NominalPrintGrowth (MatrixCodeReader).. 476
Normalize.................................................... 115
Normalize, Get/Set (EChecker) .................. 441
Normalized Print Quality Indicators ............ 609
NumErrors (MatrixCode)............................. 469
NumFeatures, Get (ECodedImage)............ 252
NumHoleRuns, Get (ECodedImage) .......... 248
NumHoles, Get (ECodedImage)................. 241
NumObjectRuns, Get (ECodedImage) ....... 248
NumObjects, Get (ECodedImage).............. 239
NumRuns, Get (ECodedImage).................. 248
NumSelectedObjects, Get (ECodedImage) 231
NumSelectedObjects, Set (ECodedImage) 231
637
O
OBJ_CENTROID_X
Drawn Features (ECodedImage).................... 237
OBJ_CENTROID_X ....................................237
OBJ_CENTROID_Y
Drawn Features (ECodedImage).................... 237
enum OBJECT_FEATURES .......................... 255
OBJ_CENTROID_Y ....................................237
OBJ_CLASS................................................255
OBJ_CODE_RUN_BLACK..........................256
OBJ_CODE_RUN_NEUTRAL.....................256
OBJ_CODE_RUN_WHITE..........................256
OBJ_CONNEXITY_4...................................255
OBJ_CONNEXITY_8...................................255
OBJ_ELLIPSE_ANGLE
Drawn Features (ECodedImage).................... 237
OBJ_ELLIPSE_ANGLE...............................237
OBJ_ELLIPSE_ANGLE...............................255
OBJ_ELLIPSE_HEIGHT
enum OBJECT_FEATURES .......................... 255
OBJ_ELLIPSE_HEIGHT .............................237
OBJ_ELLIPSE_HEIGHT .............................255
OBJ_ELLIPSE_WIDTH
Drawn Features (ECodedImage).................... 237
enum OBJECT_FEATURES .......................... 255
OBJ_ELLIPSE_WIDTH ...............................237
OBJ_ELLIPSE_WIDTH ...............................255
OBJ_GRAVITY_CENTER_X
Drawn Features (ECodedImage).................... 237
enum OBJECT_FEATURES .......................... 255
OBJ_GRAVITY_CENTER_X.......................237
OBJ_INSERT_ALL ......................................257
OBJ_INSERT_GREATER_OR_EQUAL .....257
OBJ_INSERT_IN.........................................257
OBJ_INSERT_LESSER_OR_EQUAL ........257
OBJ_INSERT_OUT.....................................257
OBJ_INSERT_OUT_OF_RANGE...............257
OBJ_INSERT_RANGE................................257
OBJ_INSERT_TOUCH................................257
OBJ_L..........................................................237
OBJ_LARGEST_RUN .................................255
OBJ_LIMIT_ANGLED_CENTER_X ............255
OBJ_LIMIT_ANGLED_CENTER_Y ............255
OBJ_LIMIT_ANGLED_HEIGHT..................255
OBJ_LIMIT_CENTER_X .....................237, 255
OBJ_LIMIT_CENTER_Y
638
OBJ_LIMIT22_WIDTH................................ 237
OBJ_LIMIT22_WIDTH................................ 255
OBJ_LIMIT45_CENTER_X
Drawn Features (ECodedImage) .................... 237
Index
OBJ_LIMIT68_HEIGHT...............................255
OBJ_LIMIT68_WIDTH
enum OBJECT_FEATURES .......................... 255
OBJ_LIMIT68_WIDTH.................................237
OBJ_PIXEL_GRAY_AVERAGE..................255
OBJ_PIXEL_GRAY_VARIANCE.................255
OBJ_PIXEL_MAX........................................255
OBJ_PIXEL_MIN.........................................255
OBJ_REMOVE_ALL....................................257
OBJ_REMOVE_BORDER...........................257
OBJ_REMOVE_GREATER_OR_EQUAL...257
OBJ_REMOVE_IN ......................................257
OBJ_REMOVE_LESSER_OR_EQUAL ......257
OBJ_REMOVE_OUT ..................................257
OBJ_REMOVE_OUT_OF_RANGE ............257
OBJ_REMOVE_RANGE .............................257
OBJ_REMOVE_TOUCH .............................257
OBJ_RUNS_NUMBER................................255
OBJ_SIGMA_XX .........................................255
OBJ_SIGMA_XY .........................................255
OBJ_SIGMA_YY .........................................255
OBJ_SORT_ASCENDING ..........................257
OBJ_SORT_DESCENDING........................257
ObjContourArea...........................................254
ObjContourGravityCenter ............................254
ObjContourInertia ........................................254
ObjDataPtr, Get (ECodedImage) ................239
Object ..........................................................575
OBJECT_CONNEXITY ...............................255
OBJECT_FEATURES .................................255
ObjectConvexHull (ECodedImage) .............230
ObjectData, Get (ECodedImage) ................239
ObjFirstRunPtr, Get (ECodedImage) ..........248
ObjLastRunPtr, Get (ECodedImage)...........240
ObjPtr, Get (ECodedImage) ........................239
ObjPtrByCoordinates, Get (ECodedImage) 240
ObjPtrByPos, Get (ECodedImage)..............240
OCR_ALL_CLASSES..................................350
OCR_BLACK_ON_WHITE..........................350
OCR_CLASS_0...........................................350
OCR_CLASS_1...........................................350
OCR_CLASS_10.........................................350
OCR_CLASS_11.........................................350
OCR_CLASS_12.........................................350
OCR_CLASS_13.........................................350
OCV_ABS_DEVIATION ..............................447
OCV_AVERAGE .........................................447
OCV_CHAR_CREATION_MODES.............434
OCV_CHAR_MISMATCH ...........................434
OCV_CHAR_NOT_FOUND ........................434
OCV_CHAR_OVERPRINTING ...................434
OCV_CHAR_UNDERPRINTING ................434
OCV_CREATE_CHAR_GROUP.................434
OCV_CREATE_CHAR_OVERLAP.............434
OCV_CREATE_CHAR_SEPARATE...........434
OCV_DEGREES_OF_FREEDOM, enum ...447
OCV_DIAGNOSTICS ..................................434
OCV_DRAW_INSPECTED .........................447
OCV_DRAW_LEARN..................................447
OCV_DRAW_MATCH .................................447
OCV_DRAW_MAX_INSPECTED ...............447
OCV_DRAW_POSITION.............................447
OCV_DRAWING_MODE, enum .................447
OCV_LEARNING_MODE, enum ................447
OCV_LOCATION_BINARIZED ...................434
OCV_LOCATION_GRADIENT....................434
OCV_LOCATION_LAPLACIAN ..................434
OCV_LOCATION_MODE............................434
OCV_LOCATION_RAW ..............................434
OCV_NORMALIZATION_MODE, enum .....447
OCV_NORMALIZE_MOMENTS .................447
OCV_NORMALIZE_NONE .........................447
OCV_NORMALIZE_THRESHOLD .............447
OCV_QUALITY_AREA................................434
OCV_QUALITY_CORRELATION ...............434
OCV_QUALITY_INDICATORS ...................434
OCV_QUALITY_LOCATION .......................434
OCV_QUALITY_SUM .................................434
OCV_READY ..............................................447
OCV_RESET...............................................447
OCV_RMS_DEVIATION .............................447
OCV_ROTATION ........................................447
OCV_SCALING ...........................................447
OCV_TEMPLATE........................................447
OCV_TEXT_MISMATCH ............................434
OCV_TEXT_NOT_FOUND .........................434
OCV_TEXT_OVERPRINTING ....................434
OCV_TEXT_UNDERPRINTING .................434
OCV_TRANSLATION..................................447
Offset ...........................................................114
640
Open
ImgOpenBox ................................................... 140
ImgOpenDisk .................................................. 140
P
Pan, Set (EBarCode) .................................. 460
Pan, Set (EChecker)................................... 445
PanX/Y, Get (EBarCode)............................ 460
PanX/Y, Get (EChecker)............................. 445
Pattern
Type ............................................................ 365
Index
MinScore .................................................... 359
ScaleBias.................................................... 359
ScaleTolerance........................................... 359
Find............................................................. 360
Learn .......................................................... 361
LearningDone ............................................. 361
DrawModel ................................................. 361
Load............................................................ 361
Save ........................................................... 362
PatternFinder AngleBias..............................358
PatternFinder AngleTolerance ....................358
PatternFinder CoarseStage.........................359
PatternFinder construction ..........................360
PatternFinder ContrastMode .......................358
PatternFinder Find.......................................360
PatternFinder FineStage .............................360
PatternFinder Interpolate.............................359
PatternFinder Learn.....................................361
PatternFinder LearningDone .......................361
PatternFinder Load......................................361
PatternFinder MaxFeaturePoints ................360
PatternFinder MaxInstances........................359
PatternFinder MinFeaturePoints .................360
PatternFinder MinScore...............................359
PatternFinder Overview...............................356
PatternFinder Pivot......................................357
PatternFinder Properties .............................356
PatternFinder Save......................................362
PatternFinder ScaleBias..............................359
PatternFinder ScaleTolerance.....................359
PatternHeight, Get (EMatch) .......................376
PatternHeight, Get (EOCR) .........................348
Patterns, GetNum (EOCR) ..........................347
PatternType .................................................357
PatternWidth, Get (EMatch) ........................376
PatternWidth, Get (EOCR) ..........................348
Pitch.............................................................575
Pivot.............................................................357
Pivot (PatternFinder) ...................................357
PixelDimensions, Get/Set (EMatch) ............379
Plot...............................................................281
Position, Draw (EMatch)..............................383
Position, Get (EMatch) ................................383
Positions, Draw (EMatch) ............................384
Positions, GetNum (EMatch) .......................383
Predefined data types....................................12
Q
Quadrature
CCIR YIQ Color System.................................. 573
Quadrature.................................................. 573
QuickDraw .................................................. 268
R
Read (EBarCode) ....................................... 453
Read (MatrixCodeReader).......................... 477
ReadingAngle, Get/Set (EBarCode) ........... 459
ReadingCenter, Set (EBarCode) ................ 458
ReadingSize, Set (EBarCode) .................... 458
ReadingThreshold (MatrixCode)................. 469
ReadText (EOCR) ...................................... 340
RebuildGrid ................................................. 536
Recognize (EOCR) ..................................... 341
RectangularSamplingArea (E... Gauge) ..... 271
RECTIFY_ABSOLUTE ............................... 184
RECTIFY_KEEP_NEGATIVE..................... 184
RECTIFY_KEEP_POSITIVE ...................... 184
Red
RGB Color System.......................................... 575
Render ...........................................................90
Render ...........................................................90
Reserve .......................................................564
Reset ...........................................................109
Reset (MatrixCodeReader)..........................477
ResetParameters
EOCVChar...................................................... 426
EOCVText ...................................................... 429
ResetParameters.........................................426
ResetParameters.........................................429
ROI
EROIBW16 ....................................................... 51
EROIBW8 ......................................................... 48
EROIC15 .......................................................... 57
EROIC16 .......................................................... 59
EROIC24 .......................................................... 53
EROIC24A........................................................ 55
ROI ................................................................48
ROI ................................................................51
ROI ................................................................53
ROI ................................................................55
ROI ................................................................57
ROI ................................................................59
ROI_HIT, enum ...........................................447
ROI_NONE..................................................447
Run ..............................................................575
RUN_TYPE .................................................256
RunData, Get (ECodedImage) ....................247
RunDataPtr, Get (ECodedImage) ...............247
RunPtr, Get (ECodedImage) .......................249
RunPtrByCoordinates, Get (ECodedImage)249
642
Runs
BuildLabeledRuns ........................................... 244
BuildRuns........................................................ 244
Runs............................................................ 244
Runs............................................................ 244
S
SameSize...................................................... 31
Saturation
ISH Color System............................................ 574
LSH Color System........................................... 575
Saturation.................................................... 574
Saturation.................................................... 575
Save
EBGA .............................................................. 504
EGauge ........................................................... 283
EImage/ROI... ...................................................20
EOCV .............................................................. 401
EWorldShape ..................................................548
Save.............................................................. 20
Save............................................................ 283
Save............................................................ 362
Save............................................................ 401
Save............................................................ 446
Save............................................................ 504
Save............................................................ 548
Save (EChecker)......................................... 446
Save (EMatch) ............................................ 385
Save (EOCR) .............................................. 348
Save (MatrixCode) ...................................... 479
Save (PatternFinder) .................................. 362
SaveFont..................................................... 348
Scale ........................................................... 363
Scale (FoundPattern).................................. 363
ScaleBias .................................................... 359
ScaleBias (PatternFinder)........................... 359
ScaleStep, Get (EMatch) ............................ 382
ScaleTolerance ........................................... 359
ScaleTolerance (PatternFinder).................. 359
ScaleX/YStep, Get (EMatch) ...................... 382
ScatterTextsCharsParameters ................... 416
ScatterTextsParameters ............................. 413
Score........................................................... 363
Score (FoundPattern) ................................. 363
SearchParams (MatrixCodeReader) .......... 475
SearchParamsType Contrast ..................... 474
SearchParamsType Family ........................ 474
Index
SetComment ................................................. 29
SetCompareAspectRatio (EOCR) .............. 335
SetComponentCenter ................................. 512
SetComponentPitches ................................ 512
SetCompressionQuality ................................ 76
SetConnexity (ECodedImage) .................... 226
SetContrastMode (EMatch) ........................ 376
SetCorrelationMode (EMatch) .................... 376
SetCurrentArray .......................................... 507
SetCurrentComponent................................ 512
SetCursor.................................................... 281
SetCutLargeChars (EOCR) ........................ 336
SetDataRate ................................................. 75
SetDate ......................................................... 29
SetDegreesOfFreedom (EChecker) ........... 441
SetDenomRate ............................................. 75
SetDiameters .............................................. 309
SetDistortion (EWorldShape)...................... 544
SetDontCareThreshold (EMatch) ............... 375
SetDrawDiagonals (ECodedImage)............ 234
SetEnabledQualityDiagnostics ................... 495
SetEnabledQualityStatistics........................ 495
SetExtension (EMatch) ............................... 383
SetFeatInfo (ECodedImage)....................... 252
SetFieldSize................................................ 539
SetFilteringMode (EMatch) ......................... 375
SetFinalReduction (EMatch)....................... 377
SetFineBallMeasure ................................... 494
SetFineCircularity........................................ 495
SetFirstRunPtr (ECodedImage).................. 246
SetFlipImage................................................. 74
SetGain ....................................................... 105
SetGridPointsMaxVariationThreshold ........ 535
SetGridPointsMeanVariationThreshold ...... 535
SetHeight ................................................ 22, 69
SetHighColorThreshold (ECodedImage).... 225
SetHighImage (ECodedImage)................... 225
SetHighThreshold (ECodedImage)............. 225
SetIdle......................................................... 562
SetImagePtr
EImage..............................................................27
SetImagePtr .................................................. 27
SetImageType............................................... 69
SetIndexBits................................................ 194
SetInitialMinScore (EMatch) ....................... 378
643
644
SetNumRate ................................................. 74
SetNumSelectedObjects (ECodedImage) .. 231
SetOemKey................................................... 92
SetOffset ..................................................... 105
SetOrgX ........................................................ 22
SetOrgY ........................................................ 22
SetOuterRoiDiameter ................................. 492
SetOutsideValue ......................................... 106
SetPackageName ....................................... 506
SetPackageSize.......................................... 506
SetPan (EBarCode) .................................... 460
SetPan (EChecker)..................................... 445
SetPan (EWorldShape) .............................. 549
SetParam .................................................... 558
SetPixel......................................................... 26
SetPixelDimensions
EImage/ROI... ...................................................31
SetPixelDimensions...................................... 31
SetPixelDimensions (EMatch) .................... 379
SetPlacement................................................ 21
SetPosition.................................................... 72
SetRadii ...................................................... 309
SetReadingAngle (EBarCode).................... 459
SetReadingCenter (EBarCode) .................. 458
SetReadingSize (EBarCode) ...................... 458
SetRectangularSamplingArea (E... Gauge) 271
SetRectifier ................................................. 106
SetRelativeSpacing (EOCR)....................... 336
SetRelativeTolerance (EChecker) .............. 443
SetRemoveBorder (EOCR) ........................ 337
SetRemoveNarrowOrFlat (EOCR).............. 335
SetResampleChars..................................... 421
SetResolution........................................ 32, 540
SetSegmentationMode (EOCR) ................. 336
SetSensor ................................................... 538
SetSensorSize ............................................ 539
SetShading ................................................. 199
SetShiftingMode (EOCR)............................ 339
SetShiftXTolerance (EOCR) ....................... 338
SetShiftYTolerance (EOCR) ....................... 339
SetSingulatedComponents ......................... 491
SetSize
EImage/ROI... ...................................................21
EMovingAverage............................................. 108
SetSize.......................................................... 21
Index
SetSize ........................................................108
SetSize ........................................................108
SetSize ........................................................317
SetSizeX ......................................................106
SetSizeY ......................................................106
SetStandardSymbologies (EBarCode)........455
SetState .........................................................70
SetSymmetry ...............................................510
SetTemplateImage ......................................407
SetTextCharParameters..............................415
SetTextColor (EOCR)..................................337
SetTextParameters..............................412, 413
SetThicknessRatio (EBarCode) ..................457
SetThreshold (ECodedImage).....................227
SetThreshold (EOCR) .................................337
SetThresholdImage (ECodedImage )..........227
SetTiltAngles ...............................................543
SetTitle...........................................................30
SetTolerance ...............................................286
SetTolerance (EChecker) ............................441
SetTransform...............................................198
SetUnit ...................................................67, 487
SetupEqualize .............................................157
SetupUnwarp...............................................547
SetUsedQualityIndicators ............................420
SetValue ........................................................67
SetVerifyChecksum (EBarCode).................457
SetWhiteClass (ECodedImage) ..................225
SetWhiteOnBlack ........................................490
SetWidth ..................................................22, 69
SetZoom (EBarCode) ..................................460
SetZoom (EChecker)...................................445
SetZoom (EWorldShape) ............................549
ShiftingMode, Get/Set (EOCR) ...................339
ShiftXTolerance, Get/Set (EOCR)...............338
ShiftYTolerance, Get/Set (EOCR)...............339
Signal...........................................................567
SignalInfo.....................................................566
Sobel
ImgConvolSobel ............................................. 136
ImgConvolSobelX........................................... 135
ImgConvolSobelY ........................................... 135
Sobel............................................................135
Sobel............................................................135
Sobel............................................................136
SORT_OPTIONS........................................ 257
SortObjectsUsingFeature ........................... 234
SrcImage, Get (EChecker) ......................... 440
StandardDeviation
ImgLocalDeviation........................................... 165
ImgPixelStdDev............................................... 164
Statistics...................................................... 160
Statistics...................................................... 160
Statistics...................................................... 160
Statistics...................................................... 162
Statistics...................................................... 163
Statistics...................................................... 163
Statistics...................................................... 164
Statistics...................................................... 164
Statistics...................................................... 164
Statistics...................................................... 165
Statistics...................................................... 165
Statistics...................................................... 166
Statistics...................................................... 166
Statistics...................................................... 167
StdDev
ImgLocalDeviation........................................... 165
ImgPixelStdDev............................................... 164
645
T
TextColor, Get/Set (EOCR) .........................337
Thick ............................................................148
ThicknessRatio, Get/Set (EBarCode)..........457
Thin..............................................................148
ThinStructureMode
Type............................................................ 365
ThinStructureMode ......................................357
Threshold
ImgAutoThreshold .......................................... 122
ImgDoubleThreshold ...................................... 120
ImgHistogramThreshold ................................. 121
ImgIsodataThreshold ...................................... 121
ImgThreshold.................................................. 118
Threshold.....................................................118
Threshold.....................................................120
Threshold.....................................................121
Threshold.....................................................121
Threshold.....................................................122
Threshold, Get/Set (ECodedImage)............227
Threshold, Get/Set (EOCR).........................337
ThresholdImage, Set (ECodedImage).........227
ThrowOnEError .............................................88
TimeOut (MatrixcodeReader)......................476
Timing
EStartTiming..................................................... 92
EStopTiming ..................................................... 92
Timing ............................................................92
ToggleBall....................................................510
ToggleBalls..................................................510
Tolerance, Set (EChecker) ..........................441
ToleranceX/Y, Get (EChecker)....................440
Trace..............................................................86
Transform
EColorLookup................................................. 196
ImgTransform ................................................. 116
Transform ....................................................116
Transform ....................................................196
TransitionThickness.....................................357
TrueThreshold, Get (ECodedImage)...........227
TrueThreshold, Get (EOCR)........................338
U
u
CCIR YUV Color System ................................ 573
CIE L*u*v* Color System ................................ 573
u 573
646
u 573
UINT16.......................................................... 12
UINT32.......................................................... 12
UINT8............................................................ 12
Uniformize................................................... 116
UnregisterCallback ..................................... 563
UnselectAllObjects (ECodedImage) ........... 232
UnselectHoles (ECodedImage) .................. 243
UnselectObject (ECodedImage) ................. 232
UnusedErrorCorrection (MatrixCode) ......... 472
UnusedErrorCorrectionGrade (MatrixCode)472
Unwarp........................................................ 547
UpdateImageConfig.................................... 568
UpdateStatistics .......................................... 423
V
v
CCIR YUV Color System................................. 573
CIE L*u*v* Color System................................. 573
v 573
v 573
Variance...................................................... 165
VECT_TYPE ................................................. 97
Vector element types .................................... 14
Vector types .................................................... 7
Vector<> Class Members ............................. 65
Vector<> Overview ....................................... 64
VerifyChecksum, Get/Set (EBarCode) ....... 457
Version, EGet (Easy) .................................... 93
Version, Get (EMatch) ................................ 386
Vertical ........................................................ 151
Void............................................................... 28
W
WaitSignal................................................... 563
Warp
ImgSetCircleWarp ........................................... 152
ImgWarp..........................................................152
Index
ImgWhiteTopHatDisk...................................... 145
WhiteTopHat................................................144
WhiteTopHat................................................145
WorldToSensor............................................546
Y 573
Y 573
Y 573
YOriginOffset, Get (ECodedImage) ............ 253
X
X
Z
Z
X 573
Y
Y
CCIR YIQ Color System ................................. 573
CCIR YUV Color System ................................ 573
CIE XYZ Color System ................................... 573
Z 573
Zoom, Set (EBarCode) ............................... 460
Zoom, Set (EChecker) ................................ 445
ZoomX/Y, Get (EBarCode) ......................... 460
ZoomX/Y, Get (EChecker).......................... 445
647
www.euresys.com
info@euresys.com
America
Asia
Japan
Europe
Euresys Inc.
Euresys s.a.
Corporate Headquarters
Man_C++_6_7_1_Jan06_Cor0