Sei sulla pagina 1di 692

C++ Reference Manual

eVision 6.7.1

C++
REFERENCE MANUAL
eVision 6.7.1

Copyright 2006 Euresys s.a.


Lige Science Park
14, Avenue du Pr-Aily
B-4031 Angleur Belgium
Phone +32 4 367 72 88 Fax +32 4 367 74 66
E-mail: info@euresys.com
Web site: www.euresys.com

This book is part of the documentation provided with eVision.


For more information, refer to the documentation provided in the latest eVision package.
C++ Reference Manual eVision 6.7.1 January 2006

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.

Copyright 2006 Euresys s.a.

info@euresys.com
www.euresys.com

America

Asia

Japan

Europe

Euresys Inc.

Euresys Pte. Ltd.

Euresys s.a.
Japan Representative Office

Euresys s.a.
Corporate Headquarters

500 Park Boulevard


Suite 525

627A Aljunied Road


#08-09 BizTech Centre

AIOS Hiroo Building 8F,


Hiroo 1-11-2,

Lige Science Park


14, Avenue du Pr-Aily

Itasca, Illinois 60143,


USA

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

Technical support: support.usa@euresys.com

+65 6748 0085


+65 6841 2137

Technical support: support.asia@euresys.com

+81 3 5447 1256


+81 3 5447 0529

Technical support: support.asia@euresys.com

+32 4 367 72 88
+32 4 367 74 66

Technical support: support.europe@euresys.com

Asia
Phone:
Fax:
Japan
Phone:
Fax:
Europe
Phone:
Fax:

Table Of Contents
OVERVIEW OF EVISION COMPONENTS ...................................................1

EASY: GENERAL LIBRARY .......................................................................3


1. EASY: INTRODUCTION ................................................................................................................5
1.1 Image types ............................................................................................................................6
1.2 Vector types ...........................................................................................................................7
1.3 Predefined data types..........................................................................................................12
1.4 Image pixel types .................................................................................................................12
1.5 Vector element types ...........................................................................................................14
2. CLASSES AND CLASS MEMBERS............................................................................................15
2.1 EImage... and EROI... [common members] ........................................................................15
2.1.1 EImage... and EROI... Overview..........................................................................................15
2.1.2 Class Members ....................................................................................................................15
2.1.2.1 Copying..........................................................................................................................15
EImage/ROI...::CopyTo..................................................................................................................15
EImage/ROI...::Operator= ..............................................................................................................16

2.1.2.2 Graphical interaction......................................................................................................16


EImage/ROI...::Draw ......................................................................................................................16
EROI...::DrawFrame.......................................................................................................................17
EROI...::HitTest ..............................................................................................................................17
EROI...::Drag..................................................................................................................................18

2.1.2.3 Persistent storage..........................................................................................................18


EImage/ROI...::Load ......................................................................................................................18
EImage/ROI...::Save ......................................................................................................................20

C++ Reference Manual 6.7.1

2.1.2.4 Coordinates ...................................................................................................................21


EImage/ROI...::SetSize ..................................................................................................................21
EROI...::SetPlacement ...................................................................................................................21
EROI...::SetOrgX............................................................................................................................22
EROI...::SetOrgY............................................................................................................................22
EROI...::SetWidth...........................................................................................................................22
EROI...::SetHeight..........................................................................................................................22
EImage/ROI...::GetOrgX ................................................................................................................23
EImage/ROI...::GetOrgY ................................................................................................................23
EImage/ROI...::GetWidth ...............................................................................................................23
EImage/ROI...::GetHeight ..............................................................................................................23
EImage/ROI...::GetTotalOrgX ........................................................................................................24
EImage/ROI...::GetTotalOrgY ........................................................................................................24
EImage/ROI...::GetTotalWidth .......................................................................................................24
EImage/ROI...::GetTotalHeight ......................................................................................................24

2.1.2.5 ROIs Hierarchy ..............................................................................................................24


EROI...::Attach ...............................................................................................................................24
EROI...::Detach ..............................................................................................................................25
EImage/ROI...::GetParent ..............................................................................................................25
EImage/ROI...::GetTopParent........................................................................................................25
EImage/ROI...::GetFirstSubROI.....................................................................................................25
EImage/ROI...::GetNextSiblingROI ................................................................................................25
EImage/ROI...::GetNextROI...........................................................................................................26

2.1.2.6 Data Access...................................................................................................................26


EImage/ROI...::Get/SetPixel ..........................................................................................................26
EImage/ROI...::GetImagePtr ..........................................................................................................27
EImage...::SetImagePtr..................................................................................................................27
EImage/ROI...::GetColPitch ...........................................................................................................28
EImage/ROI...::GetRowPitch .........................................................................................................28
EImage/ROI...::Void .......................................................................................................................28

2.1.2.7 Character Strings...........................................................................................................28


EImage/ROI...::Get/SetAuthor........................................................................................................28
EImage/ROI...::Get/SetComment...................................................................................................29
EImage/ROI...::Get/SetDate...........................................................................................................29
EImage/ROI...::Get/SetTitle ...........................................................................................................30

2.1.2.8 Typing and Type Compatibility ......................................................................................30


EImage/ROI...::Get/SetColorSystem..............................................................................................30
EImage/ROI...::GetType.................................................................................................................30
EImage/ROI...::IsAnROI.................................................................................................................31
EImage/ROI...::SameSize ..............................................................................................................31
EImage/ROI...::GetBitsPerPixel .....................................................................................................31
EImage/ROI...::GetPlanesPerPixel ................................................................................................31

2.1.2.9 Pixel Dimensions and Resolution ..................................................................................31


EImage/ROI...::Get/SetPixelDimensions........................................................................................31
EImage/ROI...::Get/SetResolution .................................................................................................32

2.2 EImageBW1 [based on EROIBW1] .....................................................................................33


2.2.1 EImageBW1 Overview.........................................................................................................33
2.2.2 EImageBW1 Class Members...............................................................................................33
2.2.2.1 EImageBW1 Construction .............................................................................................33
Default Constructor ........................................................................................................................33
Sizing Constructor..........................................................................................................................34
Copy Constructor ...........................................................................................................................34

2.3 EImageBW8 [based on EROIBW8] .....................................................................................34


2.3.1 EImageBW8 Overview.........................................................................................................34

vi

Table Of Contents

2.3.2 EImageBW8 Class Members...............................................................................................35


2.3.2.1 EImageBW8 Construction .............................................................................................35
Default Constructor ........................................................................................................................35
Sizing Constructor..........................................................................................................................35
Copy Constructor ...........................................................................................................................36

2.3.2.2 Graphical Interaction......................................................................................................36


EImageBW8::Draw.........................................................................................................................36

2.4 EImageBW16 [based on EROIBW16]..................................................................................37


2.4.1 EImageBW16 Overview.......................................................................................................37
2.4.2 EImageBW16 Class Members.............................................................................................37
2.4.2.1 EImageBW16 Construction ...........................................................................................37
Default Constructor ........................................................................................................................37
Sizing Constructor..........................................................................................................................38
Copy Constructor ...........................................................................................................................38

2.5 EImageC24 [based on EROIC24] ........................................................................................39


2.5.1 EImageC24 Overview ..........................................................................................................39
2.5.2 EImageC24 Class Members................................................................................................39
2.5.2.1 EImageC24 Construction...............................................................................................39
Default Constructor ........................................................................................................................39
Sizing Constructor..........................................................................................................................40
Copy Constructor ...........................................................................................................................40

2.6 EImageC24A [based on EROIC24A] ...................................................................................40


2.6.1 EImageC24A Overview........................................................................................................40
2.6.2 EImageC24A Class Members .............................................................................................41
2.6.2.1 EImageC24A Construction ............................................................................................41
Default Constructor ........................................................................................................................41
Sizing Constructor..........................................................................................................................41
Copy Constructor ...........................................................................................................................42

2.7 EImageC15 [based on EROIC15] ........................................................................................42


2.7.1 EImageC15 Overview ..........................................................................................................42
2.7.2 EImageC15 Class Members................................................................................................43
2.7.2.1 EImageC15 Construction...............................................................................................43
Default Constructor ........................................................................................................................43
Sizing Constructor..........................................................................................................................43
Copy Constructor ...........................................................................................................................43

2.8 EImageC16 [based on EROIC16] ........................................................................................44


2.8.1 EImageC16 Overview ..........................................................................................................44
2.8.2 EImageC16 Class Members................................................................................................44
2.8.2.1 EImageC16 Construction...............................................................................................44
Default Constructor ........................................................................................................................44
Sizing Constructor..........................................................................................................................45
Copy Constructor ...........................................................................................................................45

2.9 EROIBW1 ..............................................................................................................................46


2.9.1 EROIBW1 Overview ............................................................................................................46
2.9.2 EROIBW1 Class Members ..................................................................................................47
2.9.2.1 EROIBW1 Construction .................................................................................................47
Default Constructor ........................................................................................................................47
Sizing Constructor..........................................................................................................................47
Copy Constructor ...........................................................................................................................47

2.10 EROIBW8 ..............................................................................................................................48


vii

C++ Reference Manual 6.7.1

2.10.1 EROIBW8 Overview ............................................................................................................48


2.10.2 EROIBW8 Class Members ..................................................................................................49
2.10.2.1 EROIBW8 Construction .................................................................................................49
Default Constructor ........................................................................................................................49
Sizing Constructor..........................................................................................................................49
Copy Constructor ...........................................................................................................................49

2.10.2.2 Graphical Interaction......................................................................................................50


EROIBW8::Draw ............................................................................................................................50

2.11 EROIBW16 ............................................................................................................................51


2.11.1 EROIBW16 Overview ..........................................................................................................51
2.11.2 EROIBW16 Class Members ................................................................................................52
2.11.2.1 EROIBW16 Construction ...............................................................................................52
Default Constructor ........................................................................................................................52
Sizing Constructor..........................................................................................................................52
Copy Constructor ...........................................................................................................................52

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.13 EROIC24A .............................................................................................................................55


2.13.1 EROIC24A Overview ...........................................................................................................55
2.13.2 EROIC24A Class Members .................................................................................................56
2.13.2.1 EROIC24A Construction................................................................................................56
Default Constructor ........................................................................................................................56
Sizing Constructor..........................................................................................................................56
Copy Constructor ...........................................................................................................................56

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

2.20 EImageSequence .................................................................................................................68


2.20.1 EImageSequence: Overview ...............................................................................................68
2.20.2 EImageSequence Class Members ......................................................................................68
2.20.2.1 Construction/Destruction ...............................................................................................68
EImageSequence Construction .....................................................................................................68
EImageSequence Destruction .......................................................................................................69

2.20.2.2 Sizing .............................................................................................................................69


EImageSequence::Get/Set Width ..................................................................................................69
EImageSequence::Get/Set Height .................................................................................................69

2.20.2.3 Typing ............................................................................................................................69


EImageSequence::Get/Set ImageType .........................................................................................69

2.20.2.4 Sequencing ....................................................................................................................70


EImageSequence::GetCount .........................................................................................................70
EImageSequence::Get/Set State ...................................................................................................70
EImageSequence::CloseFile..........................................................................................................70

2.20.2.5 Sequence writing ...........................................................................................................70


EImageSequence::StartSaving ......................................................................................................70
EImageSequence::Seek ................................................................................................................71
EImageSequence::AddImage ........................................................................................................71
EImageSequence::AddImageData.................................................................................................71
EImageSequence::AddImages ......................................................................................................72

2.20.2.6 Sequence reading..........................................................................................................72


EImageSequence::StartLoading ....................................................................................................72
EImageSequence::SetPosition ......................................................................................................72
EImageSequence::GetImage.........................................................................................................73
EImageSequence::GetImages .......................................................................................................73

2.20.2.7 Image Storage Layout ...................................................................................................74


EImageSequence::Get/Set FlipImage............................................................................................74

2.20.2.8 AVI parameters..............................................................................................................74


EImageSequence::Get/Set CodecFourcc ......................................................................................74

ix

C++ Reference Manual 6.7.1

EImageSequence::Get/Set NumRate ............................................................................................74


EImageSequence::Get/Set DenomRate ........................................................................................75
EImageSequence::Get/Set DataRate ............................................................................................75
EImageSequence::Get/Set KeyFrameRate ...................................................................................75
EImageSequence::Get/Set CompressionQuality ...........................................................................76

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

2.22.2.2 Data access ...................................................................................................................80


EJpegHandler::SetBuffers..............................................................................................................80
EJpegHandler::DecompressToImage ............................................................................................80

2.22.2.3 Persistent storage..........................................................................................................81


EJpegHandler::Load ......................................................................................................................81
EJpegHandler::LoadFJfif................................................................................................................81
EJpegHandler::LoadSJfif ...............................................................................................................81
EJpegHandler::Save ......................................................................................................................82
EJpegHandler::SaveFJfif ...............................................................................................................82
EJpegHandler::SaveSJfif ...............................................................................................................82

3. FUNCTIONS.................................................................................................................................83
3.1 Initialization and Termination .............................................................................................83
Initialize ..........................................................................................................................................83
Terminate .......................................................................................................................................83

3.2 File Access ...........................................................................................................................83


ESetTiffThreshold ..........................................................................................................................83
ESetJpegQuality ............................................................................................................................84

3.3 Resizing ................................................................................................................................84


EResize..........................................................................................................................................84

3.4 Copying.................................................................................................................................85
ESetRecursiveCopyBehavior.........................................................................................................85
EGetRecursiveCopyBehavior ........................................................................................................86

3.5 Error Processing and Tracing.............................................................................................86


EGetError, EGetErrorText..............................................................................................................86
EGetError, EGetErrorText..............................................................................................................86
EOk ................................................................................................................................................87
EFailure..........................................................................................................................................87
ESuccess .......................................................................................................................................87
ESetTraceMode .............................................................................................................................87
EGetTraceMode.............................................................................................................................87
ETrace............................................................................................................................................87
ETraceR .........................................................................................................................................88

Table Of Contents

ETraceRS.......................................................................................................................................88
ThrowOnEError ..............................................................................................................................88

3.6 Image Display and Drawing ................................................................................................89


EOpenImageDC.............................................................................................................................89
ECloseImageDC ............................................................................................................................89

3.7 Image 3D Rendering ............................................................................................................90


ERender3D ....................................................................................................................................90
ERenderColorHistogram ................................................................................................................90

3.8 Angle Unit .............................................................................................................................91


EGet/SetAngleUnit .........................................................................................................................91
EFromRadians ...............................................................................................................................91
EToRadians ...................................................................................................................................92

3.9 Timing ...................................................................................................................................92


EStartTiming / EStopTiming...........................................................................................................92
ETrueTimingResolution..................................................................................................................92

3.10 Licensing ..............................................................................................................................92


SetOemKey....................................................................................................................................92
CheckOemKey ...............................................................................................................................93
enum Location::Type......................................................................................................................93

3.11 Miscellaneous ......................................................................................................................93


EGetVersion...................................................................................................................................93

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

EASYIMAGE: IMAGE PROCESSING ........................................................99


1. EASYIMAGE: INTRODUCTION.................................................................................................101
2. CLASSES AND CLASS MEMBERS..........................................................................................103
2.1 EKernel ...............................................................................................................................103
2.1.1 EKernel Overview ..............................................................................................................103
2.1.2 EKernel Class Members ....................................................................................................103
2.1.2.1 Construction.................................................................................................................103
EKernel: Construction ..................................................................................................................103

2.1.2.2 Convolution Coefficients ..............................................................................................104

xi

C++ Reference Manual 6.7.1

EKernel::GetDataPtr ....................................................................................................................104
EKernel::GetKernelData...............................................................................................................104
EKernel::SetKernelData ...............................................................................................................104

2.1.2.3 Global parameters .......................................................................................................105


EKernel::Get/SetGain...................................................................................................................105
EKernel::Get/SetOffset.................................................................................................................106
EKernel::Get/SetOutsideValue.....................................................................................................106
EKernel::Get/SetRectifier .............................................................................................................106

2.1.2.4 Sizing ...........................................................................................................................106


EKernel::Get/SetSizeX.................................................................................................................106
EKernel::Get/SetSizeY.................................................................................................................107

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

3.2 Thresholding ......................................................................................................................118


ImgThreshold ...............................................................................................................................118
ImgDoubleThreshold....................................................................................................................120
ImgIsodataThreshold ...................................................................................................................121
ImgHistogramThreshold...............................................................................................................121
ImgAutoThreshold........................................................................................................................122
ImgTwoLevelsMinResidueThreshold ...........................................................................................123
ImgThreeLevelsMinResidueThreshold ........................................................................................123
ImgMultiLevelsMinResidueThreshold ..........................................................................................124

3.3 Arithmetic & logic ..............................................................................................................124


ImgOper .......................................................................................................................................124
ImgCopy.......................................................................................................................................127
Img Get/Set OverlayColor ............................................................................................................128

3.4 Convolution (Linear Filtering)...........................................................................................128


ImgConvolKernel..........................................................................................................................128
ImgConvolSymmetricKernel.........................................................................................................128
ImgConvolHighpass1 ...................................................................................................................129
ImgConvolHighpass2 ...................................................................................................................129
ImgConvolLaplacianX ..................................................................................................................130
ImgConvolLaplacianY ..................................................................................................................130
ImgConvolLaplacian4...................................................................................................................131
ImgConvolLaplacian8...................................................................................................................131
ImgConvolLowpass1....................................................................................................................131
ImgConvolLowpass2....................................................................................................................132
ImgConvolLowpass3....................................................................................................................132
ImgConvolGradientX....................................................................................................................133

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.5 Morphology (Non-linear Filtering) ....................................................................................140


ImgOpenBox ................................................................................................................................140
ImgOpenDisk ...............................................................................................................................140
ImgCloseBox................................................................................................................................141
ImgCloseDisk ...............................................................................................................................142
ImgDilateBox................................................................................................................................142
ImgDilateDisk ...............................................................................................................................143
ImgErodeBox ...............................................................................................................................143
ImgErodeDisk...............................................................................................................................144
ImgWhiteTopHatBox ....................................................................................................................144
ImgWhiteTopHatDisk ...................................................................................................................145
ImgBlackTopHatBox ....................................................................................................................145
ImgBlackTopHatDisk....................................................................................................................146
ImgMorphoGradientBox ...............................................................................................................146
ImgMorphoGradientDisk ..............................................................................................................147
ImgMedian ...................................................................................................................................147
ImgThick.......................................................................................................................................148
ImgThin ........................................................................................................................................148
ImgDistance .................................................................................................................................149

3.6 Geometric transforms........................................................................................................149


ImgRegister..................................................................................................................................149
ImgHorizontalMirror......................................................................................................................151
ImgVerticalMirror..........................................................................................................................151
ImgSetCircleWarp ........................................................................................................................152
ImgWarp.......................................................................................................................................153
ImgScaleRotate............................................................................................................................153
ImgShrink .....................................................................................................................................154
ImgLinearTransform.....................................................................................................................154

3.7 Histograms .........................................................................................................................155


ImgHistogram...............................................................................................................................155
ImgCumulateHistogram ...............................................................................................................156
ImgAnalyseHistogram ..................................................................................................................156
ImgEqualize .................................................................................................................................156
ImgSetupEqualize ........................................................................................................................157

3.8 Contouring..........................................................................................................................157
ImgContour ..................................................................................................................................157

3.9 Projections .........................................................................................................................158


ImgProjectOnAColumn ................................................................................................................158
ImgProjectOnARow......................................................................................................................159

3.10 Statistics .............................................................................................................................160


ImgArea........................................................................................................................................160
ImgAreaDoubleThreshold ............................................................................................................160

xiii

C++ Reference Manual 6.7.1

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

3.11 Noise Reduction.................................................................................................................168


ImgRmsNoise...............................................................................................................................168
ImgSignalNoiseRatio....................................................................................................................169
ImgSetRecursiveAverageLUT......................................................................................................169
ImgRecursiveAverage..................................................................................................................170

3.12 Conversions .......................................................................................................................171


ImgConvert...................................................................................................................................171
ImgConvertTo422 ........................................................................................................................174

3.13 Vector operations ..............................................................................................................174


ImgImageToLineSegment............................................................................................................174
ImgLineSegmentToImage............................................................................................................174
ImgImageToPath..........................................................................................................................175
ImgPathToImage..........................................................................................................................176
ImgProfileDerivative .....................................................................................................................176
ImgGetProfilePeaks .....................................................................................................................177
ImgConvolUniform .......................................................................................................................177

3.14 Frame ..................................................................................................................................178


ImgGet/SetFrame.........................................................................................................................178
ImgRebuildFrame.........................................................................................................................179
ImgRealignFrame.........................................................................................................................179
ImgMatchFrames .........................................................................................................................180
ImgSwapFrames ..........................................................................................................................181

3.15 Miscellaneous ....................................................................................................................181


ImgFocusing.................................................................................................................................181

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

EASYCOLOR: COLOR IMAGE PROCESSING .........................................187


1. EASYCOLOR: INTRODUCTION ...............................................................................................189
2. CLASSES AND CLASS MEMBERS..........................................................................................193
2.1 EColorLookup ....................................................................................................................193
2.1.1 EColorLookup: Overview ...................................................................................................193
2.1.2 EColorLookup Class Members ..........................................................................................194
2.1.2.1 Construction.................................................................................................................194
EColorLookup Construction .........................................................................................................194

2.1.2.2 Interpolation mode .......................................................................................................194


EColorLookup::Get/SetInterpolation ............................................................................................194

2.1.2.3 Index bits......................................................................................................................194


EColorLookup::Get/SetIndexBits .................................................................................................194

2.1.2.4 Color systems ..............................................................................................................195


EColorLookup::GetColorSystemIn ...............................................................................................195
EColorLookup::GetColorSystemOut ............................................................................................195

2.1.2.5 Color transformation ....................................................................................................196


EColorLookup::Transform ............................................................................................................196

2.1.2.6 Initialization ..................................................................................................................196


EColorLookup::AdjustGainOffset .................................................................................................196
EColorLookup::ConvertToRGB....................................................................................................197
EColorLookup::ConvertFromRGB................................................................................................197
EColorLookup::Calibrate ..............................................................................................................197
EColorLookup:: SetTransform......................................................................................................198
EColorLookup::WhiteBalance ......................................................................................................198

2.2 EPseudoColorLookup .......................................................................................................199


2.2.1 EPseudoColorLookup Class Members..............................................................................199
EPseudoColorLookup::SetShading..............................................................................................199

3. FUNCTIONS...............................................................................................................................200
3.1 Color Conversions .............................................................................................................200
Quantized Color Conversions ......................................................................................................200
Unquantized Color Conversions ..................................................................................................201

3.2 Color Quantization and Dequantization ...........................................................................202


ClrQuantize ..................................................................................................................................202
ClrDequantize ..............................................................................................................................203

3.3 Color Image Components .................................................................................................204


ClrCompose .................................................................................................................................204
ClrDecompose .............................................................................................................................204
ClrGetComponent ........................................................................................................................205
ClrSetComponent.........................................................................................................................205
ClrRegisterPlanes ........................................................................................................................205

3.4 Color Image Transformation .............................................................................................206


ClrTransform ................................................................................................................................206
ClrTransformBayer.......................................................................................................................207

3.5 Pseudo Coloring ................................................................................................................207


ClrPseudoColor............................................................................................................................207

3.6 Color System Variants.......................................................................................................208


ClrGet/SetSrcQuantization...........................................................................................................208
ClrGet/SetRGBStandard ..............................................................................................................208
ClrGet/SetDstQuantization...........................................................................................................209

xv

C++ Reference Manual 6.7.1

3.7 YUV Conversions...............................................................................................................209


ClrFormat422To444 .....................................................................................................................209
ClrFormat444To422 .....................................................................................................................209

3.8 Bayer Conversions ............................................................................................................210


ClrBayerToC24 ............................................................................................................................210
ClrC24ToBayer ............................................................................................................................211

3.9 Color Image Segmentation................................................................................................212


ClrAssignNearestClass ................................................................................................................212
ClrAssignNearestClassCenter .....................................................................................................213
ClrImproveClassCenters ..............................................................................................................213
ClrClassAverages ........................................................................................................................213
ClrClassVariances........................................................................................................................214

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

EASYOBJECT: BLOB ANALYSIS ..........................................................219


1. EASYOBJECT: INTRODUCTION..............................................................................................221
2. CLASSES AND CLASS MEMBERS..........................................................................................224
2.1 ECodedImage .....................................................................................................................224
2.1.1 ECodedImage Overview ....................................................................................................224
2.1.2 ECodedImage Class members..........................................................................................224
2.1.2.1 Construction.................................................................................................................224
ECodedImage: Construction ........................................................................................................224

2.1.2.2 Thresholding and segmentation ..................................................................................224


ECodedImage::Get/SetBlackClass()............................................................................................224
ECodedImage::Get/SetNeutralClass ...........................................................................................224
ECodedImage::Get/SetWhiteClass..............................................................................................225
ECodedImage::Get/SetHighThreshold.........................................................................................225
ECodedImage::Get/SetHighColorThreshold ................................................................................225
ECodedImage::Get/SetHighImage...............................................................................................225
ECodedImage::Get/SetLowThreshold .........................................................................................226
ECodedImage::Get/SetLowColorThreshold.................................................................................226
ECodedImage::Get/SetLowImage ...............................................................................................226
ECodedImage::Get/SetConnexity ................................................................................................226
ECodedImage::Get/SetThreshold ................................................................................................227
ECodedImage::GetTrueThreshold ...............................................................................................227
ECodedImage::SetThresholdImage.............................................................................................227

2.1.2.3 Object construction ......................................................................................................228


ECodedImage::BuildObjects ........................................................................................................228
ECodedImage::BuildLabeledObjects ...........................................................................................228
ECodedImage::Get/Set MaxObjects ............................................................................................229

2.1.2.4 Feature computation....................................................................................................229


ECodedImage::AnalyseObjects ...................................................................................................229
ECodedImage::FeatureMinimum .................................................................................................229
ECodedImage::FeatureMaximum ................................................................................................230
ECodedImage::FeatureAverage ..................................................................................................230

xvi

Table Of Contents

ECodedImage::FeatureVariance..................................................................................................230
ECodedImage::FeatureDeviation.................................................................................................230
ECodedImage::ObjectConvexHull ...............................................................................................230
ECodedImage::Get/Set LimitAngle ..............................................................................................231

2.1.2.5 Object selection ...........................................................................................................231


ECodedImage::GetNumSelectedObjects.....................................................................................231
ECodedImage::SetNumSelectedObjects .....................................................................................231
ECodedImage::IsObjectSelected .................................................................................................231
ECodedImage::SelectAllObjects ..................................................................................................232
ECodedImage::SelectObject........................................................................................................232
ECodedImage::UnselectAllObjects ..............................................................................................232
ECodedImage::UnselectObject....................................................................................................232

2.1.2.6 Selection and sorting ...................................................................................................233


ECodedImage::SelectObjectsUsingFeature ................................................................................233
ECodedImage::SelectObjectsUsingPosition ................................................................................233
ECodedImage::SortObjectsUsingFeature....................................................................................234

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

2.1.2.8 Object management ....................................................................................................237


ECodedImage::GetCurrentObjData .............................................................................................237
ECodedImage::GetFirstObjData ..................................................................................................238
ECodedImage::GetLastObjData ..................................................................................................238
ECodedImage::GetPreviousObjData ...........................................................................................238
ECodedImage::GetNextObjData..................................................................................................238
ECodedImage::GetCurrentObjPtr ................................................................................................238
ECodedImage::GetFirstObjPtr .....................................................................................................238
ECodedImage::GetLastObjPtr .....................................................................................................238
ECodedImage::GetPreviousObjPtr ..............................................................................................239
ECodedImage::GetNextObjPtr.....................................................................................................239
ECodedImage::GetObjDataPtr.....................................................................................................239
ECodedImage::GetObjectData ....................................................................................................239
ECodedImage::GetNumObjects...................................................................................................239
ECodedImage::GetObjPtr ............................................................................................................240
ECodedImage::GetObjPtrByCoordinates.....................................................................................240
ECodedImage::GetObjPtrByPos..................................................................................................240
ECodedImage::GetObjLastRunPtr...............................................................................................240
ECodedImage::RemoveAllObjects...............................................................................................240
ECodedImage::RemoveObject ....................................................................................................240

2.1.2.9 Hole construction .........................................................................................................241


ECodedImage::BuildHoles ...........................................................................................................241

2.1.2.10 Hole management .......................................................................................................241


ECodedImage::IsHole ..................................................................................................................241
ECodedImage::GetNumHoles......................................................................................................242
ECodedImage::GetFirstHole ........................................................................................................242
ECodedImage::GetNextHole........................................................................................................242
ECodedImage::GetHoleParentObject ..........................................................................................243
ECodedImage::SelectHoles .........................................................................................................243
ECodedImage::UnselectHoles .....................................................................................................243
ECodedImage::RemoveHoles......................................................................................................244

2.1.2.11 Run construction..........................................................................................................244


ECodedImage::BuildRuns............................................................................................................244

xvii

C++ Reference Manual 6.7.1

ECodedImage::BuildLabeledRuns ...............................................................................................245

2.1.2.12 Run management ........................................................................................................245


ECodedImage::GetCurrentRunData ............................................................................................245
ECodedImage::GetFirstRunData .................................................................................................245
ECodedImage::GetLastRunData .................................................................................................245
ECodedImage::GetPreviousRunData ..........................................................................................246
ECodedImage::GetNextRunData.................................................................................................246
ECodedImage::GetCurrentRunPtr ...............................................................................................246
ECodedImage::GetFirstRunPtr ....................................................................................................246
ECodedImage::SetFirstRunPtr.....................................................................................................246
ECodedImage::GetLastRunPtr ....................................................................................................246
ECodedImage::SetLastRunPtr.....................................................................................................247
ECodedImage::GetPreviousRunPtr .............................................................................................247
ECodedImage::GetNextRunPtr....................................................................................................247
ECodedImage::GetRunDataPtr....................................................................................................247
ECodedImage::GetRunData ........................................................................................................247
ECodedImage::GetNumRuns ......................................................................................................248
ECodedImage::GetNumHoleRuns ...............................................................................................248
ECodedImage::GetObjFirstRunPtr...............................................................................................248
ECodedImage::GetNumObjectRuns ............................................................................................248
ECodedImage::GetRunPtr ...........................................................................................................249
ECodedImage::GetRunPtrByCoordinates....................................................................................249
ECodedImage::RemoveAllRuns ..................................................................................................249
ECodedImage::RemoveRun ........................................................................................................249

2.1.2.13 Feature management ..................................................................................................249


ECodedImage::GetObjectFeature................................................................................................249
ECodedImage::AddFeat...............................................................................................................250
ECodedImage::BlankFeatures .....................................................................................................250
ECodedImage::GetFeatArrayPtr ..................................................................................................250
ECodedImage::GetFeatDataPtr ...................................................................................................251
ECodedImage::GetFeatDataSize.................................................................................................251
ECodedImage::GetFeatDataType................................................................................................251
ECodedImage::GetFeatNum........................................................................................................252
ECodedImage::GetFeatPtrByNum...............................................................................................252
ECodedImage::GetFeatSize ........................................................................................................252
ECodedImage::GetNumFeatures.................................................................................................252
ECodedImage::RemoveAllFeats..................................................................................................252
ECodedImage::SetFeatInfo..........................................................................................................253

2.1.2.14 Geometry .....................................................................................................................253


ECodedImage::GetYOriginOffset.................................................................................................253

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

EFeatureData structure .....................................................................................................258


EObjectData structure .......................................................................................................258
ERunData structure ...........................................................................................................259
EListItem structure ............................................................................................................259

6. SAMPLE PROGRAMS...............................................................................................................260

EASYGAUGE: SUBPIXEL MEASUREMENT ...........................................261


1. EASYGAUGE INTRODUCTION ................................................................................................263
2. CLASSES AND CLASS MEMBERS..........................................................................................264
2.1 E...Gauge Common Members ...........................................................................................264
2.1.1 E Gauge overview [Common Members] ........................................................................264
2.1.2 E... Gauge Common Class Members ................................................................................264
2.1.2.1 Gauge copying.............................................................................................................264
EGauge::CopyTo......................................................................................................................264
EGauge::Operator= ..................................................................................................................265

2.1.2.2 Gauge position.............................................................................................................266


EGauge::Get/Set Center ..........................................................................................................266

2.1.2.3 Gauge grouping ...........................................................................................................266


EGauge::Attach ........................................................................................................................266
EGauge::Detach .......................................................................................................................266
EGauge::DetachDaughters ......................................................................................................266
EGauge::GetNumDaughters ....................................................................................................266
EGauge::GetMother .................................................................................................................267
EGauge::GetDaughter..............................................................................................................267
EGauge::GetShapeNamed.......................................................................................................267

2.1.2.4 Gauge behavior ...........................................................................................................267


EGauge::Get/Set Active ...........................................................................................................267
EGauge::Get/Set Labeled ........................................................................................................267
EGauge::Get/Set OptionalDraw ...............................................................................................268
EGauge::Get/Set QuickDraw....................................................................................................268

2.1.2.5 Transition parameters..................................................................................................269


EGauge::Get/Set TransitionType .............................................................................................269
EGauge::Get/Set TransitionChoice ..........................................................................................269
EGauge::Get/Set TransitionIndex.............................................................................................269
EGauge::Get/Set Threshold .....................................................................................................270
EGauge::Get/Set MinAmplitude ...............................................................................................270
EGauge::Get/Set MinArea........................................................................................................271
EGauge::Get/Set Thickness .....................................................................................................271
EGauge::Get/Set RectangularSamplingArea ...........................................................................271
EGauge::Get/Set Smoothing ....................................................................................................272

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

C++ Reference Manual 6.7.1

EGauge::AddSkipRange ..........................................................................................................275
EGauge::GetNumSkipRanges..................................................................................................276
EGauge::GetSkipRange ...........................................................................................................276
EGauge::RemoveSkipRange ...................................................................................................276

2.1.2.7 Measurement results ...................................................................................................276


EGauge::RemoveAllSkipRanges..............................................................................................276
E...Gauge::GetMeasuredPoint .....................................................................................................277
E...Gauge::GetValid .....................................................................................................................278
EGauge::GetNumSamples .......................................................................................................279
EGauge::GetNumValidSamples ...............................................................................................279
EGauge::GetAverageDistance .................................................................................................279
EGauge::GetMeasuredPeak ....................................................................................................279
EPoint::Distance...........................................................................................................................279

2.1.2.8 Graphical interaction....................................................................................................280


EGauge::Draw ..........................................................................................................................280
EGauge::SetCursor ..................................................................................................................281
EGauge::HitTest .......................................................................................................................281
EGauge::GetHitHandle.............................................................................................................281
EGauge::GetHitShape..............................................................................................................281
EGauge::Drag...........................................................................................................................281
EGauge::Plot ............................................................................................................................281
EGauge::Get/Set Dragable.......................................................................................................282
EGauge::Get/Set Rotatable......................................................................................................282
EGauge::Get/Set Resizable .....................................................................................................282
E...Gauge::Get/Set DraggingMode ..............................................................................................283

2.1.2.9 Persistent storage........................................................................................................283


EGauge::Save ..........................................................................................................................283
EGauge::Load ..........................................................................................................................283

2.1.2.10 Miscellaneous ..............................................................................................................284


EGauge::GetType.....................................................................................................................284

2.2 EPointGauge ......................................................................................................................284


2.2.1 EPointGauge overview ......................................................................................................284
2.2.2 EPointGauge Class Members ...........................................................................................285
2.2.2.1 EPointGauge Construction ..........................................................................................285
Default constructor .......................................................................................................................285
Copy constructor ..........................................................................................................................286

2.2.2.2 Gauge Position ............................................................................................................286


EPointGauge::GetTolerance ........................................................................................................286
EPointGauge::SetTolerance ........................................................................................................286
EPointGauge::GetToleranceAngle...............................................................................................286

2.2.2.3 Measurement Results..................................................................................................287


EPointGauge::GetNumMeasuredPoints ......................................................................................287

2.3 ELineGauge ........................................................................................................................287


2.3.1 ELineGauge overview........................................................................................................287
2.3.2 ELineGauge Class Members.............................................................................................288
2.3.2.1 ELineGauge Construction............................................................................................288
Default constructor .......................................................................................................................288
Copy constructor ..........................................................................................................................288

2.3.2.2 Gauge Position ............................................................................................................289


ELineGauge::Set..........................................................................................................................289
ELineGauge::Get/Set Length .......................................................................................................289
ELineGauge::Get Org/End ...........................................................................................................290
ELineGauge::Get/Set Angle.........................................................................................................290

xx

Table Of Contents

ELineGauge::Get/Set Tolerance ..................................................................................................290

2.3.2.3 Measurement...............................................................................................................291
ELineGauge::Get/Set KnownAngle..............................................................................................291
ELineGauge::Get/Set ClippingMode ............................................................................................291

2.3.2.4 Measurement Results..................................................................................................291


ELineGauge::GetMeasuredLine...................................................................................................291
ELineGauge::GetPoint .................................................................................................................292

2.4 ECircleGauge .....................................................................................................................292


2.4.1 ECircleGauge Overview.....................................................................................................292
2.4.2 ECircleGauge Class Members ..........................................................................................293
2.4.2.1 ECircleGauge Construction .........................................................................................293
Default constructor .......................................................................................................................293
Copy constructor ..........................................................................................................................293

2.4.2.2 Gauge Position ............................................................................................................294


ECircleGauge::Set .......................................................................................................................294
ECircleGauge::Get/Set Radius ....................................................................................................295
ECircleGauge::Get/Set Diameter .................................................................................................295
ECircleGauge::GetArcLength.......................................................................................................295
ECircleGauge::GetOrgAngle........................................................................................................296
ECircleGauge::GetApexAngle......................................................................................................296
ECircleGauge::GetEndAngle .......................................................................................................296
ECircleGauge::GetAmplitude .......................................................................................................297
ECircleGauge::GetOrg .................................................................................................................297
ECircleGauge::GetApex...............................................................................................................297
ECircleGauge::GetEnd.................................................................................................................297
ECircleGauge::GetFull .................................................................................................................297
ECircleGauge::GetDirect..............................................................................................................297
ECircleGauge::Get/Set Tolerance................................................................................................298

2.4.2.3 Measurement...............................................................................................................298
ECircleGauge::Get/Set InnerFilteringThreshold...........................................................................298
ECircleGauge::DisableInnerFiltering............................................................................................298
ECircleGauge::IsInnerFilteringEnabled........................................................................................299

2.4.2.4 Measurement Results..................................................................................................299


ECircleGauge::GetMeasuredCircle..............................................................................................299
ECircleGauge::GetPoint...............................................................................................................299

2.5 ERectangleGauge ..............................................................................................................299


2.5.1.1 ERectantgleGauge Overview ......................................................................................299
2.5.2 ERectangleGauge Class Members ...................................................................................301
2.5.2.1 ERectangleGauge construction...................................................................................301
Default constructor .......................................................................................................................301
Copy constructor ..........................................................................................................................301

2.5.2.2 Gauge Position ............................................................................................................301


ERectangleGauge::Set ................................................................................................................301
ERectangleGauge::SetSize .........................................................................................................302
ERectangleGauge::GetSize X/Y ..................................................................................................302
ERectangleGauge::GetMidEdges ................................................................................................302
ERectangleGauge::GetCorners ...................................................................................................303
ERectangleGauge::GetEdges......................................................................................................303
ERectangleGauge::Get/Set Angle ...............................................................................................303
ERectangleGauge::Get/Set Tolerance.........................................................................................303

2.5.2.3 Transition Parameters .................................................................................................304


ERectangleGauge::Get/Set ActiveEdges.....................................................................................304

2.5.2.4 Measurement...............................................................................................................304

xxi

C++ Reference Manual 6.7.1

ERectangleGauge::Get/Set KnownAngle ....................................................................................304


ERectangleGauge::Get/Set InnerFilteringThreshold....................................................................305
ERectangleGauge::DisableInnerFiltering.....................................................................................305
ERectangleGauge::IsInnerFilteringEnabled.................................................................................305

2.5.2.5 Measurement Results..................................................................................................306


ERectangleGauge::GetMeasuredRectangle................................................................................306
ERectangleGauge::GetPoint........................................................................................................306

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

2.6.2.2 Gauge Position ............................................................................................................308


EWedgeGauge::Set .....................................................................................................................308
EWedgeGauge::SetRadii .............................................................................................................309
EWedgeGauge::SetDiameters.....................................................................................................309
EWedgeGauge::Get Inner/Outer Radius .....................................................................................310
EWedgeGauge::Get Inner/Outer Diameter ..................................................................................310
EWedgeGauge::GetBreadth ........................................................................................................310
EWedgeGauge::Get Inner/Outer ArcLength ................................................................................310
EWedgeGauge::GetOrgAngle......................................................................................................311
EWedgeGauge::Get Inner/Outer Apex ........................................................................................311
EWedgeGauge::GetApexAngle ...................................................................................................311
EWedgeGauge::GetEndAngle .....................................................................................................312
EWedgeGauge::GetAmplitude.....................................................................................................312
EWedgeGauge::Get Inner/Outer Org...........................................................................................312
EWedgeGauge::Get Inner/Outer End ..........................................................................................313
EWedgeGauge::GetDirect ...........................................................................................................313
EWedgeGauge::GetMidEdges.....................................................................................................313
EWedgeGauge::GetCorners ........................................................................................................313
EWedgeGauge::GetEdges...........................................................................................................314
EWedgeGauge::Get/Set Tolerance .............................................................................................314

2.6.2.3 Transition Parameters .................................................................................................314


EWedgeGauge::Get/Set ActiveEdges .........................................................................................314

2.6.2.4 Measurement Results..................................................................................................315


EWedgeGauge::GetMeasuredWedge .........................................................................................315
EWedgeGauge::GetPoint.............................................................................................................315

2.7 EFrameShape .....................................................................................................................315


2.7.1 EframeShape Overview .....................................................................................................315
2.7.2 EFrameShape Class Members..........................................................................................316
2.7.2.1 Construction.................................................................................................................316
EFrameShape Constructor ..........................................................................................................316

2.7.2.2 Frame Position.............................................................................................................316


EFrameShape::Set.......................................................................................................................316
EFrameShape::SetCenter............................................................................................................316
EFrameShape::SetAngle .............................................................................................................317
EFrameShape::SetSize................................................................................................................317
EFrameShape::GetSize X/Y ........................................................................................................317

2.7.2.3 Frame grouping ...........................................................................................................317


EFrameShape::Attach..................................................................................................................317
EFrameShape::Detach.................................................................................................................317
EFrameShape::DetachDaughters ................................................................................................318
EFrameShape::GetMother ...........................................................................................................318

xxii

Table Of Contents

EFrameShape::GetNumDaughters ..............................................................................................318
EFrameShape::GetDaughter .......................................................................................................318

2.7.2.4 Graphical interaction....................................................................................................318


EFrameShape::Draw....................................................................................................................318
EFrameShape::HitTest.................................................................................................................318
EFrameShape::Drag ....................................................................................................................319
EFrameShape::Get/Set Dragable ................................................................................................319
EFrameShape::Get/Set Rotatable ...............................................................................................319
EFrameShape::Get/Set Resizable ...............................................................................................319

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

EASYOCR: PRINTED CHARACTER RECOGNITION...............................327


1. EASYOCR: INTRODUCTION ....................................................................................................329
2. CLASSES AND CLASS MEMBERS..........................................................................................333
2.1 EOCR ..................................................................................................................................333
2.1.1 EOCR: Overview................................................................................................................333
2.1.2 EOCR Class Members.......................................................................................................333
2.1.2.1 Construction.................................................................................................................333
EOCR Construction......................................................................................................................333

2.1.2.2 Recognition Parameters ..............................................................................................333


EOCR::Get/SetCharSpacing........................................................................................................333
EOCR::Get/SetMaxCharHeight....................................................................................................334
EOCR::Get/SetMaxCharWidth.....................................................................................................334
EOCR::Get/SetMinCharHeight.....................................................................................................334
EOCR::Get/SetMinCharWidth......................................................................................................335
EOCR::Get/SetRemoveNarrowOrFlat..........................................................................................335
EOCR::Get/SetNoiseArea............................................................................................................335
EOCR::Get/SetCompareAspectRatio ..........................................................................................336
EOCR::Get/SetSegmentationMode .............................................................................................336
EOCR::Get/SetCutLargeChars ....................................................................................................336
EOCR::Get/SetRelativeSpacing...................................................................................................336
EOCR::Get/SetRemoveBorder ....................................................................................................337
EOCR::Get/SetTextColor .............................................................................................................337
EOCR::Get/SetThreshold.............................................................................................................337
EOCR::GetTrueThreshold............................................................................................................338
EOCR::Get/Set MatchingMode ....................................................................................................338
EOCR::Get/Set ShiftXTolerance ..................................................................................................338
EOCR::Get/Set ShiftYTolerance ..................................................................................................339
EOCR::Get/Set ShiftingMode.......................................................................................................339

xxiii

C++ Reference Manual 6.7.1

2.1.2.3 Recognition ..................................................................................................................339


EOCR::EmptyChars .....................................................................................................................339
EOCR::AddChar...........................................................................................................................339
EOCR::BuildObjects.....................................................................................................................340
EOCR::FindAllChars ....................................................................................................................340
EOCR::MatchChar .......................................................................................................................340
EOCR::ReadText .........................................................................................................................340
EOCR::Recognize........................................................................................................................341

2.1.2.4 Recognized Characters ...............................................................................................342


EOCR::GetNumChars..................................................................................................................342
EOCR::CharGetOrgX...................................................................................................................342
EOCR::CharGetOrgY...................................................................................................................342
EOCR::CharGetDstX ...................................................................................................................342
EOCR::CharGetDstY ...................................................................................................................343
EOCR::CharGetWidth ..................................................................................................................343
EOCR::CharGetHeight.................................................................................................................343
EOCR::CharGetTotalOrgX...........................................................................................................343
EOCR::CharGetTotalOrgY...........................................................................................................343
EOCR::CharGetTotalDstX ...........................................................................................................343
EOCR::CharGetTotalDstY ...........................................................................................................344
EOCR::GetFirstCharCode............................................................................................................344
EOCR::GetFirstCharDistance ......................................................................................................344
EOCR::GetSecondCharCode ......................................................................................................344
EOCR::GetSecondCharDistance .................................................................................................344
EOCR::GetConfidenceRatio ........................................................................................................345

2.1.2.5 Learning .......................................................................................................................345


EOCR::AddPatternFromImage ....................................................................................................345
EOCR::HitChar.............................................................................................................................345
EOCR::HitChars...........................................................................................................................346
EOCR::LearnPattern ....................................................................................................................346
EOCR::LearnPatterns ..................................................................................................................346
EOCR::RemovePattern................................................................................................................347
EOCR::GetNumPatterns ..............................................................................................................347
EOCR::GetPatternCode...............................................................................................................347
EOCR::GetPatternClass ..............................................................................................................347
EOCR::GetPatternBitmap ............................................................................................................347
EOCR::Load.................................................................................................................................348
EOCR::NewFont ..........................................................................................................................348
EOCR::GetPatternWidth ..............................................................................................................348
EOCR::GetPatternHeight .............................................................................................................348
EOCR::Save.................................................................................................................................348
EOCR::Dump ...............................................................................................................................348

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.2.2.2 Finding properties ........................................................................................................358


PatternFinder::AngleBias property ...............................................................................................358
PatternFinder::AngleTolerance property ......................................................................................358
PatternFinder::ContrastMode property.........................................................................................358
PatternFinder::FindExtension property ........................................................................................358
PatternFinder::MaxInstances property .........................................................................................359
PatternFinder::MinScore property ................................................................................................359
PatternFinder::ScaleBias property ...............................................................................................359
PatternFinder::ScaleTolerance property ......................................................................................359

2.2.2.3 Advanced properties....................................................................................................359


PatternFinder::Interpolate property ..............................................................................................359
PatternFinder::CoarseStage property ..........................................................................................359
PatternFinder::FineStage property...............................................................................................360
PatternFinder::MaxFeaturePoints property ..................................................................................360
PatternFinder::MinFeaturePoints property ...................................................................................360

2.2.3 PatternFinder Methods ......................................................................................................360


2.2.3.1 Construction.................................................................................................................360
PatternFinder construction ...........................................................................................................360

2.2.3.2 Operations ...................................................................................................................360


PatternFinder::Find ......................................................................................................................360
PatternFinder::Learn ....................................................................................................................361
PatternFinder::LearningDone.......................................................................................................361

2.2.3.3 Graphical Interaction....................................................................................................361


PatternFinder::DrawModel ...........................................................................................................361

2.2.3.4 Persistent storage........................................................................................................361


PatternFinder::Load .....................................................................................................................361
PatternFinder::Save .....................................................................................................................362

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

2.3.3 FoundPattern Methods ......................................................................................................364


2.3.3.1 Graphical interaction....................................................................................................364

xxv

C++ Reference Manual 6.7.1

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

EASYMATCH: PATTERN MATCHING ....................................................367


1. EASYMATCH: INTRODUCTION ...............................................................................................369
2. CLASSES AND CLASS MEMBERS..........................................................................................372
2.1 EMatch ................................................................................................................................372
2.1.1 EMatch Overview...............................................................................................................372
2.1.2 EMatch Class Members.....................................................................................................372
2.1.2.1 Construction/Destruction .............................................................................................372
Default constructor .......................................................................................................................372
Copy constructor ..........................................................................................................................372
Other constructor .........................................................................................................................372
EMatch::CopyTo ..........................................................................................................................373
EMatch::Operator=.......................................................................................................................373

2.1.2.2 Learning and Matching ................................................................................................373


EMatch::LearnPattern ..................................................................................................................373
EMatch::IsPatternLearnt ..............................................................................................................374
EMatch::CreatePatternCopy ........................................................................................................374
EMatch::ClearImage ....................................................................................................................374
EMatch::Match .............................................................................................................................374

2.1.2.3 Learning Parameters ...................................................................................................374


EMatch::Get/Set MinReducedArea ..............................................................................................374
EMatch::Get/Set DontCareThreshold ..........................................................................................375
EMatch::Get/Set FilteringMode ....................................................................................................375
EMatch::GetPattern Width/Height ................................................................................................376

2.1.2.4 Matching Parameters...................................................................................................376


EMatch::Get/SetCorrelationMode ................................................................................................376
EMatch::Get/SetContrastMode ....................................................................................................376
EMatch::Get/SetInterpolate..........................................................................................................376
EMatch::GetNumReductions........................................................................................................377
EMatch::Get/SetMaxPositions .....................................................................................................377
EMatch::Get/SetFinalReduction...................................................................................................377
EMatch::Get/SetMaxInitialPositions .............................................................................................378
EMatch::Get/SetMinScore............................................................................................................378
EMatch::Get/SetInitialMinScore ...................................................................................................378
EMatch::Get/SetPixelDimensions ................................................................................................379
EMatch::Get/SetMinAngle............................................................................................................379
EMatch::Get/SetMaxAngle...........................................................................................................380
EMatch::Get/SetMinScale ............................................................................................................380
EMatch::Get/SetMaxScale ...........................................................................................................380
EMatch::Get/SetMinScaleX..........................................................................................................381
EMatch::Get/SetMaxScaleX.........................................................................................................381
EMatch::Get/SetMinScaleY..........................................................................................................381
EMatch::Get/SetMaxScaleY.........................................................................................................382

xxvi

Table Of Contents

EMatch::GetIsotropicScale...........................................................................................................382
EMatch::GetAngleStep.................................................................................................................382
EMatch::GetScaleStep.................................................................................................................382
EMatch::GetScaleX/YStep ...........................................................................................................383
EMatch::SetExtension..................................................................................................................383

2.1.2.5 Matching Results .........................................................................................................383


EMatch::GetNumPositions ...........................................................................................................383
EMatch::GetPosition ....................................................................................................................383
EMatch::DrawPosition..................................................................................................................383
EMatch::DrawPositions ................................................................................................................384

2.1.2.6 Persistent storage........................................................................................................384


EMatch::Load ...............................................................................................................................384
EMatch::Save...............................................................................................................................385
EMatch::GetVersion .....................................................................................................................386

2.2 EMatchPosition ..................................................................................................................387


2.2.1 EMatchPosition Class Members........................................................................................387
3. ENUMERATION CONSTANTS..................................................................................................388
3.1 enum E_CORRELATION_MODE .......................................................................................388
3.2 enum MCH_CONTRAST_MODE........................................................................................388
3.3 enum MCH_FILTERING_MODE.........................................................................................388
4. SAMPLE PROGRAMS...............................................................................................................389

EASYOCV: OPTICAL CHARACTER VERIFICATION ..............................391


1. EASYOCV: INTRODUCTION.....................................................................................................393
2. CLASSES AND CLASS MEMBERS..........................................................................................401
2.1 EOCV...................................................................................................................................401
2.1.1 EOCV Overview.................................................................................................................401
2.1.2 EOCV Class Members.......................................................................................................401
2.1.2.1 Construction.................................................................................................................401
EOCV: Construction.....................................................................................................................401

2.1.2.2 Persistent storage........................................................................................................401


EOCV::Load .................................................................................................................................401
EOCV::Save.................................................................................................................................402
EOCV::Dump ...............................................................................................................................402

2.1.2.3 Template Drawing........................................................................................................402


EOCV::DrawTemplateObjects .....................................................................................................402
EOCV::DrawTemplateChars ........................................................................................................402
EOCV::DrawTemplateTexts.........................................................................................................403
EOCV::DrawTemplateTextsChars ...............................................................................................403

2.1.2.4 Sample drawing ...........................................................................................................404


EOCV::DrawText..........................................................................................................................404
EOCV::DrawTexts........................................................................................................................404
EOCV::DrawTextChars ................................................................................................................404
EOCV::DrawTextsChars ..............................................................................................................405
EOCV::GetTextPoint ....................................................................................................................405
EOCV::GetTextCharPoint ............................................................................................................406

2.1.2.5 Template image ...........................................................................................................407


EOCV::Get/SetTemplateImage....................................................................................................407

xxvii

C++ Reference Manual 6.7.1

EOCV::m_TemplateImage ...........................................................................................................407

2.1.2.6 Free objects management ...........................................................................................408


EOCV::m_Objects........................................................................................................................408
EOCV::CreateTemplateObjects ...................................................................................................408
EOCV::SelectTemplateObjects....................................................................................................408
EOCV::DeleteTemplateObjects ...................................................................................................408

2.1.2.7 Free characters management .....................................................................................409


EOCV::m_FreeChars ...................................................................................................................409
EOCV::CreateTemplateChars......................................................................................................409
EOCV::SelectTemplateChars ......................................................................................................409
EOCV::DeleteTemplateChars ......................................................................................................410

2.1.2.8 Template texts management .......................................................................................410


EOCV::m_Texts ...........................................................................................................................410
EOCV::CreateTemplateTexts ......................................................................................................410
EOCV::SelectTemplateTexts .......................................................................................................411
EOCV::DeleteTemplateTexts.......................................................................................................411

2.1.2.9 Text parameters...........................................................................................................412


EOCV::GetNumTexts...................................................................................................................412
EOCV::Get/SetTextParameters ...................................................................................................412
EOCV::Get/SetTextParameters ...................................................................................................413
EOCV::Gather/ScatterTextsParameters ......................................................................................413
EOCV::Gather/ScatterTextsParameters ......................................................................................414

2.1.2.10 Text character parameters...........................................................................................414


EOCV::GetNumTextChars ...........................................................................................................415
EOCV::Get/SetTextCharParameters ...........................................................................................415
EOCV::Get/SetTextCharParameters ...........................................................................................415
EOCV::Gather/ScatterTextsCharsParameters.............................................................................416
EOCV::Gather/ScatterTextsCharsParameters.............................................................................416

2.1.2.11 Sample Texts and character selection ........................................................................417


EOCV::SelectSampleTexts ..........................................................................................................417
EOCV::SelectSampleTextsChars ................................................................................................418

2.1.2.12 Learning .......................................................................................................................418


EOCV::Learn................................................................................................................................418
EOCV::ComputeDefaultTolerances .............................................................................................418

2.1.2.13 Contrast options...........................................................................................................419


EOCV::Get/SetWhiteOnBlack ......................................................................................................420

2.1.2.14 Location options...........................................................................................................420


2.1.2.15 Inspection options........................................................................................................420
EOCV::Get/SetUsedQualityIndicators..........................................................................................420
EOCV: Get/SetResampleChars ...................................................................................................421
EOCV::Get/SetReduceLocationScore .........................................................................................421
EOCV::Get/SetNormalizeLocationScore......................................................................................421
EOCV::Get/SetAccurateTextsLocationScore...............................................................................422

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

2.2.2.1 EOCVChar: Character statistics ..................................................................................428


EOCVChar: Miscellaneous character parameters .......................................................................429

2.3 EOCVText ...........................................................................................................................429


2.3.1 EOCVText Overview..........................................................................................................429
2.3.2 EOCVText Class Members................................................................................................429
EOCVText::ResetParameters ......................................................................................................429
EOCVText: Text location parameters ..........................................................................................430
EOCVText: Text position parameters ..........................................................................................430
EOCVText: Text inspection parameters.......................................................................................431
EOCVText: Text statistics ............................................................................................................432
EOCVText: Miscellaneous text parameters .................................................................................433

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

ECHECKER: FLAW DETECTION BY IMAGE COMPARISON ..................437


1. ECHECKER: INTRODUCTION ..................................................................................................439
2. CLASSES AND CLASS MEMBERS..........................................................................................440
2.1 EChecker ............................................................................................................................440
2.1.1 EChecker Overview ...........................................................................................................440
2.1.2 EChecker Class Members .................................................................................................440
2.1.2.1 Construction.................................................................................................................440
EChecker Construction ................................................................................................................440

2.1.2.2 Source Image ..............................................................................................................440


EChecker::Attach .........................................................................................................................440
EChecker::GetSrcImage ..............................................................................................................440

2.1.2.3 Search Tolerances.......................................................................................................440


EChecker::GetTolerance X/Y.......................................................................................................440
EChecker::SetTolerance ..............................................................................................................441

2.1.2.4 Allowed Degrees of Freedom ......................................................................................441


EChecker::Get/Set DegreesOfFreedom ......................................................................................441

2.1.2.5 Gray-level Normalisation .............................................................................................441


EChecker::Get/Set Normalize ......................................................................................................441
EChecker::GetAverage ................................................................................................................441
EChecker::GetDeviation...............................................................................................................442
EChecker::GetDarkGray ..............................................................................................................442

xxix

C++ Reference Manual 6.7.1

EChecker::GetLightGray ..............................................................................................................442

2.1.2.6 Learning .......................................................................................................................442


EChecker::Register ......................................................................................................................442
EChecker::Learn ..........................................................................................................................442
EChecker::Get/Set RelativeTolerance .........................................................................................443

2.1.2.7 Batch Learning.............................................................................................................443


EChecker::EmptyPathNames ......................................................................................................443
EChecker::AddPathName ............................................................................................................443
EChecker::BatchLearn .................................................................................................................444

2.1.2.8 Drawing........................................................................................................................444
EChecker::Draw ...........................................................................................................................444

2.1.2.9 Dragging ......................................................................................................................444


EChecker::HitTest ........................................................................................................................444
EChecker::GetHitHandle..............................................................................................................444
EChecker::GetHitRoi....................................................................................................................445
EChecker::Drag............................................................................................................................445

2.1.2.10 Zooming and Panning..................................................................................................445


EChecker::SetZoom.....................................................................................................................445
EChecker::SetPan........................................................................................................................445
EChecker::GetZoom X/Y..............................................................................................................445
EChecker::GetPan X/Y ................................................................................................................446

2.1.2.11 Persistent storage........................................................................................................446


EChecker::Save ...........................................................................................................................446
EChecker::Load ...........................................................................................................................446

2.1.2.12 Miscellaneous ..............................................................................................................446


EChecker::GetNumAverageSamples...........................................................................................446
EChecker::GetNumDeviationSamples .........................................................................................446

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

EASYBARCODE: BAR CODE READING .................................................449


1. EASYBARCODE: INTRODUCTION ..........................................................................................451
2. CLASSES AND CLASS MEMBERS..........................................................................................452
2.1 EBarCode Overview...........................................................................................................452
2.2 EBarCode Class Members ................................................................................................452
2.2.1 Construction/Destruction....................................................................................................452
EBarCode Constructor .................................................................................................................452
~ EBarCode Destructor ................................................................................................................452

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

2.2.3 Symbologies ......................................................................................................................455


EBarCode::Get/Set StandardSymbologies ..................................................................................455
EBarCode::Get/Set AdditionalSymbologies .................................................................................455

2.2.4 Reading mode....................................................................................................................456


EBarCode::Get/Set KnownLocation.............................................................................................456
EBarCode::Get/Set KnownModule...............................................................................................456

2.2.5 Reading parameters ..........................................................................................................456


EBarCode::Get/Set Module..........................................................................................................456
EBarCode::Get/Set ThicknessRatio.............................................................................................457
EBarCode::Get/Set VerifyChecksum ...........................................................................................457

2.2.6 Reading area .....................................................................................................................458


EBarCode::Set .............................................................................................................................458
EBarCode::SetReadingCenter .....................................................................................................458
EBarCode::GetRelativeReading X/Y............................................................................................458
EBarCode::SetReadingSize.........................................................................................................458
EBarCode::GetRelativeReadingSize X/Y.....................................................................................459
EBarCode::Get/Set ReadingAngle...............................................................................................459

2.2.7 Graphical interaction ..........................................................................................................459


EBarCode::Draw ..........................................................................................................................459
EBarCode::HitTest .......................................................................................................................459
EBarCode::Drag...........................................................................................................................460
EBarCode::SetZoom ....................................................................................................................460
EBarCode::GetZoom X/Y.............................................................................................................460
EBarCode::SetPan.......................................................................................................................460
EBarCode::GetPan X/Y................................................................................................................460

3. ENUMERATION CONSTANTS..................................................................................................461
3.1 enum BRC_SYMBOLOGIES ..............................................................................................461
4. SAMPLE PROGRAMS...............................................................................................................462

EASYMATRIXCODE: DATA MATRIX CODE READING...........................463


1. EASYMATRIXCODE: INTRODUCTION ....................................................................................465
2. EASYMATRIXCODE: WHAT'S NEW? ......................................................................................466
3. CLASSES...................................................................................................................................467
3.1 EasyMatrixCode: Introduction to Classes .......................................................................467
3.2 MatrixCode .........................................................................................................................467
3.2.1 MatrixCode Overview.........................................................................................................467
3.2.2 MatrixCode Properties and Methods .................................................................................468
3.2.2.1 Properties.....................................................................................................................468
MatrixCode::DecodedString property...........................................................................................468
MatrixCode::Center property........................................................................................................468
MatrixCode::Angle property .........................................................................................................468
MatrixCode::Corners[4] property..................................................................................................468
MatrixCode::NumErrors property .................................................................................................469

xxxi

C++ Reference Manual 6.7.1

MatrixCode::LogicalSize property ................................................................................................469


MatrixCode::ContrastType property .............................................................................................469
MatrixCode::Flipping property ......................................................................................................469
MatrixCode::Family property ........................................................................................................469
MatrixCode::LogicalSizeWidth property .......................................................................................469
MatrixCode::LogicalSizeHeight property......................................................................................469
MatrixCode::LocationThreshold property .....................................................................................469
MatrixCode::ReadingThreshold property .....................................................................................469
MatrixCode::IsFound property......................................................................................................469
MatrixCode::Contrast property .....................................................................................................470
MatrixCode::ContrastGrade property ...........................................................................................470
MatrixCode::PrintGrowth property................................................................................................470
MatrixCode::MeasuredPrintGrowth property................................................................................470
MatrixCode::PrintGrowthGrade property......................................................................................471
MatrixCode::AxialNonuniformity property.....................................................................................471
MatrixCode::AxialNonUniformityGrade property ..........................................................................471
MatrixCode::UnusedErrorCorrection property..............................................................................472
MatrixCode::UnusedErrorCorrectionGrade property....................................................................472
MatrixCode::OverallGrade property .............................................................................................472

3.2.2.2 Methods .......................................................................................................................472


Default constructor .......................................................................................................................472
Copy constructor ..........................................................................................................................473
MatrixCode::Draw ........................................................................................................................473
MatrixCode::DrawErrors...............................................................................................................473

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

3.4 MatrixCodeReader .............................................................................................................475


3.4.1 MatrixCodeReader Overview.............................................................................................475
3.4.2 MatrixCodeReader Properties and Methods .....................................................................475
PropertiesMatrixCodeReader::LearnMask property.....................................................................475
MatrixCodeReader::SearchParams property ...............................................................................475
MatrixCodeReader::ComputeGrading property ...........................................................................475
MatrixCodeReader::MinimumPrintGrowth property .....................................................................476
MatrixCodeReader::MaximumPrintGrowth property ....................................................................476
MatrixCodeReader::NominalPrintGrowth property.......................................................................476
MatrixCodeReader::TimeOut property .........................................................................................476

3.4.2.1 Methods .......................................................................................................................477


MatrixCodeReader::Reset............................................................................................................477
MatrixCodeReader::Read ............................................................................................................477
MatrixCodeReader::Learn............................................................................................................477
MatrixCodeReader::LearnMore....................................................................................................477
MatrixCodeReader::Load .............................................................................................................478
MatrixCodeReader::Save.............................................................................................................479

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

4.6 enum Handles::Type..........................................................................................................482


5. SAMPLE PROGRAMS...............................................................................................................483

EASYBGA: BGA INSPECTION ...............................................................484


1. EASYBGA: INTRODUCTION ....................................................................................................485
2. CLASSES AND CLASS MEMBERS..........................................................................................486
2.1 EBGA ..................................................................................................................................486
2.1.1 EBGA Overview .................................................................................................................486
2.1.2 EBGA Class Members .......................................................................................................486
2.1.2.1 Construction/Destruction .............................................................................................486
EBGA Construction ......................................................................................................................486
EBGA Destruction ........................................................................................................................487

2.1.2.2 Measurement units ......................................................................................................487


EBGA::Get/Set Unit......................................................................................................................487

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

2.1.2.4 Quality Indicators .........................................................................................................495


EBGA::GetSetEnabledQualityDiagnostics ...................................................................................495
EBGA::GetSetEnabledQualityStatistics .......................................................................................496
EBGA::GetPackageCenter X/Y....................................................................................................496
EBGA::GetDiagnostics.................................................................................................................496
EBGA::GetDiagnostic...................................................................................................................496
EBGA::GetNumBallsFound..........................................................................................................497
EBGA::GetNumMissingBalls........................................................................................................497
EBGA::GetNumClutter .................................................................................................................497
EBGA::GetNumExtraBalls............................................................................................................497
EBGA::BadBalls ...........................................................................................................................497
EBGA::GetMinimumOffset ...........................................................................................................497
EBGA::GetMaximumOffset ..........................................................................................................498
EBGA::GetAverageOffset ............................................................................................................498
EBGA::GetDeviationOffset...........................................................................................................498

xxxiii

C++ Reference Manual 6.7.1

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

2.1.2.5 Model Edition ...............................................................................................................504


EBGA::GetNumBalls ....................................................................................................................504
EBGA::GetComponentNumBalls .................................................................................................504
EBGA::ArrangeDaughters............................................................................................................504
EBGA::Load .................................................................................................................................504
EBGA::Save .................................................................................................................................504
EBGA::Draw.................................................................................................................................504
EBGA::DrawArrayLabels..............................................................................................................505
EBGA::EnableBehaviorFilter........................................................................................................505
EBGA::DisableBehaviorFilter .......................................................................................................506
EBGA::GetPackage Width/Height................................................................................................506
EBGA::SetPackageSize...............................................................................................................506
EBGA::Get/Set PackageName ....................................................................................................506
EBGA::Get/Set BallDiameter .......................................................................................................507
EBGA::GetBall .............................................................................................................................507
EBGA::GetNumArrays .................................................................................................................507
EBGA::Get/Set CurrentArray .......................................................................................................507
EBGA::GetArray...........................................................................................................................507
EBGA::AddArray ..........................................................................................................................508
EBGA::RemoveArray ...................................................................................................................508
EBGA::GetArrayNumBalls ...........................................................................................................508
EBGA::GetArrayNum Cols/Rows .................................................................................................508
EBGA::SetArrayLogicalSize.........................................................................................................508
EBGA::GetArraySize X/Y .............................................................................................................509
EBGA::SetArrayPhysicalSize.......................................................................................................509
EBGA::GetArrayPitch X/Y ............................................................................................................509
EBGA::SetArrayPitches ...............................................................................................................509
EBGA::GetArrayCenter X/Y .........................................................................................................510
EBGA::SetArrayCenter ................................................................................................................510
EBGA::Get/Set Symmetry............................................................................................................510
EBGA::ToggleBall ........................................................................................................................510
EBGA::ToggleBalls ......................................................................................................................510
EBGA::GetNumComponents .......................................................................................................511
EBGA::SetNumComponents........................................................................................................511
EBGA::SetCurrentComponent .....................................................................................................511

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 EBGABall ............................................................................................................................514


2.2.1 EBGABall Overview ...........................................................................................................514
2.2.2 EBGABall Class Members .................................................................................................514
2.2.2.1 Diagnostics ..................................................................................................................514
EBGABall::GetDiagnostics...........................................................................................................514
EBGABall::GetDiagnostic.............................................................................................................514

2.2.2.2 Ball Measurement........................................................................................................515


EBGABall::GetMeasuredOffset X/Y .............................................................................................515
EBGABall::GetMeasuredDiameter...............................................................................................515
EBGABall::GetMeasuredPitch X/Y...............................................................................................515
EBGABall::GetMeasuredCircularity .............................................................................................515
EBGABall::GetMeasuredDoughnutness ......................................................................................516
EBGABall::GetMeasuredQualityFactor ........................................................................................516

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

2.2.2.4 Position ........................................................................................................................519


EBGABall::GetComponent...........................................................................................................519
EBGABall::GetComponentIndex ..................................................................................................519
EBGABall::GetArray.....................................................................................................................519
EBGABall::GetArrayIndex ............................................................................................................519
EBGABall::GetBallRowIndex .......................................................................................................520

xxxv

C++ Reference Manual 6.7.1

EBGABall::GetBallColIndex .........................................................................................................520

2.3 EBGAArray .........................................................................................................................520


2.3.1 EBGAArray Overview ........................................................................................................520
2.3.2 EBGAArray Class Members ..............................................................................................520
2.3.2.1 Geometry .....................................................................................................................520
Get/Set Staggered .......................................................................................................................520

2.3.2.2 Array label....................................................................................................................521


Get/Set InverseRowNumbering ...................................................................................................521
Get/Set InverseColNumbering .....................................................................................................522

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.2 Diagnostics ..................................................................................................................523


EBGAComponent::GetNumBallsFound .......................................................................................523
EBGAComponent::GetNumMissingBalls .....................................................................................523
EBGAComponent::GetDiagnostics ..............................................................................................523
EBGAComponent::GetDiagnostic ................................................................................................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

EWORLDSHAPE: FIELD OF VIEW CALIBRATION..................................531


1. EWORLDSHAPE: OVERVIEW ..................................................................................................533
2. EWORLDSHAPE CLASS MEMBERS .......................................................................................534
2.1 Calibration ..........................................................................................................................534
EWorldShape::Calibrate...............................................................................................................534
EWorldShape::CalibrationSucceeded..........................................................................................534
EWorldShape::AutoCalibrate .......................................................................................................534
EWorldShape::GetGridPointsMeanVariation ...............................................................................535
EWorldShape::GetGridPointsMaxVariation .................................................................................535
EWorldShape::Get/Set GridPointsMaxVariationThreshold ..........................................................535
EWorldShape::Get/Set GridPointsMeanVariationThreshold........................................................535

2.2 Grid calibration ..................................................................................................................536


EWorldShape::AutoCalibrateDotGrid...........................................................................................536
EWorldShape::AddPoint ..............................................................................................................536
EWorldShape::RebuildGrid ..........................................................................................................536

2.3 Landmark calibration.........................................................................................................537


EWorldShape::EmptyLandmarks .................................................................................................537
EWorldShape::AddLandmark.......................................................................................................537
EWorldShape::AutoCalibrateLandmarks .....................................................................................538

2.4 Explicit calibration .............................................................................................................538


EWorldShape::SetSensor ............................................................................................................538

2.5 Calibration parameters ......................................................................................................539


EWorldShape::SetSensorSize .....................................................................................................539
EWorldShape::GetSensor Width/Height ......................................................................................539
EWorldShape::SetFieldSize.........................................................................................................539
EWorldShape::GetField Width/Height..........................................................................................540
EWorldShape:: SetResolution......................................................................................................540
EWorldShape::Get X/Y Resolution ..............................................................................................540
EWorldShape::GetScale ..............................................................................................................541
EWorldShape::GetRatio...............................................................................................................541
EWorldShape::SetCenter.............................................................................................................541
EWorldShape::GetCenter X/Y......................................................................................................541
EWorldShape::SetAngle ..............................................................................................................541
EWorldShape::GetAngle ..............................................................................................................542
EWorldShape::Get/Set CalibrationModes....................................................................................542
EWorldShape::SetTiltAngles........................................................................................................543
EWorldShape::GetTilt X/Y Angle .................................................................................................543
EWorldShape::Get/Set DistortionStrength ...................................................................................544
EWorldShape::Get/Set PerspectiveStrength ...............................................................................545

2.6 Coordinate Transforms .....................................................................................................546


EWorldShape::SensorToWorld ....................................................................................................546
EWorldShape::WorldToSensor ....................................................................................................546

2.7 Unwarping ..........................................................................................................................547


EWorldShape::SetupUnwarp .......................................................................................................547
EWorldShape::Unwarp.................................................................................................................547

2.8 Persistent storage..............................................................................................................547


EWorldShape::Load .....................................................................................................................547
EWorldShape::Save.....................................................................................................................548

2.9 Graphical interaction .........................................................................................................548

xxxvii

C++ Reference Manual 6.7.1

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

EASYMULTICAM: IMAGE ACQUISITION...............................................553


5. EASYMULTICAM: INTRODUCTION .........................................................................................555
6. EASYMULTICAM AND MULTICAM ..........................................................................................556
7. CLASSES AND CLASS MEMBERS..........................................................................................557
7.1 MultiCamObject..................................................................................................................557
7.1.1 MultiCamObject Overview .................................................................................................557
7.1.2 MultiCamObject Methods...................................................................................................557
MultiCamObject::GetParam .........................................................................................................557
MultiCamObject::SetParam..........................................................................................................558

7.2 Configuration Overview.....................................................................................................559


7.3 Board Overview..................................................................................................................559
7.4 Channel...............................................................................................................................560
7.4.1 Channel Overview..............................................................................................................560
7.4.2 Channel Methods...............................................................................................................561
Channel constructor .....................................................................................................................561
Channel::GetSignalInfo ................................................................................................................561
Channel::Prepare .........................................................................................................................561
Channel::RegisterCallback...........................................................................................................561
Channel::SetActive.......................................................................................................................562
Channel::SetIdle...........................................................................................................................562
Channel::UnregisterCallback .......................................................................................................563
Channel::WaitForSignal ...............................................................................................................563

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

7.6 BoardList ............................................................................................................................565


7.6.1 BoardList Overview............................................................................................................565
7.6.2 BoardList Methods .............................................................................................................565
BoardList::GetBoardByBoardIdentifier .........................................................................................565
BoardList::GetBoardByBoardName .............................................................................................565
BoardList::GetBoardByDriverIndex ..............................................................................................565
BoardList::GetBoardByPciPosition...............................................................................................566
BoardList::GetCount.....................................................................................................................566

xxxviii

Table Of Contents

7.6.3 BoardList Operator.............................................................................................................566


BoardList::operator[ ]....................................................................................................................566

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

Overview of eVision components


The eVision libraries are a set of image processing tools tailored for use in industrial vision
applications. They cover several areas of digital image processing and are grouped in independent
modules as follows:
Easy
is a general purpose library for image data representation and storage. It also handles linear data such
as image profiles, projections, contours, and comprises additional utilities.
EasyImage
includes gray level image processing functions for tasks such as enhancement and restoration, by
linear or non-linear filtering, geometric transformations for registration, histogram analysis for
thresholding These operations are usually performed as preprocessing steps to improve the image
quality and obtain a good contrast between the background and the objects of interest.
EasyColor
includes color level image processing functions and support for alternate color systems (such as HSV,
YUV, L*a*b*). Provides efficient means to convert images between these systems and transform
between color and gray-level images. This library is complementary to EasyImage.
EasyObject
is used for image analysis, that is obtaining information about the distinct objects that are present in an
image. The processing is based on connected component labeling (after a segmentation step by
thresholding), to isolate and identify the objects. Then, various geometric features of the objects, such
as the area or ellipse of inertia parameters, can be computed and the objects can be sorted and
selected with respect to these features.
EasyGauge
is a sub-pixel measurement tool that enables accurate dimensional control of objects. It relies on a
robust algorithm for edge detection and can be used to locate points or fit geometrical models.
When measurement are performed in a calibrated field of view, EasyGauge provides results in physical
units (mm, inch, ) rather than as a number of pixels.
EasyOCR
is a printed character reader for use in applications such as serial number reading or printed label
verification.

C++ Reference Manual 6.7.1

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.

Easy: General Library

Easy: General Library

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).

C++ Reference Manual 6.7.1

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.

Easy: General Library

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.

Graphical representation of an EBW8Vector


(See Draw method)
EBW16Vector: sequence of gray-level pixel values, using an extended range (16 bits), mainly for
intermediate computations. Each element is of type EBW16.

C++ Reference Manual 6.7.1

Graphical representation of an EBW16Vector


(See Draw method)
EBW32Vector: sequence of gray level pixel values, using an extended range (32 bits), mainly for
intermediate computations (used in ImgProjectOnARow, ImgProjectOnAColumn, ...). Each element has
type EBW32.

Graphical representation of an EBW32Vector


(See Draw method)
EC24Vector: sequence of color pixel values, often extracted from an image profile (used by
ImgImageToLineSegment, ImgLineSegmentToImage, ImgProfileDerivative, ...). Each element is of type
EC24.

Easy: General Library

Graphical representation of an EC24Vector


(See Draw method)
EBWHistogramVector: sequence of frequency counts of pixels in a BW8 or BW16 image (used by
ImgIsodataThreshold, ImgHistogram, ImgAnalyseHistogram, ImgSetupEqualize, ...). Each element is of
type UINT32.

Graphical representation of an EBWHistogramVector


(See Draw method)
EPathVector: sequence of pixel coordinates. The corresponding pixels need not be contiguous (used by
ImgPathToImage and ImgContour). Each element is of type EPath.

C++ Reference Manual 6.7.1

Graphical representation of an EPathVector


(See Draw method)
EBW8PathVector: sequence of gray-level pixel values, extracted from an image profile or contour, along
with the corresponding pixel coordinates (used by ImgImageToPath, ImgPathToImage, ...). Each element
is of type EBW8Path.

Graphical representation of an EBW8PathVector


(See Draw method)
EBW16PathVector: sequence of gray-level pixel values, extracted from an image profile or contour, along
with the corresponding pixel coordinates (used by ImgImageToPath, ImgPathToImage, ...). Each element
is of type EBW16Path.

10

Easy: General Library

Graphical representation of an EBW16PathVector


(See Draw method)
EC24PathVector: sequence of color pixel values, extracted from an image profile or contour, along with
the corresponding pixel coordinates (used by ImgImageToPath, ImgPathToImage, ...). Each element is of
type EC24Path.

Graphical representation of an EC24PathVector


(See Draw method)
EPeaksVector: description of peaks found in an image profile (used by ImgGetProfilePeaks). Each
element is of type EPeak.
EColorVector: description of colors (used by ClrClassAverages and ClrClassVariances). Each element is
of type EColor.
Whenever a function uses a vector, the vector type, size and structure is automatically adjusted to suit the
function needs, if necessary. In this documentation, the vectors are described as a generic class,
EVectorTemplate.
The use of vectors is quite straightforward: create a vector of the appropriate type, possibly pre-allocating
a number of elements. You can access any element by means of indexing. You can add an element by
using the AddElement method, or remove all of them by using the Empty method.

11

C++ Reference Manual 6.7.1

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

Predefined data types

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

Image pixel types

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

Type EBW1 is defined as a struct


with member:
UINT32 m_un32Value.

Black and white pixel


value coded as an
unsigned 32 bits integer.

UINT32

EBW8

Type EBW8 is defined as a struct


with member:
UINT8 m_un8Value.

Gray-level pixel value


coded as an unsigned 8
bits integer.

UINT8

EBW16

Type EBW16 is defined as a struct


with member:
UINT16 m_un16Value.

Gray-level pixel value


coded as an unsigned
16 bits integer.

UINT16

EBW32

Type EBW32 is defined as a struct


with member:
UINT32 m_un32Value.

Gray-level pixel value


coded as an unsigned
32 bits integer.

UINT32

12

Easy: General Library

EC24

Type EC24 is defined as a struct with


members:
UINT8 m_un8C0, m_un8C1 and
m_un8C2,
corresponding to red, green and blue
components, in this order.

Color pixel value coded


as three unsigned 8 bits
integer
(RGB triplet, windows
24 bpp bitmap format)

EC24A

Type EC24A is defined as a struct


with members:
UINT8 m_un8C0, m_un8C1,
m_un8C2 and m_un8A,
corresponding to red, green blue and
alpha components, in this order.

Color pixel value coded


as four unsigned 8 bits
integer
(RGB triplet, windows
32 bpp bitmap format)

EC15

Type EC15 is defined as a struct with


members:
UINT16 m_un5C0:5, m_un5C1:5,
m_un5C2:5 and m_un8Pad:1,
corresponding to red, green, blue
components and padding bit, in this
order.

Color pixel value coded


as three fields of 5 bits
each + 1 bit for padding
(RGB triplet, windows
15 bpp bitmap format)

EC16

Type EC16 is defined as a struct with


members:
UINT16 m_un5C0:5, m_un6C1:6
and m_un5C2:5,
corresponding to red, green and blue
components, in this order.

Color pixel value coded


as fields of 5 + 6 + 5 bits
(RGB triplet, windows
16 bpp bitmap format)

(*) 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

C++ Reference Manual 6.7.1

1.5

Vector element types

The following vector element types are used throughout the eVision libraries and are defined as C++
structures.
Name

Structure

Description

EPath

Type EPath is defined as a struct with members:


INT16 m_n16X, m_n16Y
corresponding to the pixel coordinates.

Path from an image: image


coordinates.

EBW8Path

Type EBW8Path is defined as a struct with members:


INT16 m_n16X, m_n16Y
EBW8 m_bw8Pixel
corresponding to the pixel coordinates and the pixel
value, in this order.

Path from a BW8 image: image


coordinates and associated
gray-level pixel value.

EBW16Path

Type EBW16Path is defined as a struct with members:


INT16 m_n16X, m_n16Y
EBW16 m_bw16Pixel
corresponding to the pixel coordinates and the pixel
value, in this order.

Path from a BW16 image: image


coordinates and associated
gray-level pixel value.

EC24Path

Type EC24Path is defined as a struct with members:


INT16 m_n16X, m_n16Y
EC24 m_c24Pixel
corresponding to the pixel coordinates and the pixel
value, in this order.

Path from a C24 image: image


coordinates and associated color
pixel value.

EPeak

Type EPeak is defined as a struct with members:


UINT32 m_un32Start,
UINT32 m_un32Lengh,
INT32 m_n32Amplitude,
INT32 m_n32Area, and
FLOAT32 m_f32Center,
corresponding to first pixel index, number of pixels,
height of the maximum, peak surface and sub-pixel
position of the peak center, in this order.

Peak (maximum of values along


an image profile)
characterization.

14

Easy: General Library

2.

CLASSES AND CLASS MEMBERS

2.1

EImage... and EROI... [common members]

2.1.1

EImage... and EROI... Overview

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

pointer to the EImage [EROI] object in which the current EImage


[EROI] object parameters have to be copied.
TRUE if the attached ROIs have to be copied as well, FALSE otherwise.

15

C++ Reference Manual 6.7.1

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

EImage [EROI] object to be copied.

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:

a parent: an upper level object that contains the object to be copied;

children: sub-objects belonging to the object to be copied;

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

it has the same parent as its model;

it is a sibling of its model and has the same internal parameters;

Graphical interaction

EImage/ROI...::Draw
void Draw(HDC hDC, FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f);

Draws a gray-level or a color image/ROI in a Windows window.


Parameters
hDC

16

handle to the device context of the destination window.

Easy: General Library

f32ZoomX
f32ZoomY

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).

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);

Draws a rectangular frame around an image or ROI.


Parameters
hDC
eFramePosition

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);

Detects if the cursor is placed over one of the dragging handles.


Returns a handle identifier, as defined by enum E_HANDLES.

17

C++ Reference Manual 6.7.1

Parameters
n32X, n32Y
f32ZoomX
f32ZoomY
f32PanX
f32PanY

current cursor coordinates.


horizontal zooming factor. By default, true scale is used.
vertical zooming factor. If set to 0, the default value, the horizontal
zooming factor is used instead, so as to provide isotropic zooming.
horizontal panning factor. By default, no panning occurs.
vertical panning factor. By default, no panning occurs.

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

handle identifier, as defined by enum E_HANDLES. The value returned by


HitTest should be used.
current cursor coordinates.
horizontal zooming factor. By default, true scale is used.
vertical zooming factor. If set to 0, the default value, the horizontal
zooming factor is used instead, so as to provide isotropic zooming.
horizontal panning factor. By default, no panning occurs.
vertical panning factor. By default, no panning occurs.

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

full path and filename of the destination file.

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

Easy: General Library

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);

Restores an image stored in the given file by a previous EImage/ROI...::Save call.


Parameters
file

full path and filename of the destination 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

C++ Reference Manual 6.7.1

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

full path and filename of the source file.


file format as defined by enum IMAGE_FILE_TYPES. If not specified, the
file format is determined from the file extension.

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

full path and filename of the source 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

Easy: General Library


// Save the EImage object to the file
m_pImage.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).

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);

Sets the placement of an ROI.


Parameters
n32OrgX
n32OrgY
n32Width
n32Height

new origin point abscissa.


new origin point ordinate.
new width.
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.

21

C++ Reference Manual 6.7.1

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

abscissa of the upper left corner of the ROI.

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

ordinate of the upper left corner of the ROI.

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);

Sets the ROI width, in pixels.


Parameters
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);

Sets the ROI height, in pixels.


Parameters
n32Height

22

new height.

Easy: General Library

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( );

Returns the image width, in pixels.


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...::GetHeight
INT32 GetHeight( );

Returns the image height, in pixels.


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.

23

C++ Reference Manual 6.7.1

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( );

Returns the width, in pixels, of the topmost parent image.


Remarks
The "total size" of an ROI is simply the size of its topmost parent.
EImage/ROI...::GetTotalHeight
INT32 GetTotalHeight( );

Returns the height, in pixels, of the topmost parent image.


Remarks
The "total size" of an ROI is simply the size of its topmost parent.

2.1.2.5

ROIs Hierarchy

EROI...::Attach
void Attach(EROI...* pParent);

Attaches an ROI to another ROI/image.


Parameters
pParent

pointer to the parent ROI/image.

Remarks
The ROI constructor also allows you to attach an ROI to a parent.
This function applies to plain ROIs, not images.

24

Easy: General Library

EROI...::Detach
void Detach( );

Detaches an ROI from its parent.


Remarks
This function applies to plain ROIs, not images.
EImage/ROI...::GetParent
EGenericROI* GetParent( );

Returns a pointer to the immediate 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.
EImage/ROI...::GetTopParent
EGenericROI* GetTopParent( );

Returns a pointer to the topmost parent image (may be this one).


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.
EImage/ROI...::GetFirstSubROI
EGenericROI* GetFirstSubROI( );

Returns a pointer to the first sub-ROI in this 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.
EImage/ROI...::GetNextSiblingROI
EGenericROI* GetNextSiblingROI( );

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

C++ Reference Manual 6.7.1

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

pointer to some starting ROI.

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);

Returns the pixel at given coordinates within the image/ROI.


Parameters
n32X
pixel abscissa.
n32Y
pixel ordinate.
The default coordinates correspond to the upper leftmost pixel.
void SetPixel(EBW8 Value, INT32 n32X= 0, INT32 n32Y= 0);
void SetPixel(EBW16 Value, INT32 n32X= 0, INT32 n32Y= 0);
void SetPixel(EC24 Value, INT32 n32X= 0, INT32 n32Y= 0);
void SetPixel(EC15 Value, INT32 n32X= 0, INT32 n32Y= 0);
void SetPixel(EC16 Value, INT32 n32X= 0, INT32 n32Y= 0);

Sets the pixel value at given coordinates within the image/ROI.


Parameters
Value
pixel value.
n32X
pixel abscissa.
n32Y
pixel ordinate.
The default coordinates correspond to the upper leftmost pixel.

26

Easy: General Library

EImage/ROI...::GetImagePtr
Pixel* GetImagePtr(INT32 n32X= 0, INT32 n32Y= 0);

Returns a pointer to the pixel at given coordinates within the image/ROI.


Parameters
n32X
pixel abscissa.
n32Y
pixel ordinate.
The default coordinates correspond to the upper leftmost pixel
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.
The returned value has the appropriate pointer type, depending on the actual image type.
EImage...::SetImagePtr
void SetImagePtr(void* pImagePtr, INT32 n32BitsPerRow= 0);
void SetImagePtr(INT32 n32Width, INT32 n32Height, void* pImagePtr, INT32
n32BitsPerRow= 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

width of the image in pixels.


height of the image in pixels.
pointer to a buffer large enough to hold the image.
total number of bits contained in a row, padding included. Using the value
0 (default) means that each row is padded with the smallest possible
value that leads to a multiple of 4 bytes (32 bits), which is the minimum
padding accepted by SetImagePtr.

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

C++ Reference Manual 6.7.1

To set the n32BitsPerRow argument you need to:


1) Retrieve the MultiCam surface parameters:
INT32 bufferPitch, imageSizeX, imageSizeY, surfaceAddr;
McGetParamInt(m_ChannelInstance, MC_BufferPitch, &bufferPitch);
McGetParamInt(m_ChannelInstance, MC_ImageSizeX, &imageSizeX);
McGetParamInt(m_ChannelInstance, MC_ImageSizeY, &imageSizeY);
McGetParamInt(m_SurfaceInstance, MC_SurfaceAddr, &surfaceAddr);

2)

Set the eVision image parameters:

m_Img.SetImagePtr(imageSizeX, imageSizeY, surfaceAddr, bufferPitch*8);

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();

Returns TRUE if the Image/ROI pointer is NULL.

2.1.2.7

Character Strings

EImage/ROI...::Get/SetAuthor
CHAR* GetAuthor( );

Returns a pointer to the authors name, or NULL.


VOID SetAuthor(CHAR* pszAuthor);

Sets an authors name string.


Parameters
pszAuthor

pointer to a null terminated string, or NULL.

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

Easy: General Library

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( );

Returns a pointer to the descriptive comment, or NULL.


VOID SetComment(CHAR* pszComment);

Sets a descriptive comment string.


Parameters
pszComment

pointer to a null terminated string, or NULL.

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( );

Returns a pointer to the creation date, or NULL.


VOID SetDate(CHAR* pszDate);

Sets a creation date string.


Parameters
pszDate

pointer to a null terminated string, or NULL.

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

C++ Reference Manual 6.7.1

EImage/ROI...::Get/SetTitle
CHAR* GetTitle( );

Returns a pointer to the title, or NULL.


VOID SetTitle(CHAR* pszTitle);

Sets a title string.


Parameters
pszTitle

pointer to a null terminated string, or NULL.

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

Typing and Type Compatibility

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);

Sets the color system used by this image


Parameters
eColorSystem

color system, as defined by enum E_COLOR_SYSTEM.

enum E_COLOR_SYSTEM GetColorSystem( );

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();

Returns the image type as defined by enum E_IMAGE_TYPES.

30

Easy: General Library

EImage/ROI...::IsAnROI
BOOL IsAnROI( );

Returns TRUE if this is a plain ROI, not a topmost parent image.


EImage/ROI...::SameSize
INT16 SameSize(EImage/ROI...* pImage);

Checks whether this image/ROI agrees in width and height with another one
Parameters
pImage

pointer to the other image/ROI.

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( );

Returns the number of bits of storage per pixel.


EImage/ROI...::GetPlanesPerPixel
INT32 GetPlanesPerPixel( );

Returns the number of bitplanes of the image.

2.1.2.9

Pixel Dimensions and Resolution

EImage/ROI...::Get/SetPixelDimensions
void GetPixelDimensions(FLOAT32& f32PixelWidth, FLOAT32& f32PixelHeight,
EMeasurementUnit* (&pUnitofLength));

Returns the width, height and measurement unit of pixels.


Parameters
f32PixelWidth
f32PixelHeight
pUnitofLength

reference to the pixel width value.


reference to the pixel height value.
reference to a pointer to the measurement unit.

void SetPixelDimensions(FLOAT32 f32PixelWidth, FLOAT32 f32PixelHeight,


EMeasurementUnit* pPixelUnitOfLength = &EUnitNone);

Sets the width and height of the pixels, using dimensional values.

31

C++ Reference Manual 6.7.1

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

Easy: General Library

2.2

EImageBW1 [based on EROIBW1]

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

EImageBW1 Class Members

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

C++ Reference Manual 6.7.1

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

EImageBW8 [based on EROIBW8]


EImageBW8 Overview

Easy: General Library

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

EImageBW8 Class Members

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

C++ Reference Manual 6.7.1

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

handle to the device context of the destination window.


pointer to a vector of gray-level values initialized with 256 entries.
pointer to a vector of color values initialized with 256 entries.
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).

Easy: General Library

2.4

EImageBW16 [based on EROIBW16]

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

EImageBW16 Class Members

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

C++ Reference Manual 6.7.1

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

Easy: General Library

2.5

EImageC24 [based on EROIC24]

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

EImageC24 Class Members

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

C++ Reference Manual 6.7.1

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

EImageC24A [based on EROIC24A]


EImageC24A Overview

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

Easy: General Library

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

EImageC24A Class Members

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

C++ Reference Manual 6.7.1

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

EImageC15 [based on EROIC15]


EImageC15 Overview

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

Easy: General Library

2.7.2

EImageC15 Class Members

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

C++ Reference Manual 6.7.1

2.8

EImageC16 [based on EROIC16]

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

EImageC16 Class Members

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

Easy: General Library

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

C++ Reference Manual 6.7.1

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

Easy: General Library

2.9.2

EROIBW1 Class Members

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

pointer to the parent image/ROI.


abscissa of the upper left corner (relative to its parent).
ordinate of the upper left corner (relative to its parent).
width, in pixels.
height, in pixels.

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

C++ Reference Manual 6.7.1

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

Easy: General Library

2.10.2 EROIBW8 Class Members


2.10.2.1 EROIBW8 Construction
Default Constructor
EROIBW8::EROIBW8();

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

pointer to the parent image/ROI.


abscissa of the upper left corner (relative to its parent).
ordinate of the upper left corner (relative to its parent).
width, in pixels.
height, in pixels.

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

C++ Reference Manual 6.7.1

Example
// Create a copy of an existing EROIBW8 object.
EROIBW8 RoiBW8_2( &RoiBW8_1);

2.10.2.2 Graphical Interaction


EROIBW8::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 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

handle to the device context of the destination window.


pointer to a vector of gray-level values initialized with 256 entries.
pointer to a vector of color values initialized with 256 entries.
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).

Easy: General Library

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

C++ Reference Manual 6.7.1

2.11.2 EROIBW16 Class Members


2.11.2.1 EROIBW16 Construction
Default Constructor
EROIBW16::EROIBW16();

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

pointer to the parent image/ROI.


abscissa of the upper left corner (relative to its parent).
ordinate of the upper left corner (relative to its parent).
width, in pixels.
height, in pixels.

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

Easy: General Library

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

C++ Reference Manual 6.7.1

2.12.2 EROIC24 Class Members


2.12.2.1 EROIC24 Construction
Default Constructor
EROIC24::EROIC24();

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

pointer to the parent image/ROI.


abscissa of the upper left corner (relative to its parent).
ordinate of the upper left corner (relative to its parent).
width, in pixels.
height, in pixels.

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

Easy: General Library

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

C++ Reference Manual 6.7.1

2.13.2 EROIC24A Class Members


2.13.2.1 EROIC24A Construction
Default Constructor
EROIC24A::EROIC24A();

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

pointer to the parent image/ROI.


abscissa of the upper left corner (relative to its parent).
ordinate of the upper left corner (relative to its parent).
width, in pixels.
height, in pixels.

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

Easy: General Library

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

C++ Reference Manual 6.7.1

2.14.2 EROIC15 Class Members


2.14.2.1 EROIC15 Construction
Default Constructor
EROIC15::EROIC15();

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

pointer to the parent image/ROI.


abscissa of the upper left corner (relative to its parent).
ordinate of the upper left corner (relative to its parent).
width, in pixels.
height, in pixels.

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

Easy: General Library

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

C++ Reference Manual 6.7.1

2.15.2 EROIC16 Class Members


2.15.2.1 EROIC16 Construction
Default Constructor
EROIC16::EROIC16();

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

pointer to the parent image/ROI.


abscissa of the upper left corner (relative to its parent).
ordinate of the upper left corner (relative to its parent).
width, in pixels.
height, in pixels.

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

Easy: General Library

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 create a vector use its constructor;

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"

2.16.2 EVectorTemplate Class members


EVectorTemplate: Construction
EVectorTemplate(UINT32 un32MaxElements= 0);

Constructs a vector.
Parameters
un32MaxElements

optionally, memory can be pre-allocated to accommodate a given number


of elements.

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

C++ Reference Manual 6.7.1

Remarks
This only applies to EPathVector, EBW8PathVector, EBW16PathVector and EC24PathVector.
EVectorTemplate::WeightedMoment
FLOAT32 WeightedMoment(UINT32 un32From= 0, UINT32 un32To= ~0);

Returns the first order geometric moment (weighted gravity center).


Parameters
un32From
un32To

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

the element to be added.

Example
EBW8Vector Lookup;
Lookup.Empty( );
// Prepare a ramp lookup table
for (int i= 0; i < 256; i++)
{ Lookup.AddElement(i);
}

EVectorTemplate::GetDataPtr
Type GetDataPtr ();

Returns a pointer to the vector data.


EVectorTemplate::Draw
A vector is able to draw itself in a window. Its graphical appearance depend on its type. It can be either a
plot of the element values as a function of the element indices, or a plot of the element coordinates when
these describe a path. In the latter case, the drawing should appear on the image itself; in the former, it
should appear on a neutral background.
Drawing is done in the device context associated to the desired window. To draw the curves, the current
pen is used. To draw the annotations, a black pen is used instead.
void Draw(HDC hDC, FLOAT32 f32Width, FLOAT32 f32Height, FLOAT32 f32OrgX= 0.f,
FLOAT32 f32OrgY= 0.f);

62

Easy: General Library


void Draw(HDC hDC, FLOAT32 f32Width, FLOAT32 f32Height, FLOAT32 f32OrgX= 0.f,
FLOAT32 f32OrgY= 0.f, HGDIOBJ hPen0= 0, HGDIOBJ hPen1= 0, HGDIOBJ hPen2= 0);

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

handle of the device context on which to draw.


outermost horizontal size, in pixels.
outermost vertical size, in pixels.
abscissa of the upper left corner of the plots bounding rectangle, in pixels.
By default, the upper left corner of the window is used.
ordinate of the upper left corner of the plots bounding rectangle, in pixels.
By default, the upper left corner of the window is used.
handle of the pens to be used for the red, green and blue components
curves, respectively. By default, the current pen is used.

void Draw(HDC hDC, FLOAT32 f32ZoomX= 1.f, FLOAT32 f32ZoomY= 0.f, FLOAT32 f32PanX=
0.f, FLOAT32 f32PanY= 0.f);

Draws an XY plot of the path vertices. Applies to EPathVector, EBW8PathVector, EBW16PathVector


and EC24PathVector vector classes.
Parameters
hDC
f32ZoomX
f32ZoomY
f32PanX
f32PanY

handle of the device context on which to draw.


horizontal zooming factor. By default, true scale is used.
vertical zooming factor. If set to 0, the default value, the horizontal
zooming factor is used instead, so as to provide isotropic zooming.
horizontal panning factor. By default, no panning occurs.
vertical panning factor. By default, no panning occurs.

EVectorTemplate::Empty
void Empty( );

Resets the number of elements to 0.


Example
EBW8Vector Lookup;
Lookup.Empty( );
// Prepare a ramp lookup table
for (int i= 0; i < 256; i++)
{
Lookup.AddElement(i);
}

63

C++ Reference Manual 6.7.1

EVectorTemplate::Get/SetNumElements
UINT32 GetNumElements( );

Returns the number of elements in the vector.


Example
EBW8Vector Lookup;
// Clear element index 5
if (Lookup.GetNumElements( ) >= 6)
{ Lookup[5]= 0;
}
void SetNumElements(UINT32 un32NumElements);

Sets the number of elements in the vector.


Parameters
un32NumElements

number of elements in the vector.

EVectorTemplate::Operator[ ]
operator[](UINT32 un32Index);

Gives access to the vector element at the given index.


Parameters
un32Index

index, between 0 and GetNumElements( ) (excluded) of the element to be


accessed.

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

Easy: General Library

2.17.2 Vector<> Class Members


Methods
Contains
NbItems
operator[ ]
operator[ ] const
Add
Find
Remove
Clear

Returns whether the vector contains a value or not.


Returns the number of items in the vector.
Checked accessor.
Const version of the operator[ ] accessor.
Adds an item at the tail of the vector.
Returns the index of the supplied item.
Removes the specified item.
Removes all items from the vector.

bool Vector<ItemType>::Contains( const ItemType& item) const

Returns whether the vector contains a value or not.


size_t Vector<ItemType>::NbItems( ) const

Returns the number of items in the vector.


Item Vector<ItemType>::Type& operator[]( size_t i)

Checked accessor.
An exception is thrown if the index is out of bounds.
const Vector<ItemType>::Item Type& operator[]( size_t i) const

Const version of the operator[]accessor.


void Vector<ItemType>::Add( const ItemType& item)

Adds an item at the tail of the vector.


size_t Vector<ItemType>::Find( const ItemType& item)

Returns the index of the supplied item.


Throws E_ERROR_PARAMETER_1_OUT_OF_RANGE if item cannot be found.
void Vector<ItemType>::Remove( const ItemType& item)
void Vector<ItemType>::Remove( size_t index)

Remove the specified item.


An E_ERROR_PARAMETER_1_OUT_OF_RANGE exception is thrown if the item is not contain in the
vector.
void Vector<ItemType>::Clear( )

Removes all items from the vector.


Declare using
#include "Easy.h"

65

C++ Reference Manual 6.7.1

2.18 EMeasurementUnit
2.18.1 EMeasurementUnit Class Members
EMeasurementUnit Construction
EMeasurementUnit::EMeasurementUnit(FLOAT32 f32Magnitude, CHAR* pszName);

Constructs a measurement unit.


Parameters
f32Magnitude
pszName

relative magnitude of this unit with respect to a standard (e.g. 1 mm =


0.001 m).
unit abbreviation (e.g. "mm").

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

reference to the second measurement unit.

EMeasurementUnit::GetName
CHAR* EMeasurementUnit::GetName( ) const;

Returns a pointer to a null terminated string containing the unit abbreviation.


EMeasurementUnit::SetName
void EMeasurementUnit::SetName(const CHAR* pszName);

Sets a pointer to a null terminated string containing the unit abbreviation.


Parameters
pszName

unit abbreviation (e.g. "mm").

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

relative magnitude of this unit with respect to a standard (e.g. 1 mm =


0.001 m).

Easy: General Library

2.19 EDimensionalValue
2.19.1 EDimensionalValue Class Members
EDimensionalValue: Construction
EDimensionalValue::EDimensionalValue(FLOAT32 f32Value, EMeasurementUnit* pUnit);

Constructs a dimensional value.


Parameters
f32Value
pUnit

numerical value.
pointer to an existing measurement unit.

EDimensionalValue::GetValue
FLOAT32 EDimensionalValue::GetValue( );

Returns the numerical value.


FLOAT32 EDimensionalValue::GetValue(EMeasurementUnit* pUnit);

Returns the value, converted to another unit.


Parameters
pUnit

pointer to an existing measurement unit.

EDimensionalValue::SetValue
VOID EDimensionalValue::SetValue(FLOAT32 f32Value);

Sets a new value.


Parameters
f32Value

numerical value.

VOID EDimensionalValue::SetValue(FLOAT32 f32Value, EMeasurementUnit* pUnit);

Sets new value and unit.


Parameters
f32Value
pUnit

numerical value.
pointer to an existing measurement unit.

EDimensionalValue::Get/SetUnit
EMeasurementUnit* EDimensionalValue::GetUnit( );

Returns a pointer to the measurement unit.


VOID EDimensionalValue::SetUnit(EMeasurementUnit* pUnit);

Sets a new measurement unit.


Parameters
pUnit

pointer to the measurement unit.


67

C++ Reference Manual 6.7.1

2.20 EImageSequence
2.20.1 EImageSequence: Overview

This class is for Windows only.


Class EImageSequence stores a sequence of images of the same type and size. The sequence can be
written to or read from an AVI file.
Before using a sequence, one should set the type and size of the images.
To read images from a sequence, first open the file with StartLoading. Get the images you need with
GetImage. When you are done, close with CloseFile. You can then destroy the sequence object.
To write images into a sequence, first open the file with StartSaving. Add the images with AddImage.
When you are done, close with CloseFile. You cand then destroy the sequence object.
An EImageSequence object can be in two different states. Those states are defined by the enum
E_STATE. The function SetState can be used to change that state. In state E_STATE_ACTIVE the
available images are immediately written to disk, thus the images added by AddImage are immediately
compressed and recorded. In the state E_STATE_INACTIVE, the images are queued for later processing.
When switching to state E_STATE_ACTIVE the queued images are recorded.
Important remarks
1. The programmer must guarantee the integrity of the images until they are saved.
2. The AddImage and GetImage methods are mutually exclusive. If you start with StartLoading, you
cannot use the AddImage function. If you start with StartSaving, you cannot use the GetImage
function.
3. To use a non standard AVI format, the associated codec must be installed. Refer to Microsoft for
more info.
Declare using
#include "EAVI.h"

2.20.2 EImageSequence Class Members


2.20.2.1 Construction/Destruction
EImageSequence Construction
EImageSequence();

Constructs an uninitialized EImageSequence object.


Remarks
Before any use, the image size and type must be set with SetImageType, SetWidth and SetHeight.
EImageSequence(INT32 n32Width, INT32 n32height, enum E_IMAGE_TYPES eImageType);

Constructs an EImageSequence object and initializes its size and type.

68

Easy: General Library

Parameters
n32Width
n32Height
eImageType

Width of the images in the sequence (must be greater than 0).


Height of the images in the sequence (must be greater than 0).
Type of the images in the sequence as defined by enum
E_IMAGE_TYPES.

EImageSequence Destruction
~EImageSequence();

Destroys an EImageSequence object and closes the files.


If the destructor is called while recording, the function can block in order to record the queued images.

2.20.2.2 Sizing
EImageSequence::Get/Set Width
INT32 GetWidth();

Returns the width of the images in the sequence.


void SetWidth(INT32 n32Width);

Sets the width of the images in the sequence.


The width of the sequence must be set before any use. While recording, reading or when images are
queued, the width may not be changed.
Parameters
n32Width

Width of the images in the sequence (must be greater than 0).

EImageSequence::Get/Set Height
INT32 GetHeight();

Returns the height of the images in the sequence.


void SetHeight(INT32 n32Height);

Sets the height of the images in the sequence.


The height of the sequence must be set before any use. While recording, reading or when images are
queued, the height may not be changed.
Parameters
n32Height

Height of the images in the sequence (must be greater than 0).

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

C++ Reference Manual 6.7.1


void SetImageType(enum E_IMAGE_TYPES eImageType);

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

Type of the images in the sequence, as defined by enum


E_IMAGE_TYPES.

2.20.2.4 Sequencing
EImageSequence::GetCount
INT32 GetCount();

Returns the number of images in the sequence.


Returns -1 if the number of images is unknown.
EImageSequence::Get/Set State
enum E_STATE GetState();

Returns whether the recording is activated or not.


void SetState(enum E_STATE eState);

Activates or deactivates recording.


By default, the recording is activated.
When the recording is deactivated (E_STATE_INACTIVE), the images are queued. When the
recording is activated (E_STATE_ACTIVE), the images are immediately written to the disk. The
method can block when activating recording in order to record the queued images.
Parameters
eState

Recording state as defined by enum E_STATE.

EImageSequence::CloseFile
void CloseFile ();

Closes the AVI file.


This method can block in order to record queued images.

2.20.2.5 Sequence writing


EImageSequence::StartSaving
void StartSaving(const char* pszFileName, HWND hwndDialogParent= E_INVALID_HWND);

Initializes recording to a file.

70

Easy: General Library

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

full path and filename of the AVI file.


window handle. By default (argument omitted), it is equal to
E_INVALID_HWND, which means that the compression selected by
SetCodecFourcc is used. Alternatively, it can be set to a handle to the
parent window of a dialog box to select the codec.

EImageSequence::Seek
void Seek(INT32 n32Delta);

Move into the sequence.


Parameters
n32Delta

number of images to skip. While recording, n32Delta must be positive.

EImageSequence::AddImage
void AddImage(EImageBW1* pBW1Src);
void AddImage(EImageBW8* pBW8Src);
void AddImage(EImageC15* pC15Src);
void AddImage(EImageC24* pC24Src);
void AddImage(EImageC24A* pC24ASrc);

Adds an image to the sequence.


The image is bottom-up. The image must be of the same size and type than the other images of the
sequence.
If recording is activated, the images are immediately written, otherwise, they are queued.
Parameters
pBW1Src
pBW8Src
pC15Src
pC24Src
pC24ASrc

pointer to a 2-bit bi-level image object.


pointer to a 8-bit gray level image object.
pointer to a 15-bit color image object.
pointer to a 24-bit color image object.
pointer to a 32-bit color image (24+ alpha channel) object.

EImageSequence::AddImageData
void AddImageData(UINT8* pImg);

71

C++ Reference Manual 6.7.1

Adds a raw image to the sequence.


The image is bottom-up. The image must be of the same size and type than the other images of the
sequence. This method accepts the raw image data. The formating of the data must respect the
formating corresponding to the type of the sequence images.
If recording is activated, the images are immediately written, otherwise, they are queued.
Parameters
pImg

pointer to the image raw data.

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);

Adds an array of images to the sequence.


The images are bottom-up. The image must be of the same size and type than the other images of the
sequence.
If recording is activated, the images are immediately written, otherwise, they are queued.
Parameters
ppBW1Src
ppBW8Src
ppC15Src
ppC24Src
ppC24ASrc
n32Count

pointer to an array of 2-bit bi-level image objects.


pointer to an array of 8-bit gray level image objects.
pointer to an array of 15-bit color image objects.
pointer to an array of 24-bit color image objects.
pointer to an array of 32-bit color image (24+ alpha channel) objects.
number of images to add from the array.

2.20.2.6 Sequence reading


EImageSequence::StartLoading
void StartLoading(const char* pszFileName);

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

full path and filename of the AVI file.

EImageSequence::SetPosition
void SetPosition(INT32 n32Position);

Sets the current position in the sequence.

72

Easy: General Library

Parameters
N32Position

position to set as current position.

EImageSequence::GetImage
void GetImage(EImageBW1* pBW1Dst);
void GetImage(EImageBW8* pBW8Dst);
void GetImage(EImageC15* pC15Dst);
void GetImage(EImageC24* pC24Dst);
void GetImage(EImageC24A* pC24ADst);

Gets an image from the current position in the sequence.


The image is bottom-up. The current position is incremented.
The destination image should be of the same type as the one of the sequence images.
Parameters
pBW1Dst
pBW8Dst
pC15Dst
pC24Dst
pC24ADst

pointer to a 2-bit bi-level image object.


pointer to a 8-bit gray level image object.
pointer to a 15-bit color image object.
pointer to a 24-bit color image object.
pointer to a 32-bit color image (24+ alpha channel) object.

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

pointer to an array of 2-bit bi-level image objects.


pointer to an array of 8-bit gray level image objects.
pointer to an array of 15-bit color image objects.
pointer to an array of 24-bit color image objects.
pointer to an array of 32-bit color image (24+ alpha channel) objects.
number of images to add to the array.

73

C++ Reference Manual 6.7.1

2.20.2.7 Image Storage Layout


EImageSequence::Get/Set FlipImage
BOOL GetFlipImage();

Returns the flipping parameter.


void SetFlipImage(BOOL bFlip= TRUE);

Sets the flipping parameter.


This parameter allows mirroring image before saving or after loading. This feature is used to handle
top-down Windows bitmap images (as opposed to bottom-up), as are used by eVision or frame
grabbers.
By default, this parameter is TRUE (images are flipped before saving and after loading), thus ensuring
compatibility of the eVision AVI files with standard AVI players. If you don't need this compatibility, you
can set it to FALSE to reduce time of loading and saving operations.
Caution: Be sure to always load and save a file in the same flipping mode.
Parameters
bFlip

flipping mode.

2.20.2.8 AVI parameters


EImageSequence::Get/Set CodecFourcc
UINT32 GetCodecFourcc();
void GetCodecFourcc(char* pszFourcc);

Returns the FOURCC code of the selected codec.


The FOURCC code represents the encoding of the images.
void SetCodecFourcc(UINT32 n32Fourcc);
void SetCodecFourcc(const char* pszFourcc);

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();

Returns the numerator of the fraction specifying the playback rate.

74

Easy: General Library


void SetNumRate(INT32 n32NumRate);

Sets the numerator of the fraction specifying the playback rate.


The fraction NumRate/DenomRate sets the number of images per second suggested for playback.
This value can only be changed before setting the file to record to. By default, the value of NumRate is
16.
Parameters
n32NumRate

numerator of the fraction specifying the playback rate.

EImageSequence::Get/Set DenomRate
INT32 GetDenomRate();

Returns the denominator of the fraction specifying the playback rate.


void SetDenomRate(INT32 n32DenomRate);

Sets the denominator of the fraction specifying the playback rate.


The fraction NumRate/DenomRate sets the number of images per second suggested for playback.
This value can only be changed before setting the file to record to. By default, the value of DenomRate
is 1.
Parameters
n32DenomRate

denominator of the fraction specifying the playback rate.

EImageSequence::Get/Set DataRate
INT32 GetDataRate();

Returns the desired data rate in bytes.


void SetDataRate(INT32 n32DataRate);

Sets the desired data rate in bytes.


The signification of this parameter depends heavily on the codec.
Parameters
n32DataRate

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()

Returns the maximum period between key frames.


void SetKeyFrameRate(INT32 n32KeyFrame);

Sets the maximum period between key frames.


If KeyFrameRate equals zero, all images will be key frames. The signification of this parameter
depends heavily on the codec.
Parameters
n32KeyFrame

maximum period between key frames.

75

C++ Reference Manual 6.7.1

EImageSequence::Get/Set CompressionQuality
INT32 GetCompressionQuality()

Returns the compression quality level.


void SetCompressionQuality(INT32 n32Level);

Sets the compression quality level.


The signification of this parameter depends heavily on the codec.
Parameters
n32Level

compression quality level.

2.21 ESerializer
2.21.1 ESerializer Overview

Class ESerializer is an abstract interface for file-like objects.


The object ESerializer manages operations of reading from and writing to an archive (a file on the
system hard disk, for instance).
Declare using
#include "Easy.h"

2.21.2 ESerializer Class Members


ESerializer::CreateFileWriter
static ESerializer* ESerializer::CreateFileWriter( const std::string& filePath,
FileWriterMode mode = Create);
static ESerializer* ESerializer::CreateFileWriter( const std::basic_string<wchar_t>&
filePath, FileWriterMode mode = Create);

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).

Easy: General Library

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);

Returns an ESerializer object suitable for reading from a file.


Parameters
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

C++ Reference Manual 6.7.1

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();

Closes the file associated with the ESerializer object.


Example
EImageBW8 Image;
// Create an ESerializer object for writing (Mode = Create)
ESerializer *pSerializer = ESerializer::CreateFileWriter( "filename");
// Save the EImage object to the file
Image.Save( pESerializer);
// Close the file associated with the ESerializer object
pSerializer->Close();

// Delete the object created locally


Delete pSerializer;

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

Easy: General Library

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

C++ Reference Manual 6.7.1

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"

2.22.2 EJpegHandler Class Members


2.22.2.1 Construction
EJpegHandler Construction
EJpegHandler();

Constructs an EJpegHandler object.

2.22.2.2 Data access


EJpegHandler::SetBuffers
void EJpegHandler::SetBuffers(UINT8* upField, const UINT32 upFieldByteSize, UINT8*
downField, const UINT32 downFieldByteSize);

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

pointer to the up field buffer.


size of the up field buffer.
pointer to the down field buffer. Optionally, this pointer can be set to
NULL. In this case, the image is treated as a single-field image.
size of the down field buffer.

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

Easy: General Library

Parameters
DstImage

EImageC24 object.

Remarks
Please note the image will be resized to fit the JPEG field size if needed.

2.22.2.3 Persistent storage


EJpegHandler::Load
void EJpegHandler::Load(const char* pszPathName);
void EJpegHandler::Load(const UNICHAR* pszPathName);
void EJpegHandler::Load(const std::string& pathName);
void EJpegHandler::Load(const std::basic_string<wchar_t>& pathName);

Restores an EJpegHandler object from the given file.


Parameters
pszPathName/pathName

full path and name specification of the storage file.

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

full path and name specification of the storage file.


ESerializer object.

EJpegHandler::LoadFJfif
void EJpegHandler::LoadFJfif(const char* pathName);
void EJpegHandler::LoadFJfif(const std::string& pathName);

Loads the first field from the JFIF image file.


Parameters
pathName

full path and name specification of the JFIF storage file.

EJpegHandler::LoadSJfif
void EJpegHandler::LoadSJfif(const char* pathName);
void EJpegHandler::LoadSJfif(const std::string& pathName);

Loads the second field from the JFIF image file.


81

C++ Reference Manual 6.7.1

Parameters
pathName

full path and name specification of the JFIF storage file.

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

full path and name specification of the storage file.

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

full path and name specification of the storage file.


ESerializer object.

EJpegHandler::SaveFJfif
void EJpegHandler::SaveFJfif(const char* pathName);
void EJpegHandler::SaveFJfif(const std::string& pathName);

Saves the first field to the JFIF image file.


Parameters
pathName

full path and name specification of the JFIF storage file.

EJpegHandler::SaveSJfif
void EJpegHandler::SaveSJfif(const char* pathName);
void EJpegHandler::SaveSJfif(const std::string& pathName);

Saves the second field to the JFIF image file.


Parameters
pathName

82

full path and name specification of the JFIF storage file.

Easy: General Library

3.

FUNCTIONS

3.1

Initialization and Termination

Initialize
void Initialize();

Performs eVision initialization.


Initialization is optional but recommended. If Initialize is not called explicitly, initialization will be
performed automatically by eVision. This may lead to a small time increase during the execution of an
eVision method.
Usage
Initialize can be called from within the application initialization method (eg InitInstance for an
MFC application).
Do not call Initialize:
inside the constructor of a global or static object;
inside the DLL entry point (DllMain) in case of a DLL based on eVision.
Namespace
This function is declared inside the Euresys::eVision namespace.
Terminate
void Terminate( );

Performs eVision termination.


Termination is optional but recommended.
Usage
Terminate can be called from within the application termination method (eg ExitInstance for an
MFC application).
Do not call Terminate:
inside the destructor of a global or static object;
inside the DLL entry point (DllMain) in case of a DLL based on eVision.
Namespace
This function is declared inside the Euresys::eVision namespace.

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

C++ Reference Manual 6.7.1

Parameters
un32Threshold

threshold in range [0..255].

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

compression quality, expressed in percent, in the range [0..100].

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);

Resizes an image without interpolation.


Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI.

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

Easy: General Library

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

defines whether the copy operations are recursive or not. By default


(TRUE), the copy operations are recursive.

Example1
// Copy an image instance WITH its attached ROI
// into another image instance (default behaviour)
EImageBW8 Src;
EImageBW8 Dst;
EROIBW8 SrcROI;

// Attach the ROI to the Src image


SrcROI.Attach(&Src);

// Copy Src AND its daughter ROI into Dst


Dst=Src;

Example2
// Copy a gauge instance WITHOUT its daughter gauges
// into another gauge instance
ERectangleGauge Rectangle1;
ERectangleGauge Rectangle2;
ELineGauge Line;
EPointGauge Point;

// Disable recursive copying


ESetRecursiveCopyBehavior(FALSE);

// Create the gauge hierarchy


Point.Attach(&Line);
Line.Attach(&Rectangle1);

// Copy Rectangle1 WITHOUT its daughters into Rectangle1


Rectangle2= Rectangle1;

Remark
This flag is only relevant where objects are stored in a tree-like structure, like EROI and EImage
objects, or EGauge objects.

85

C++ Reference Manual 6.7.1

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

Error Processing and Tracing

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( )

Returns the error message of the last function call.


Example
EImageBW8* pImage= new EImageBW8(512, 512);
if (EGetError( ) != E_OK)
cout << 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

Easy: General Library


CHAR* EGetErrorText( )

Returns the error message of the last function call.


Example
EImageBW8* pImage= new EImageBW8(512, 512);
if (EGetError( ) != E_OK)
cout << EGetErrorText( );

EOk
E_ERRORS EOk();

Resets the last error code to E_OK.


EFailure
BOOL EFailure ();

Returns TRUE if the last function call failed.


ESuccess
BOOL ESuccess();

Returns TRUE if the last function call succeeded.


ESetTraceMode
void ESetTraceMode(enum E_TRACE_MODE NewTraceMode);

Sets the trace mode.


Parameters
NewTraceMode

new trace mode, as defined by enum E_TRACE_MODE.

Example
ESetTraceMode(E_TRACE_DISPLAY_FULL_MESSAGE);

EGetTraceMode
enum E_TRACE_MODE EGetTraceMode();

Returns the trace mode.


ETrace
ETrace("function call");

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"

any eVision function call.

87

C++ Reference Manual 6.7.1

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"

any eVision 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"

any eVision 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

Easy: General Library

3.6

Image Display and Drawing

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

pointer to the target image.

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);

Releases the device context associated to an image.


Parameters
pImage

pointer to the target image (must be the same as that passed to


EOpenImageDC).

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

C++ Reference Manual 6.7.1

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

pointer to the source image.


pointer to the destination image.
rotation angle about the X axis, in degrees.
rotation angle about the Y axis, in degrees.
magnification factor along X (should remain close to one).
magnification factor along Y (should remain close to one).
magnification factor along Z (should remain close to one).
size of the rendered dots; allowed values are 1, 4, 5 or 9.

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

Easy: General Library

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

pointer to the raw source image.


pointer to the source image transformed into another color system.
pointer to the destination image.
rotation angle about the X axis, in degrees.
rotation angle about the Y axis, in degrees.
magnification factor along X (should remain close to one).
magnification factor along Y (should remain close to one).
magnification factor along Z (should remain close to one).

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( );

Returns the current angular unit, as defined by enum E_ANGLE_UNITS.


void ESetAngleUnit(enum E_ANGLE_UNITS eUnit);

Changes the current angular unit, as defined by enum E_ANGLE_UNITS.


Parameters
eUnit

new angle unit.

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

C++ Reference Manual 6.7.1

Parameters
f32Angle

angle to be converted.

EToRadians
FLOAT32 EToRadians(FLOAT32& f32Angle);

Returns the angle, converted from current angle unit to radians.


Parameters
f32Angle

3.9

angle to be converted.

Timing

EStartTiming / EStopTiming
void EStartTiming( );

Starts timing, using the system clock or performance counter.


INT32 EStopTiming(INT32 n32Resolution = 1000);

Returns the time, in specified time units, elapsed since the last invocation of EStartTiming
Parameters
n32Resolution

temporal resolution, in ticks per second. By default, time is returned in


milliseconds.

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

Easy: General Library

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

type of non-volatile memory holder to use, as defined in enum


Location::Type.
index of non-volatile memory holder to use. Unused if where is equal to
Location::Auto. If set to -1, means that all holders must be used.

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

type of non-volatile memory holder to use, as defined in enum


Location::Type.
index of non-volatile memory holder to use. Unused if where is equal to
Location::Auto. If set to -1, means that all holders must be used.

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

C++ Reference Manual 6.7.1

4.

ENUMERATION CONSTANTS

4.1

enum DATA_SIZE

Possible data sizes


E_1_BIT_PER_PIXEL

= 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

revolutions (0..1 corresponds to a full revolution).

E_ANGLE_UNIT_RADIANS

radians (0.. 2 Pi corresponds to a full revolution).

E_ANGLE_UNIT_DEGREES

degrees (0..360 corresponds to a full revolution).

E_ANGLE_UNIT_GRADES

grades (0..400 corresponds to a full revolution).

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

Easy: General Library

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

Frame drawing position


E_FRAME_ON

the frame is centered on the image/ROI edges.

E_FRAME_INSIDE

the outer edges of the frame remain totally inside the image/ROI.

E_FRAME_OUTSIDE

the inner edges of the frame remain totally outside the


image/ROI:;

4.6

enum E_SELECTION_MODE

Selection modes used by the eVision Libraries


E_SELECTED_ANY

the operation applies to both selected and unselected items.

E_SELECTED_TRUE

the operation applies to selected items only.

E_SELECTED_FALSE

the operation applies to unselected items only.

4.7

enum E_TRACE_MODE

E_TRACE_SILENT

no trace message.

E_TRACE_DISPLAY_MESSAGE

short trace message (function name, error


message).

E_TRACE_DISPLAY_FULL_MESSAGE

long trace message (filename, line, function call,


error message). Requires the use of the ETrace
macro.

4.8

enum E_HANDLES

Handle names for use with the ROI dragging functions


E_HANDLE_NONE

No handle.

E_HANDLE_INSIDE

Inside handle.

E_HANDLE_NORTH

Northern handle.

E_HANDLE_EAST

Eastern handle.

E_HANDLE_SOUTH

Southern handle.

95

C++ Reference Manual 6.7.1

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

File formats for loading/saving images


E_FILE_FORMAT_AUTO

the file format is determined from the file


extension. The latter must be one of
".bmp", ".tif" or ".jpg".

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

uncompressed binary black & white 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

gray-level JPEG (JFIF).

E_FILE_FORMAT_COLOR_JPEG

color JPEG (JFIF).

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

Easy: General Library

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.

4.10 enum E_IMAGE_TYPES


Type of images
E_BW1

bilevel image.

E_BW8

8 bits per pixel gray level image.

E_BW16

16 bits per pixel gray level image

E_BW32

32 bits per pixel gray level image.

E_C15

15 bits per pixel color image (R:5 G:5 B:5).

E_C16

16 bits per pixel color image (R:5 G:6 B:5).

E_C24

24 bits per pixel color image (RGB).

E_C24A

32 bits per pixel color image (RGB + unused alpha channel).

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.

4.11 enum E_STATE


EImageSequence class states
E_STATE_ACTIVE

recording is activated, images are immediately written to the


disk.

E_STATE_INACTIVE

recording is deactivated, images are queued.

4.12 enum VECT_TYPE


Vector types for use with the Evector class (obsolete)
E_VECT_TYPE_CONTOUR

list of contour points (INT32 X, Y, freeman code).

E_VECT_TYPE_HIST

histogram (UINT32 count).

E_VECT_TYPE_LUT_UINT8

lookup table (UINT8 gray value).

E_VECT_TYPE_SEG

image data along a path (INT32 X, Y, gray value).

E_VECT_TYPE_PEAK

detected peaks (INT32 position, length, area).

E_VECT_TYPE_MEASURE

measured points (FLOAT32 X, Y, peak area, validity).

E_VECT_TYPE_LUT_FLOAT32

lookup table (FLOAT32 floating-point values).

97

C++ Reference Manual 6.7.1

5.

SAMPLE PROGRAMS
The available sample programs dedicated to the EasyImage library are the following:

ImgFilter: applies a few morphological or convolution filters (with a user-defined kernel).


Also shows how the menu items are handled in a windowed application.

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.

ImgShadingCorrection: performs a shading correction based on two reference vectors


built by means of a projection.

ImgStatistics: plots the histogram and computes statistical parameters over a region of
interest. Shows how colors can be used to plot graphs.

ImgThreshold: applies a threshold operation on an image and extracts the contour of a


blob.

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

EasyImage: Image Processing

EasyImage: Image Processing

1.

EASYIMAGE: INTRODUCTION

The EasyImage library contains a large number of general image processing functions. The following
categories are distinguished:

Intensity Scale Transforms: pixel-wise transformation of the gray/color level values;

Thresholding: conversion of gray level images to bilevel images;

Arithmetic & logic: pixel-wise arithmetical and logical combinations between two images or between
an image and a constant;

Convolution: linear combination of neighboring pixels using a convolution kernel;

Morphology: non-linear combinations of neighboring pixels;

Geometric transforms: image resizing rotation, registration, and warping;

Statistics: pixel values simple statistics;

Histograms: count of the gray level values;

Contouring: drawing of iso-level curves;

Projections: sum or average of all pixel values in a given direction;

Conversions: conversion between several types of gray level or color images;

Noise reduction: temporal averaging to reduce image noise;

Vector operations: miscellaneous operations applied to vectors.

Miscellaneous operations: other.


The following specific C++ objects are available:

EKernel: kernel for use in convolution operations.

EMovingAverage: temporal integration of a number of images to reduce noise.

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

C++ Reference Manual 6.7.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.

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

EasyImage: Image Processing

2.

CLASSES AND CLASS MEMBERS

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

EKernel Class Members

2.1.2.1

Construction

EKernel: Construction
EKernel::EKernel();

Constructs a void kernel.


Note. A void kernel has no associated convolution coefficients.
EKernel::EKernel(enum KERNEL_TYPE KernelType);

Constructs a kernel of a predefined type.

103

C++ Reference Manual 6.7.1

Parameters
KernelType

kernel type, as defined by enum KERNEL_TYPE.

EKernel::EKernel(INT16 n16SizeX, INT16 n16SizeY, FLOAT32 f32Gain, UINT32 un32Offset,


INT16 n16Rectifier, UINT32 un32OutsideValue);

Constructs a kernel of given size and global parameters.


Parameters
n16SizeX
n16SizeY
f32Gain
un32Offset
n16Rectifier
un32OutsideValue

2.1.2.2

number of coefficients along a row.


number of coefficients along a column.
global gain.
global offset.
rectification mode, as defined by enum KERNEL_RECTIFIER.
out-of-limits image value.

Convolution Coefficients

EKernel::GetDataPtr
FLOAT32* GetDataPtr();

Returns a pointer to the first convolution coefficient (upper left).


EKernel::GetKernelData
INT16 EKernel::GetKernelData(INT32 n32DataX, INT32 n32DataY, FLOAT32& f32Data);

Returns the convolution coefficient of given indices.


Parameters
n32DataX
n32DataY
f32Data

column index, from 0 on, increasing rightwards.


row index, from 0 on, increasing downwards.
reference to the coefficient value.

EKernel::SetKernelData
INT16 EKernel::SetKernelData(INT32 n32DataX, INT32 n32DataY, FLOAT32 f32Data);

Sets the convolution coefficient of given indices.


Parameters
n32DataX
n32DataY
f32Data

column index, from 0 on, increasing rightwards.


row index, from 0 on, increasing downwards.
new coefficient value.

INT16 EKernel::SetKernelData(FLOAT32 f32Data00, FLOAT32 f32Data10, FLOAT32


f32Data20, FLOAT32 f32Data01, FLOAT32 f32Data11, FLOAT32 f32Data21, FLOAT32
f32Data02, FLOAT32 f32Data12, FLOAT32 f32Data22);

Sets the coefficient values for a 3x3 kernel.

104

EasyImage: Image Processing

Parameters
f32Data00, ... f32Data22

coefficient value at corresponding column and row indices.

INT16 EKernel::SetKernelData(FLOAT32 f32Data00, FLOAT32 f32Data10, FLOAT32


f32Data20, FLOAT32 f32Data30, FLOAT32 f32Data40, FLOAT32 f32Data01, FLOAT32
f32Data11, FLOAT32 f32Data21, FLOAT32 f32Data31, FLOAT32 f32Data41, FLOAT32
f32Data02, FLOAT32 f32Data12, FLOAT32 f32Data22, FLOAT32 f32Data32, FLOAT32
f32Data42, FLOAT32 f32Data03, FLOAT32 f32Data13, FLOAT32 f32Data23, FLOAT32
f32Data33, FLOAT32 f32Data43, FLOAT32 f32Data04, FLOAT32 f32Data14, FLOAT32
f32Data24, FLOAT32 f32Data34, FLOAT32 f32Data44);

Sets the coefficient values for a 5x5 kernel.


Parameters
f32Data00, ... f32Data44

coefficient value at corresponding column and row indices.

INT16 EKernel::SetKernelData(FLOAT32 f32Data00, FLOAT32 f32Data10, FLOAT32


f32Data20, FLOAT32 f32Data30, FLOAT32 f32Data40, FLOAT32 f32Data50, FLOAT32
f32Data60,FLOAT32 f32Data01, FLOAT32 f32Data11, FLOAT32 f32Data21, FLOAT32
f32Data31, FLOAT32 f32Data41, FLOAT32 f32Data51, FLOAT32 f32Data61, FLOAT32
f32Data02, FLOAT32 f32Data12, FLOAT32 f32Data22, FLOAT32 f32Data32, FLOAT32
f32Data42, FLOAT32 f32Data52, FLOAT32 f32Data62, FLOAT32 f32Data03, FLOAT32
f32Data13, FLOAT32 f32Data23, FLOAT32 f32Data33, FLOAT32 f32Data43, FLOAT32
f32Data53, FLOAT32 f32Data63,FLOAT32 f32Data04, FLOAT32 f32Data14, FLOAT32
f32Data24, FLOAT32 f32Data34, FLOAT32 f32Data44, FLOAT32 f32Data54, FLOAT32
f32Data64FLOAT32 f32Data05, FLOAT32 f32Data15, FLOAT32 f32Data25, FLOAT32 f32Data35,
FLOAT32 f32Data45, FLOAT32 f32Data55, FLOAT32 f32Data65FLOAT32 f32Data06, FLOAT32
f32Data16, FLOAT32 f32Data26, FLOAT32 f32Data36, FLOAT32 f32Data46, FLOAT32
f32Data56, FLOAT32 f32Data66);

Sets the coefficient values for a 7x7 kernel.


Parameters
f32Data00, ... f32Data66

2.1.2.3

coefficient value at corresponding column and row indices.

Global parameters

EKernel::Get/SetGain
FLOAT32 EKernel::GetGain();

Returns the global gain.


VOID EKernel::SetGain(FLOAT32 f32Gain);

Sets the global gain.


Parameters
f32Gain

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

C++ Reference Manual 6.7.1

EKernel::Get/SetOffset
UINT32 EKernel::GetOffset();

Returns the global offset (a constant added to the convolution result).


VOID EKernel::SetOffset(UINT32 un32Offset);

Sets the global offset (a constant added to the convolution result).


Parameters
un32Offset

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

new outside value

EKernel::Get/SetRectifier
INT16 EKernel::GetRectifier();

Returns the rectification mode, as defined by enum KERNEL_RECTIFIER.


VOID EKernel::SetRectifier(INT16 n16Rectifier);

Sets the rectification mode, as defined by enum KERNEL_RECTIFIER.


Parameters
n16Rectifier

2.1.2.4

new rectification mode.

Sizing

EKernel::Get/SetSizeX
INT16 EKernel::GetSizeX();

Returns the number of coefficients along a row.


INT16 EKernel::SetSizeX(INT16 n16SizeX);

Sets the number of coefficients along a row.


Parameters
n16SizeX

106

new row size.

EasyImage: Image Processing

EKernel::Get/SetSizeY
INT16 EKernel::GetSizeY();

Returns the number of coefficients along a column.


INT16 EKernel::SetSizeY(INT16 n16SizeY);

Sets the number of coefficients along a column.


Parameters
n16SizeY

2.2

new column size.

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

EMovingAverage Class Members

2.2.2.1

Construction

EmovingAverage: Construction
EMovingAverage();

Constructs a void moving average context.


Note. A void moving average context has no internal buffers allocated and cannot be used for
integration. Use the SetSize member after construction, or the initializing constructor instead.
EMovingAverage(UINT32 un32Period, INT32 n32Width, INT32 n32Height, BOOL bInternal=
TRUE);

Constructs and initializes a moving average context.

107

C++ Reference Manual 6.7.1

Parameters
un32Period
n32Width
n32Height
bInternal

number of images on which to integrate. A power of 2 is recommended.


image width (all images used for averaging must be of the same size).
image height (all images used for averaging must be of the same size).
buffer allocation scheme. When TRUE, the moving average context
provides the image to be acquired into (see member GetSrcImage).

EMovingAverage::Get/SetSize
void GetSize(UINT32& un32Period, INT32& n32Width, INT32& n32Height, BOOL&
bInternal);

Queries a moving average context for the current parameter settings.


Parameters
un32Period
n32Width
n32Height
bInternal

number of images on which to integrate.


image width (all images used for averaging must be of the same size).
image height (all images used for averaging must be of the same size).
buffer allocation scheme.

void SetSize(UINT32 un32Period, INT32 n32Width, INT32 n32Height, BOOL bInternal=


TRUE);

Initializes a moving average context with appropriate parameters.


Parameters
un32Period
n32Width
n32Height
bInternal

number of images on which to integrate. A power of 2 is recommended.


image width.
image height.
buffer allocation scheme. When TRUE, the moving average context
provides the image to be acquired into (see member GetSrcImage).

EMovingAverage::Get/SetSize
void GetSize(UINT32& un32Period, INT32& n32Width, INT32& n32Height, BOOL&
bInternal);

Queries a moving average context for the current parameter settings.


Parameters
un32Period
n32Width
n32Height
bInternal

number of images on which to integrate.


image width (all images used for averaging must be of the same size).
image height (all images used for averaging must be of the same size).
buffer allocation scheme.

void SetSize(UINT32 un32Period, INT32 n32Width, INT32 n32Height, BOOL bInternal=


TRUE);

Initializes a moving average context with appropriate parameters.


Parameters
un32Period
n32Width
108

number of images on which to integrate. A power of 2 is recommended.


image width.

EasyImage: Image Processing

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

pointer to the source image.


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();

Returns a pointer to an image to be acquired into.


void Average(EROIBW8* pDst);

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);

109

C++ Reference Manual 6.7.1

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();

Returns a pointer to an image to be acquired into.


void Average(EROIBW8* pDst);

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

EasyImage: Image Processing

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

Simple thresholding (gray-level or color).


Double thresholding (gray-level).
Automatic thresholding (gray-level).
Automatic threshold level from histogram (gray-level).
Returns a suitable threshold value for a gray-level image binarization.

Arithmetic and logic operations


ImgOper
Between EBW8 and/or EBW16 and/or EC24 images or constants.
ImgCopy
Copies an image in another of the same type.
ImgGet/SetOverlayColor
Returns/Sets the color of the overlay in the destination image when the
overlay source image is of BW8 type.
Convolution
ImgConvolKernel
Performs a convolution in image space, i.e. applies a convolution kernel.
ImgConvolSymmetricKernel Performs a convolution in image space, i.e. applies a square symmetric
convolution kernel of size 3x3, 5x5 or 7x7.
ImgConvolHighpass1
Filters an image using a 3x3 high-pass kernel.
ImgConvolHighpass2
Filters an image using a 3x3 high-pass kernel.
ImgConvolLaplacianX
Takes the horizontal second derivative.
ImgConvolLaplacianY
Takes the vertical second derivative.
ImgConvolLaplacian4
Derives an image using a 4-neighbors Laplacian kernel.
ImgConvolLaplacian8
Derives an image using an 8-neighbors Laplacian kernel.
ImgConvolLowpass1
Filters an image using a 3x3 low-pass kernel.
ImgConvolLowpass2
Filters an image using a 3x3 low-pass kernel.
ImgConvolLowpass3
Filters an image using a 3x3 low-pass kernel.
ImgConvolGradientX
Derives an image along X using a Gradient kernel.
ImgConvolGradientY
Derives an image along Y using a Gradient kernel.
ImgConvolGradient
Extracts the edges of an image by summing the absolute values of the
Gradient X and Gradient Y derivatives.
ImgConvolPrewittX
Derives an image along X using a Prewitt kernel.
ImgConvolPrewittY
Derives an image along Y using a Prewitt kernel.
ImgConvolPrewitt
Extracts the edges of an image by summing the absolute values of the
Prewitt X and Prewitt Y derivatives.
ImgConvolSobelX
Derives an image along X using a Sobel kernel.
ImgConvolSobelY
Derives an image along Y using a Sobel kernel.
ImgConvolSobel
Extracts the edges of an image by summing the absolute values of the
Sobel X and Sobel Y derivatives.

111

C++ Reference Manual 6.7.1

ImgConvolRoberts
ImgConvolUniform
ImgConvolGaussian
ImgModulusImage
ImgArgumentImage
ImgGradientScalar

Applies the Roberts edge extractor.


Low-pass filters an image using a uniform rectangular filter of arbitrary
size.
Applies Gaussian filtering (binomial weights) in rectangular kernels of odd
size.
Sets up the lookup-table used to boost processing of the
ImgGradientScalar function.
Sets up the lookup-table used to boost processing of the
ImgGradientScalar function.
Computes the desired gradient map.

Morphology (Non-linear Filtering)


ImgOpenBox
Opening.
ImgOpenDisk
Opening on a quasi-circular kernel.
ImgCloseBox
Closure.
ImgCloseDisk
Closure on a quasi-circular kernel.
ImgDilateBox
Dilation.
ImgDilateDisk
Dilation on a quasi-circular kernel.
ImgErodeBox
Erosion.
ImgErodeDisk
Erosion on a quasi-circular kernel.
ImgWhiteTopHatBox
Top-hat filter for white thin features.
ImgWhiteTopHatDisk
Top-hat filter for white thin features on a quasi-circular kernel.
ImgBlackTopHatBox
Top hat-filter for black thin features.
ImgBlackTopHatDisk
Top hat-filter for black thin features on a quasi-circular kernel.
ImgMorphoGradientBox
Morphological gradient.
ImgMorphoGradientDisk
Morphological gradient on a quasi-circular kernel.
ImgMedian
Median filter for impulse noise removal.
ImgThick
Thickening.
ImgThin
Thinning.
ImgDistance
Distance function.
Geometric transforms
ImgHorizontalMirror
ImgVerticalMirror
ImgSetCircleWarp
ImgWarp
ImgScaleRotate
ImgRegister
ImgShrink
ImgLinearTransform

Reflection around the Y axis.


Reflection around the X axis.
Prepares a circle unwarping transform.
User-defined transform.
Linear transformation (translation, scaling, rotation) with resampling.
Linear transform (translation, rotation and optional scaling) to realign an
image with respect to another based on one or two pivot points.
Anti-aliased size reduction.
General affine transform.

Histograms
ImgHistogram
ImgCumulateHistogram
ImgAnalyseHistogram

Computes the gray-level histogram.


Cumulates histogram values in another histogram.
Computes image features from the histogram.

112

EasyImage: Image Processing

ImgEqualize
ImgSetupEqualize

Enhances the image contrast by redistributing gray levels so that the


histogram becomes flat.
Prepares a lookup-table for image equalization, using an image
histogram.

Contouring
ImgContour

Iso-level curve.

Projections
ImgProjectOnAColumn
ImgProjectOnARow

Projects image pixels row by row.


Projects image pixels column by column.

Statistics
ImgArea
ImgAreaDoubleThreshold
ImgGravityCenter
ImgBinaryMoments
ImgWeightedMoments
ImgCount
ImgPixelCount
ImgPixelAverage
ImgLocalAverage
ImgPixelStdDev
ImgLocalDeviation
ImgPixelVariance
ImgPixelMax
ImgPixelMin
ImgPixelStat
ImgPixelCompare

Number of pixels with one threshold.


Number of pixels with two thresholds.
Gravity center.
Coordinate moments up to the second order (on a binarized image).
Weighted coordinate moments up to the second order (on a gray-level
image).
Counts the pixels meeting a user-defined condition.
Counts the pixels in the three value classes separated by two thresholds.
Computes the average pixel value in a gray-level or color image.
Computes the average in a rectangular window centered on every pixel.
Computes the average gray level/color value in an image, and its
standard deviation.
Computes the standard deviation in a rectangular window centered on
every pixel.
Pixel average and variance (gray-level and color).
Maximum pixel value.
Minimum pixel value.
Minimum, maximum and average pixel value.
Counts the number of different pixels between two images.

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

Transforms the contents of an image to an image of another type.


Converts a black & white image to its YUV 4:2:2 encoded equivalent.

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

C++ Reference Manual 6.7.1

ImgProfileDerivative
ImgGetProfilePeaks
ImgConvolUniform
Frame
ImgGet/SetFrame
ImgRebuildFrame

First derivative of an image profile.


Peak detection in a profile.
Uniform filtering of profile data.

ImgRealignFrame
ImgMatchFrames
ImgSwapFrames

Extracts/Replaces the frame of given parity.


Reconstructs one frame from the other one (for use with interlaced
images).
Shifts a frame horizontally (for use with interlaced images).
Determines the amount by which to shift (for use with interlaced images).
Exchanges the even and odd rows of an image.

Miscellaneous
ImgFocusing

Measures the focusing of an image.

Declare using
#include "EImage.h"

3.1

Intensity Scale Transforms

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
constant gain. By default (argument omitted) 1, i.e. no change.
constant offset. By default (argument omitted) 0, i.e. no change

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
constant gain triplet. By default (argument omitted) 1 for all components,
i.e. no change.

EasyImage: Image Processing

Offset

constant offset triplet. By default (argument omitted) 0 for all components,


i.e. no change.

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
imposed average.
imposed standard deviation.

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

C++ Reference Manual 6.7.1

Parameters
pSrcImage
pDstImage
pLut
un32NumScalingBits

pointer to the source image/ROI.


pointer to the destination image/ROI.
pointer to the lookup vector.
number of scaling bits (or right padding bits).

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
pointer to the user-defined transformation function (the input argument is
transformed into the returned value).
tells whether a temporary lookup table should be used to speed up
computation.

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

EasyImage: Image Processing

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

C++ Reference Manual 6.7.1

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
threshold value, as defined by enum IMG_THRESHOLD_MODES. In the
case of absolute thresholding, the threshold value is given instead (by
default: un32Threshold = IMG_MIN_RESIDUE_THRESHOLD).
value for pixels below the threshold (by default: un8LowValue =
bw16LowValue = 0).
value for pixels above the threshold (by default: un8HighValue = 255 and
bw16HighValue = 65535).
fraction of the image pixels that will be set below the threshold. Only used
when the threshold value is IMG_RELATIVE_THRESHOLD (by default:
f32RelativeThreshold = 0.5).

EasyImage: Image Processing

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
three lower thresholds combined in a single color value.
three upper thresholds combined in a single color value.
pointer to the color lookup table to be applied before thresholding, if any.
value for pixels falling outside the range (by default: un8RejectValue = 0).
value for pixels falling inside the range (by default: un8AcceptValue =
255).

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
threshold value.

119

C++ Reference Manual 6.7.1

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

pointer to the source Image/ROI.


pointer to the destination Image/ROI.
threshold value, as defined by enum IMG_THRESHOLD_MODES. In the
case of absolute thresholding, the threshold value is given instead (by
default: un32Threshold = IMG_MIN_RESIDUE_THRESHOLD).
fraction of the image pixels that will be set below the threshold. Only used
when the threshold value is IMG_RELATIVE_THRESHOLD (by default:
f32RelativeThreshold = 0.5).

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
low threshold value.
high threshold value.
value for pixels below the low threshold (by default: un8LowValue =
bw16LowValue=0).
value for pixels between the two thresholds (by default: un8MidValue =
127 and bw16MidValue = 32767).
value for pixels above the high threshold (by default: un8HighValue = 255
and bw16HighValue = 65535).

Example
ImgDoubleThreshold(&SrcImage, &DstImage, 100, 200, 10, 127, 255);

120

EasyImage: Image Processing

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

pointer to a vector containing an image histogram.


lower bound of the useful gray-level interval (by default: un32From = 0).
upper bound of the useful gray-level interval (by default: un32To = 255 in
the BW8 case and un32To = 65535 in the BW16 one).

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

C++ Reference Manual 6.7.1

Parameters
pHistogram
un32Threshold

f32AverageBlack
f32AverageWhite
f32RelativeThreshold

un32From
un32To

pointer to a vector containing an image histogram.


reference to the threshold value. Before calling the function, must be set
to the appropriate thresholding mode, as defined by enum
IMG_THRESHOLD_MODES.
average gray level of the dark pixels (below threshold).
average gray level of the light pixels (above threshold).
relative threshold value, relevant only in the
IMG_RELATIVE_THRESHOLD mode (by default: f32RelativeThreshold =
0.5).
lower bound of the analysed gray-level range (by default: un32Form = 0).
upper bound of the analysed gray-level range (by default: un32To = 255
in the BW8 case and un32To = 65535 in the BW16 one).

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

pointer to the source image/ROI.


threshold mode, as defined by enum IMG_THRESHOLD_MODES. In the
case of absolute thresholding, the threshold value is given instead.
fraction of the image pixels that will be set below the threshold. Only used
when the threshold value is IMG_RELATIVE_THRESHOLD (by default:
f32RelativeThreshold = 0.5).

EasyImage: Image Processing

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

histogram of the image.


threshold.
average value of the black pixels (pixels under the threshold).
average value of the white pixels (pixels over the threshold).

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

histogram of the image.


low threshold.
high threshold.
average value of the black pixels (pixels under the low threshold).
average value of the gray pixels (pixels between the low threshold and the
high threshold).
average value of the white pixels (pixels over the high threshold).

123

C++ Reference Manual 6.7.1

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

pointer to a vector containing an image histogram.


number of requested thresholds.
reference to the vector of computed thresholds. The threshold value
always belongs to the class above it. So, the threshold value is the first
pixel value of the class above.

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

Arithmetic & logic

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

EasyImage: Image Processing

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

C++ Reference Manual 6.7.1


void ImgOper(enum ARITH_LOGIC_OPERATIONS eOperation, EROIBW16* pSrc0, EROIBW8*
pSrc1, EROIBW16* pDst);

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

Const BW1 -> Image BW1

Const BW8 -> Image BW8

Const BW16 -> Image BW16

Const C24 -> Image C24

Image BW1 -> Image BW1

Image BW8 -> Image BW8

Image BW8 -> Image C24

Image BW16 -> Image BW16

Image C24 -> Image C24

S
H
I
F
T

L
O
G
I
C
A
L

S
E
T

O
V
E
R
L
A
Y

Image BW1, Image BW1 -> Image BW1

Const BW8, Image BW8 -> Image BW8


Image BW8, Const BW8 -> Image BW8

x
x

Image BW8, Image BW8 -> Image BW8

Const BW16, Image BW16 -> Image BW16


Image BW16, Const BW16 -> Image BW16

x
x

Image BW16, Image BW16 -> Image BW16

Const C24, Image C24 -> Image C24


Image C24, Const C24 -> Image C24
Image C24, Image C24 -> Image C24

x
x

x
x

Image BW8, Image BW8 -> Image C24


x

Image BW8, Image C24 -> Image C24

pSrc
pSrc0
pSrc1
bw1Const

126

Image C24, Image BW8 -> Image C24

Parameters
eOperation

O
t
h
e
r
s

arithmetic or logic operator, as defined by enum


ARITH_LOGIC_OPERATIONS.
pointer to a source image/ROI (left or right operand).
pointer to the first source image/ROI (left operand).
pointer to the second source image/ROI (right operand).
gray-level constant.

EasyImage: Image Processing

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);

Copies an image in another of the same type.


Parameters
pSrc
pDst

pointer to the source image/ROI.


pointer to the destination image/ROI.

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);

Copies a constant in all pixels of an image.


Parameters
bw1/bw8/bw16 Const
c24/c15/c16 Const
pDst

gray-level constant.
color constant.
pointer to the destination image/ROI.

Example
EImageBW8 DstImage;
ImgCopy(123, DstImage);

127

C++ Reference Manual 6.7.1

Declare using
#include "EImage.h"

Img Get/Set OverlayColor


void ImgSetOverlayColor(EC24 c24Color);
EC24 ImgGetOverlayColor();

Returns/Sets the color of the overlay in the destination image when a BW8 Image is used as overlay
source image in functions:

ImgOper(IMG_OVERLAY, &GraySource, &GrayOverlay, &ColorDestination);

ImgOper(IMG_OVERLAY, &ColorSource, &GrayOverlay, &ColorDestination);

ImgOper(IMG_OVERLAY, &GrayOverlay, &ColorDestination);

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

Convolution (Linear Filtering)

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);

Performs a convolution in image space, i.e. applies a convolution kernel.


Parameters
pSrcImage pointer to the source image/ROI.
pDstImage pointer to the destination image/ROI.
pKernel pointer to the convolution kernel.
Example
ImgConvolKernel(&SrcImage, &DstImage, pKernel);

Declare using
#include "EImage.h"

ImgConvolSymmetricKernel
void ImgConvolSymmetricKernel (EROIBW8* pSrcImage, EROIBW8* pDstImage, EKernel*
pKernel);

128

EasyImage: Image Processing


void ImgConvolSymmetricKernel (EROIBW16* pSrcImage, EROIBW16* pDstImage, EKernel*
pKernel);
void ImgConvolSymmetricKernel (EROIC24* pSrcImage, EROIC24* pDstImage, EKernel*
pKernel);

Performs a convolution in image space, i.e. applies a square symmetric convolution kernel of size 3x3,
5x5 or 7x7.
Parameters
pSrcImage
pDstImage
pKernel

pointer to the source image/ROI.


pointer to the destination image/ROI.
pointer to the convolution kernel.

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);

Filters an image using a 3x3 high-pass kernel:


0 -1 0
-1 5 -1
0 -1 0
Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

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

C++ Reference Manual 6.7.1

Filters an image using a 3x3 high-pass kernel:


-1 -1 -1
-1 9 -1
-1 -1 -1
Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

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);

Takes the horizontal second derivative


Kernel:
1 -2 1
Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

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);

Takes the vertical second derivative


Kernel:
1
-2
1
Parameters
pSrcImage
pDstImage

130

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

EasyImage: Image Processing

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);

Takes the second derivative of an image using a 4-neighbor Laplacian kernel:


0 1 0
1 -4 1
0 1 0
Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

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);

Takes the second derivative of an image using an 8-neighbor Laplacian kernel:


1 1 1
1 -8 1
1 1 1
Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

Example
ImgConvolLaplacian8(&SrcImage, &DstImage);

Declare using
#include "EImage.h"

ImgConvolLowpass1
void ImgConvolLowpass1(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);

131

C++ Reference Manual 6.7.1


void ImgConvolLowpass1(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolLowpass1(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);

Filters an image using a 3x3 low-pass kernel:


1 1 1
1 1 1
1 1 1
Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

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);

Filters an image using a 3x3 low-pass kernel:


1 1 1
1 0 1
1 1 1
Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

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);

Filters an image using a 3x3 low-pass kernel:


1 2 1
2 4 2
1 2 1

132

EasyImage: Image Processing

Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

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);

Derives an image along X using a Gradient kernel:


0 0 0
-1 0 1
0 0 0
Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

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);

Derives an image along Y using a Gradient kernel:


0 -1 0
0 0 0
0 1 0
Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

Example
ImgConvolGradientY(&SrcImage, &DstImage);

Declare using
#include "EImage.h"

133

C++ Reference Manual 6.7.1

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

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

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);

Derives an image along X using a Prewitt kernel:


-1 0 1
-1 0 1
-1 0 1
Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

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);

Derives an image along Y using a Prewitt kernel:


-1 -1 -1
0 0 0
1 1 1

134

EasyImage: Image Processing

Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

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

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

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);

Derives an image along X using a Sobel kernel:


-1 0 1
-2 0 2
-1 0 1
Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

Example
ImgConvolSobelX(&SrcImage, &DstImage);

Declare using
#include "EImage.h"

135

C++ Reference Manual 6.7.1

ImgConvolSobelY
void ImgConvolSobelY(EROIBW8* pSrcImage, EROIBW8* pDstImage= NULL);
void ImgConvolSobelY(EROIBW16* pSrcImage, EROIBW16* pDstImage= NULL);
void ImgConvolSobelY(EROIC24* pSrcImage, EROIC24* pDstImage= NULL);

Derives an image along Y using a Sobel kernel:


-1 -2 -1
0 0 0
1 2 1
Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

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

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

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

EasyImage: Image Processing

Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).

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

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image) and the default
value for un32HalfWidth (1) has to be used.
half of the kernel width (by default: un32HalfWidth = 1; 0 is allowed).
half of the kernel height (by default: same as un32HalfWidth; 0 is
allowed).

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);

Applies Gaussian filtering (binomial weights) in rectangular kernel of odd size.


Parameters
pSrcImage

pointer to the source image/ROI.

137

C++ Reference Manual 6.7.1

pDstImage
un32HalfWidth
un32HalfHeight

pointer to the destination image/ROI. If NULL (the default value), this


operation is destructive (i.e. applied to the source image).
half of the kernel width (by default: un32HalfWidth = 1; 0 is allowed).
half of the kernel height (by default: same as un32HalfWidth; 0 is
allowed).

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

pointer to the destination image.


gain value to be applied to the modulus. 1 saturates; 1 / Sqrt(2) does not.

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);

Prepares a lookup-table image for use for gradient argument computation.


The scale and phase of the gradient argument can be adjusted. The argument angles are counted
clockwise on a 0..255 scale in the BW8 context and on a 0..65535 scale in the BW16 one,
corresponding to a specified range (full turn by default, specified period otherwise). The argument
phase is counted on a 0..255 scale or on a 0..65535 scale too. Angle values outside the 0.255
(0.65535) interval are wrapped. The period length is given in the current angle unit.
Parameters
pDst
bw8(bw16)Phase

138

pointer to the destination image.


argument value corresponding to the horizontal direction, in 256th
(65536th) of the period (by default bw8(bw16) phase=0).

EasyImage: Image Processing

f32Period

range of argument values corresponding to the 0..255 (0..65535) interval,


in the current angle unit. (by default: f32Period=0).

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
pointer to the image/ROI used as a preset lookup-table. This lookup table
can be generated by one of ImgArgumentImage or ImgModulusImage, or
be user-defined.

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

C++ Reference Manual 6.7.1

3.5

Morphology (Non-linear Filtering)

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);

Performs an opening on an image (erosion followed by dilation) on a rectangular kernel.


Parameters
pSrc
pDst
un32HalfWidth
un32HalfHeight

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).
half of the box width minus one as shown on the picture below (by default:
un32HalfWidth = 1; 0 is allowed).
half of the box height minus one as shown on the picture below (by
default: same as un32HalfWidth; 0 is allowed).

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);

Performs an opening on an image (erosion followed by dilation) on a quasi-circular kernel.

140

EasyImage: Image Processing

Parameters
pSrc
pDst
un32HalfWidth

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).
half width of the kernel minus one as shown on the picture below (by
default: un32HalfWidth=1; 0 is allowed).

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);

Performs a closing on an image (dilation followed by erosion) on a rectangular kernel.


Parameters
pSrc
pDst
un32HalfWidth
un32HalfHeight

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).
half of the box width minus one (by default: un32HalfWidth = 1; 0 is
allowed).
half of the box height minus one (by default: same as un32HalfWidth; 0 is
allowed).

Example
ImgCloseBox(&SrcImage, &DstImage, 1, 2);

Declare using
#include "EImage.h"

141

C++ Reference Manual 6.7.1

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);

Performs a closing on an image (dilation followed by erosion) on a quasi-circular kernel.


Parameters
pSrc
pDst
un32HalfWidth

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).
half width of the kernel minus one (by default: un32HalfWidth = 1; 0 is
allowed).

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);

Performs a dilation on an image (maximum of the gray values in a defined neighborhood) on a


rectangular kernel.
Parameters
pSrc
pDst
un32HalfWidth
un32HalfHeight

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).
half of the box width minus one (by default: un32HalfWidth = 1; 0 is
allowed).
half of the box height minus one (by default: same as un32HalfWidth; 0 is
allowed).

Example
ImgDilateBox(&SrcImage, &DstImage, 1, 2);

Declare using
#include "EImage.h"

142

EasyImage: Image Processing

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

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).
half width of the kernel minus one (by default: un32HalfWidth = 1; 0 is
allowed).

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);

Performs an erosion on an image (minimum of the gray values in a defined neighborhood) on a


rectangular kernel.
Parameters
pSrc
pDst
un32HalfWidth
un32HalfHeight

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).
half of the box width minus one (by default: un32HalfWidth = 1; 0 is
allowed).
half of the box height minus one (by default: same as un32HalfWidth; 0 is
allowed).

Example
ImgErodeBox(&SrcImage, &DstImage, 1, 2);

Declare using
#include "EImage.h"

143

C++ Reference Manual 6.7.1

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

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).
half width of the kernel minus one (by default: un32HalfWidth = 1; 0 is
allowed).

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

pointer to the source image/ROI.


pointer to the destination image/ROI. Must not be the same as the source
image.
half of the box width minus one (by default: un32HalfWidth = 1; 0 is
allowed).
half of the box height minus one (by default: same as un32HalfWidth; 0 is
allowed).

Example
ImgWhiteTopHatBox(&SrcImage, &DstImage, 1, 2);

Declare using
#include "EImage.h"

144

EasyImage: Image Processing

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

pointer to the source image/ROI.


pointer to the destination image/ROI. Must not be the same as the source
image.
half width of the kernel minus one (by default: un32HalfWidth = 1; 0 is
allowed).

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

pointer to the source image/ROI.


pointer to the destination image/ROI. Must not be the same as the source
image.
half of the box width minus one (by default: un32HalfWidth = 1; 0 is
allowed).
half of the box height minus one (by default: same as un32HalfWidth; 0 is
allowed).

Example
ImgBlackTopHatBox(&SrcImage, &DstImage, 1, 2);

Declare using
#include "EImage.h"

145

C++ Reference Manual 6.7.1

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

pointer to the source image/ROI.


pointer to the destination image/ROI. Must not be the same as the source
image.
half width of the kernel minus one (by default: un32HalfWidth = 1; 0 is
allowed).

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);

Computes the morphological gradient of an image using a rectangular kernel.


The morphological gradient is the difference between the dilation and the erosion of the image, using
the same structuring element.
The kernel size is a pair of odd numbers; they must be halved before they are passed. For instance, a
3x5 kernel is passed as 1x2.
Parameters
pSrc
pDst
un32HalfWidth
un32HalfHeight

146

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).
half of the box width minus one (by default: un32HalfWidth = 1; 0 is
allowed).
half of the box height minus one (by default: same as un32HalfWidth; 0 is
allowed).

EasyImage: Image Processing

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);

Computes the morphological gradient of an image using a quasi-circular kernel.


The morphological gradient is the difference between the dilation and the erosion of the image, using
the same structuring element.
Parameters
pSrc
pDst
un32HalfWidth

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image).
half width of the kernel minus one (by default: un32HalfWidth = 1; 0 is
allowed).

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

pointer to the source image/ROI.


pointer to the destination image/ROI. Must not be the same as source
image.

Example
ImgMedian(&SrcImage, &DstImage);

Declare using
#include "EImage.h"

147

C++ Reference Manual 6.7.1

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

pointer to the source image/ROI.


pointer to the destination image/ROI. Must not be the same as source
image.
pointer to the thickening kernel.
rotation mode, as defined by enum KERNEL_ROTATION.
number of iterations to apply. 0 indicates stop when convergence is
reached. Upon return, gives the number of passes actually performed. If
the rotation mode is set to either CLOCKWISE_ROTATION or
ANTICLOCKWISE_ROTATION, a pass comprises eight kernel rotations.

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

pointer to the source image/ROI.


pointer to the destination image/ROI. Must not be the same as source
image.

EasyImage: Image Processing

pThinKernel
Mode
n32Iter

pointer to the thinning kernel.


rotation mode, as defined by enum KERNEL_ROTATION.
number of iterations to apply. 0 indicates stop when convergence is
reached. Upon return, gives the number of passes actually performed. If
the rotation mode is set to either CLOCKWISE_ROTATION or
ANTICLOCKWISE_ROTATION, a pass comprises eight kernel rotations.

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

pointer to the source image/ROI.


pointer to the destination image/ROI. Must not be the same as source
image.
out-of-bounds image value. By default, this value is 0.

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

C++ Reference Manual 6.7.1

One pivot registration (sub-pixel translation)


void ImgRegister(EROIBW8* pSrcImage, EROIBW8* pDstImage, FLOAT32 f32SrcPivot0X,
FLOAT32 f32SrcPivot0Y, FLOAT32 f32DstPivot0X, FLOAT32 f32DstPivot0Y, INT32
n32InterpolationBits= 0);
void ImgRegister(EROIBW16* pSrcImage, EROIBW16* pDstImage, FLOAT32 f32SrcPivot0X,
FLOAT32 f32SrcPivot0Y, FLOAT32 f32DstPivot0X, FLOAT32 f32DstPivot0Y, INT32
n32InterpolationBits= 0);
void ImgRegister(EROIC24* pSrcImage, EROIC24* pDstImage, FLOAT32 f32SrcPivot0X,
FLOAT32 f32SrcPivot0Y, FLOAT32 f32DstPivot0X, FLOAT32 f32DstPivot0Y, INT32
n32InterpolationBits= 0);

Two pivots registration (translation, rotation and optional scaling)


void ImgRegister(EROIBW8* pSrcImage, EROIBW8* pDstImage, FLOAT32 f32SrcPivot0X,
FLOAT32 f32SrcPivot0Y, FLOAT32 f32SrcPivot1X, FLOAT32 f32SrcPivot1Y, FLOAT32
f32DstPivot0X, FLOAT32 f32DstPivot0Y, FLOAT32 f32DstPivot1X, FLOAT32 f32DstPivot1Y,
INT32 n32InterpolationBits= 0, BOOL bResize= FALSE);
void ImgRegister(EROIBW16* pSrcImage, EROIBW16* pDstImage, FLOAT32 f32SrcPivot0X,
FLOAT32 f32SrcPivot0Y, FLOAT32 f32SrcPivot1X, FLOAT32 f32SrcPivot1Y, FLOAT32
f32DstPivot0X, FLOAT32 f32DstPivot0Y, FLOAT32 f32DstPivot1X, FLOAT32 f32DstPivot1Y,
INT32 n32InterpolationBits= 0, BOOL bResize= FALSE);
void ImgRegister(EROIC24* pSrcImage, EROIC24* pDstImage, FLOAT32 f32SrcPivot0X,
FLOAT32 f32SrcPivot0Y, FLOAT32 f32SrcPivot1X, FLOAT32 f32SrcPivot1Y, FLOAT32
f32DstPivot0X, FLOAT32 f32DstPivot0Y, FLOAT32 f32DstPivot1X, FLOAT32 f32DstPivot1Y,
INT32 n32InterpolationBits= 0, BOOL bResize= FALSE);

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

pointer to the source image/ROI.


pointer to the destination image/ROI. May not be the same as pSrcImage.
first pivot point abscissa in the source image.
first pivot point ordinate in the source image.
second pivot point abscissa in the source image.

EasyImage: Image Processing

f32SrcPivot1Y
f32SrcPivot2X
f32SrcPivot2Y
f32DstPivot0X
f32DstPivot0Y
f32DstPivot1X
f32DstPivot1Y
f32DstPivot2X
f32DstPivot2Y
n32InterpolationBits
bResize

second pivot point ordinate in the source image.


third pivot point abscissa in the source image.
third pivot point ordinate in the source image.
first pivot point abscissa in the destination image.
first pivot point ordinate in the destination image.
second pivot point abscissa in the destination image.
second pivot point ordinate in the destination image.
third pivot point abscissa in the destination image.
third pivot point ordinate in the destination image.
number of bits of accuracy for interpolation. Allowed values are 0 (no
interpolation, nearest neighbor), 4 or 8.
TRUE if scaling is allowed.

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);

Mirrors an image horizontally (the columns are swapped)


Parameters
pSrcImage

pointer to the source image/ROI.

Example
EImageBW8 Image;
ImgHorizontalMirror(&Image);

Declare using
#include "EImage.h"

ImgVerticalMirror
void ImgVerticalMirror(EROIBW8* pSrcImage);
void ImgVerticalMirror(EROIBW16* pSrcImage);
void ImgVerticalMirror(EROIC24* pSrcImage);

Mirrors an image vertically (the rows are swapped)

151

C++ Reference Manual 6.7.1

Parameters
pSrcImage

pointer to the source image/ROI.

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

Abscissa of the ring-wedge center.


Ordinate of the ring-wedge center.
Number of points to be sampled in the radial direction.
Starting radius of the ring-wedge shape.
Ending radius of the ring-wedge shape.
Number of points to be sampled in the tangent direction.
Starting angle of the ring-wedge shape.
Ending angle of the ring-wedge shape.
Destination warp image for the abscissae.
Destination warp image for the ordinates.

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

EasyImage: Image Processing

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
pointer to the X lookup image.
pointer to the Y lookup image.
horizontal translation.
vertical translation.

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

pointer to the source image/ROI.


pivot point abscissa in the source image.
pivot point ordinate in the source image.
pivot point abscissa in the destination image.
pivot point ordinate in the destination image.
scale factor for the abscissae.
153

C++ Reference Manual 6.7.1

f32ScaleY
f32Rotation
pDstImage
n32InterpolationBits

scale factor for the ordinates.


rotation angle, using the current angle unit.
pointer to the destination image/ROI. May not be the same as pSrcImage.
number of bits of accuracy for interpolation. Allowed values are 0 (no
interpolation, nearest neighbour), 4 or 8.

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);

Resizes an image to a smaller size. Pre-filtering is applied to avoid aliasing.


Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI.

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

EasyImage: Image Processing

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);

Computes the histogram of an image (count of each gray level value).


Parameters
pSrcImage
pHistogram
un32MostSignificantBit
un32NumUsedBits
bSaturate

pointer to the source image/ROI.


pointer to the destination vector.
index of the most significant bit of the pixels (0 has weight 1).
number of significant bits; the histogram will possess 2^NumUsedBits
entries.
boolean indicating if values larger than 2^MostSignificantBit-1 are
saturated (default TRUE) or not (FALSE).

Example
EImageBW8 Image;
EBWHistogramVector Histogram;
ImgHistogram(&Image, &Histogram);

Declare using
#include "EImage.h"

155

C++ Reference Manual 6.7.1

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

pointer to the source vector.


pointer to the destination vector.

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

pointer to the histogram vector.


parameter to be computed, as defined by enum
IMG_HISTOGRAM_FEATURE.
starting index of the gray levels range.
ending index of the gray levels range.

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

pointer to the source image/ROI.


pointer to the destination image/ROI.

EasyImage: Image Processing

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

pointer to the source histogram vector.


pointer to the destination lookup-table vector.

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);

Follows the contour of an object.


A threshold is applied so that objects become blobs. The contour is a closed or not (see property
Get/Set Closed), connected path forming the boundary of the blob.
157

C++ Reference Manual 6.7.1

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

pointer to the source image/ROI.


traversal mode, as defined by enum CONTOUR_MODE.
start point abscissa.
start point ordinate.
thresholding mode, as defined by enum CONTOUR_THRESHOLD.
threshold level.
contour connexity, as defined by enum CONNEXITY.
pointer to the destination vector.
specifies if freeman codes are to be retrieved rather than pixel values.

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

EasyImage: Image Processing

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

pointer to the source image/ROI.


pointer to the destination vector.

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

pointer to the source image/ROI.


pointer to the destination vector.

Example
ImgProjectOnARow(&SrcImage, &DstVect);

Declare using
#include "EImage.h"

159

C++ Reference Manual 6.7.1

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

pointer to the source image/ROI.


threshold.
reference to the count of pixels above the threshold.

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

pointer to the source image/ROI.


inferior threshold.
superior threshold.
reference to the count of pixels between the two thresholds.

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

EasyImage: Image Processing


void ImgBinaryMoments(EROIBW16* pSrcImage, UINT32 un32Threshold, FLOAT32& f32M,
FLOAT32& f32Mx, FLOAT32& f32My);
void ImgBinaryMoments(EROIBW16* pSrcImage, UINT32 un32Threshold, FLOAT32& f32M,
FLOAT32& f32Mx, FLOAT32& f32My, FLOAT32& f32Mxx, FLOAT32& f32Mxy, FLOAT32& f32Myy);

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

pointer to the source image/ROI.


binarization threshold.
reference to the zero-th order moment (area).
reference to the first order moments (sum of abscissas and ordinates).
reference to the second order uncentered moments (sum of squared
abscissas, cross-product and squared ordinates).

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

C++ Reference Manual 6.7.1

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

pointer to the source image/ROI.


binarization threshold.
reference to the zero-th order weighted moment (total gray value).
reference to the first order moments (weighted sums of abscissas and
ordinates).
f32Mxx, f32Mxy, f32Myy
reference to the second order uncentered moments (weighted sums of
squared abscissas, cross-product and squared ordinates).
f32Mxxx, f32Mxxy, f32Mxyy, f32Myyy
reference to the third order uncentered moments (weighted sums of third
order products).
f32Mxxxx, f32Mxxxy, f32Mxxyy, f32Mxyyy, f32Myyyy
reference to the fourth order uncentered moments (weighted sums of
fourth order products).

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

pointer to the source image/ROI.


threshold.
reference to the gravity center abscissa.
reference to the gravity center ordinate.

Example
EImageBW8 Image;
FLOAT32 f32X;
FLOAT32 f32Y;
ImgGravityCenter(&Image, 128, f32X, f32Y);

162

EasyImage: Image Processing

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));

Counts the number of pixels where a user-defined condition is met.


Parameters
pSrcImage
Condition

pointer to the source image/ROI.


Any function of a gray level or color value returning a boolean.

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

pointer to the source image/ROI.


inferior threshold.
superior threshold.
reference to the count of pixels striclty below the inferior threshold.
reference to the count of pixels between or equal to the two thresholds.
reference to the count of pixels strictly above the superior threshold.

Example
EImageBW8 Image;
INT32 n32Dark;
INT32 n32Medium;
INT32 n32Light;
ImgPixelCount(&Image, 85, 150, n32Dark, n32Medium, n32Light);

163

C++ Reference Manual 6.7.1

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);

Computes the average pixel value in a gray-level or color image.


Parameters
pSrcImage
pointer to the source image/ROI.
f32Average
reference to the average gray-level value.
f32Mean0, f32Mean1, f32Mean2
reference to the average values for the three color channels.
Example
EImageBW8 Image;
FLOAT32 f32Mean;
ImgPixelAverage(&Image, f32Mean);

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
half of the window width minus one.
half of the window height minus one.

Example
ImgLocalAverage(&SrcImage, &DstImage, 1, 3);

Declare using
#include "EImage.h"

164

EasyImage: Image Processing

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

pointer to the source image/ROI.


pointer to the destination image/ROI. Must not be the same as the source
image.
half of the window width minus one.
half of the window height minus one.

Example
ImgLocalDeviation(&SrcImage, &DstImage, 3, 5);

Declare using
#include "EImage.h"

165

C++ Reference Manual 6.7.1

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);

Computes the maximum gray level value in an image.


Parameters
pSrcImage
un8(bw16)MaxPixVal

pointer to the source image/ROI.


reference to the maximum value.

Example
EImageBW8 Image;
UINT8 un8Value;
ImgPixelMax(&Image, un8Value);

Declare using
#include "EImage.h"

166

EasyImage: Image Processing

ImgPixelMin
void ImgPixelMin(EROIBW8* pSrcImage, UINT8& un8MinPixVal);
void ImgPixelMin(EROIBW16* pSrcImage, EBW16& bw16MinPixVal);

Computes the minimum gray level value in an image.


Parameters
pSrcImage
un8(bw16)MinPixVal

pointer to the source image/ROI.


reference to the minimum value.

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

pointer to the source image/ROI.


reference to the minimum value.
reference to the maximum value.
reference to the average value.

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

C++ Reference Manual 6.7.1

Parameters
pSrc0Image
pSrc1Image

pointer to the first source image/ROI.


pointer to the second source image/ROI.

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"

3.11 Noise Reduction


ImgRmsNoise
FLOAT32 ImgRmsNoise(EROIBW8* pSrcImage, EROIBW8* pRefImage, enum IMG_REFERENCE_NOISE
eReferenceNoise);
FLOAT32 ImgRmsNoise(EROIBW16* pSrcImage, EROIBW16* pRefImage, enum
IMG_REFERENCE_NOISE eReferenceNoise);
FLOAT32 ImgRmsNoise(EROIC24* pSrcImage, EROIC24* pRefImage, enum IMG_REFERENCE_NOISE
eReferenceNoise);

Computes the root-mean-square amplitude of noise, 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.
Parameters
pSrcImage
pRefImage
eReferenceNoise

pointer to the source image/ROI.


pointer to the reference image/ROI.
specifies how the reference image is affected by noise, as defined by
enum IMG_REFERENCE_NOISE.

FLOAT32 ImgRmsNoise(EROIBW8* pSrcImage, EROIBW16* pRefImage, UINT32 un32Count, enum


IMG_REFERENCE_NOISE eReferenceNoise);

Computes the root-mean-square amplitude of noise, 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"

168

pointer to the source image/ROI.


pointer to the reference image/ROI.
number of images summed to achieve noise reduction. Must be a power
of two.
specifies how the reference image is affected by noise, as defined by
enum IMG_REFERENCE_NOISE.

EasyImage: Image Processing

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

pointer to the source image/ROI.


pointer to the reference image/ROI.
specifies how the reference image is affected by noise, as defined by
enum IMG_REFERENCE_NOISE.

FLOAT32 ImgSignalNoiseRatio(EROIBW8* pSrcImage, EROIBW16* pRefImage, UINT32


un32Count, enum IMG_REFERENCE_NOISE eReferenceNoise= IMG_NOISE_NONE);

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

pointer to the source image/ROI.


pointer to the reference image/ROI.
number of images summed to achieve noise reduction. Must be a power
of two.
specifies how the reference image is affected by noise, as defined by
enum IMG_REFERENCE_NOISE.

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

pointer to the LUT vector holding the non-linear transfer function.


noise reduction factor. The larger the value, the more effectively noise will
be reduced.

169

C++ Reference Manual 6.7.1

f32Width

indicates the extent to which noise reduction applies to large variations in


gray-level values. For variations small with respect to this parameter,
noise will be reduced by a factor close to the Reduction value; for
variations much larger than Width, no noise reduction will take place.

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

pointer to the source image/ROI.


pointer to a 16 bits work image.
pointer to the destination image/ROI.
pointer to the LUT vector generated by a call to
ImgSetRecursiveAverageLUT.

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

EasyImage: Image Processing

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

Conversion to a black and white image (BW1)


void ImgConvert(EROIBW8* pSrcImage, EROIBW1* pDstImage);

Turns an 8 bit gray-level image into a black and white image.


Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI.

void ImgConvert(EROIBW16* pSrcImage, EROIBW1* pDstImage);

Turns a 16 bit gray-level image into a black and white image.


Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI.

void ImgConvert(EROIBW32* pSrcImage, EROIBW1* pDstImage);

Turns a 32 bit gray-level image into a black and white image.


Parameters
pSrcImage
pDstImage

pointer to the source image/ROI.


pointer to the destination image/ROI.

Conversion to a 8-bit gray-level image (BW8)


void ImgConvert(EROIBW1* pSrcImage, EROIBW8* pDstImage, UINT8
un8HighValue=UINT8_MAX);

Turns a black and white image into an 8 bit gray-level image.


Parameters
pSrcImage
pDstImage
un8HighValue

pointer to the source image/ROI.


pointer to the destination image/ROI.

void ImgConvert(EROIBW16* pSrcImage, EROIBW8* pDstImage, UINT32 un32RightShift=8);

171

C++ Reference Manual 6.7.1

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
Right shift amplitude. By default, left justified data is assumed.

void ImgConvert(EROIC24* pSrcImage, EROIBW8* pDstImage);


void ImgConvert(EROIC15* pSrcImage, EROIBW8* pDstImage);
void ImgConvert(EROIC16* pSrcImage, EROIBW8* pDstImage);

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

pointer to the source image/ROI.


pointer to the destination image/ROI.

Conversion to a 16-bit gray-level image (BW16)


void ImgConvert(EROIBW1* pSrcImage, EROIBW16* pDstImage, UINT16
un16HighValue=UINT16_MAX);

Turns a black and white image into a 16 bit gray-level image.


Parameters
pSrcImage
pDstImage
un16HighValue

pointer to the source image/ROI.


pointer to the destination image/ROI.

void ImgConvert(EROIBW8* pSrcImage, EROIBW16* pDstImage, UINT32 un32LeftShift=8);

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
Left shift amplitude. By default, left justified data is assumed.

Conversion to a 32-bit gray-level image (BW32)


void ImgConvert(EROIBW1* pSrcImage, EROIBW32* pDstImage, UINT32
un32HighValue=UINT32_MAX);

Turns a black and white image into a 32 bit gray-level image.

172

EasyImage: Image Processing

Parameters
pSrcImage
pDstImage
un32HighValue

pointer to the source image/ROI.


pointer to the destination image/ROI.

Conversion to color images


void ImgConvert(EROIBW8* pSrcImage, EROIC15* pDstImage);
void ImgConvert(EROIBW8* pSrcImage, EROIC16* pDstImage);
void ImgConvert(EROIBW8* pSrcImage, EROIC24* pDstImage);

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

pointer to the source image/ROI.


pointer to the destination image/ROI.

void ImgConvert(EROIC24* pSrcImage, EROIC15* pDstImage);


void ImgConvert(EROIC15* pSrcImage, EROIC24* pDstImage);
void ImgConvert(EROIC24* pSrcImage, EROIC16* pDstImage);
void ImgConvert(EROIC16* pSrcImage, EROIC24* 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

pointer to the source image/ROI.


pointer to the destination image/ROI.

void ImgConvert(EROIC24* pSrcImage, EROIC24A* pDstImage);


void ImgConvert(EROIC24A* pSrcImage, EROIC24* pDstImage);
void ImgConvert(EROIC24* pSrcImage, EROIBW8* pSrcAlpha, EROIC24A* pDstImage);
void ImgConvert(EROIC24A* pSrcImage, EROIC24* pDstImage, EROIBW8* pDstAlpha);

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

pointer to the source image/ROI.


pointer to the source alpha component (EBW8 Image/ROI).
pointer to the destination alpha component (EBW8 Image/ROI).
pointer to the destination image/ROI.

Declare using
#include "EImage.h"

173

C++ Reference Manual 6.7.1

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

pointer to the source image/ROI.


pointer to the destination image/ROI.

Declare using
#include "EImage.h"

3.13 Vector operations


ImgImageToLineSegment
void ImgImageToLineSegment(EROIBW8* pSrcImage, EBW8Vector* pPath, INT32 n32X0, INT32
n32Y0, INT32 n32X1, INT32 n32Y1);
void ImgImageToLineSegment(EROIBW16* pSrcImage, EBW16Vector* pPath, INT32 n32X0,
INT32 n32Y0, INT32 n32X1, INT32 n32Y1);
void ImgImageToLineSegment(EROIC24* pSrcImage, EC24Vector* pPath, INT32 n32X0, INT32
n32Y0, INT32 n32X1, INT32 n32Y1);

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

pointer to the source image/ROI.


pointer to the destination vector.
coordinates of the starting point of the segment
coordinates of the ending point of the segment

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

EasyImage: Image Processing


void ImgLineSegmentToImage(EROIC24* pDstImage, EC24 c24Pixel, INT32 n32X0, INT32
n32Y0, INT32 n32X1, INT32 n32Y1);
void ImgLineSegmentToImage(EROIC24* pDstImage, EC24Vector* pc24Path, INT32 n32X0,
INT32 n32Y0, INT32 n32X1, INT32 n32Y1);

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

pointer to the destination image/ROI.


constant gray-level value.
pointer to the source vector.
constant color value.
pointer to the source vector.
coordinates of the starting point of the segment
coordinates of the ending point of the segment

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

pointer to the source image/ROI.


pointer to the destination vector.

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

C++ Reference Manual 6.7.1

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

pointer to the source image/ROI.


pointer to the destination vector.

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

pointer to the source vector.


pointer to the destination vector.

Example
EBW8Vector Profile, Derivative;
// Derive
ImgProfileDerivative(&Profile, &Derivative);

Declare using
#include "EImage.h"

176

EasyImage: Image Processing

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

pointer to the source vector.


pointer to the destination vector.
threshold used for the minimum peaks.
threshold used for the maximum peaks.
minimum amplitude required for a peak to be kept (may be 0).
minimum area required for a peak to be kept (may be 0).

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

pointer to the source image/ROI.


pointer to the destination image/ROI. If NULL (the default value), this
operation is destructive (i.e. applied to the source image) and the default
value for un32HalfWidth (1) has to be used.

177

C++ Reference Manual 6.7.1

un32HalfWidth
un32HalfHeight

half of the kernel width (by default: un32HalfWidth = 1; 0 is allowed).


half of the kernel height (by default: same as un32HalfWidth; 0 is
allowed).

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);

Extracts the frame of given parity from an image.


Parameters
pSrcImage
pDstImage
bOdd

pointer to the source image/ROI.


pointer to the destination image/ROI. Must not be the same as the source
image.
specifies which frame is extracted (the frame made up of all lines of the
same parity as 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);

Replaces the frame of given parity in an image.


Parameters
pSrcImage
pDstImage
bOdd

178

pointer to the source image/ROI.


pointer to the destination image/ROI. Must not be the same as the source
image.
specifies which frame is replaced (the frame made up of all lines of the
same parity as bOdd).

EasyImage: Image Processing

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
specifies which frame remains unchanged (the frame made up of all lines
of the same parity as FixedRow; by default: un32FixedRow=0).

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

C++ Reference Manual 6.7.1


ImgRealignFrame(EROIBW8* pSrcImage, EROIBW8* pDstImage, INT32 n32Offset, UINT32
un32FixedRow= 0);
ImgRealignFrame(EROIBW16* pSrcImage, EROIBW16* pDstImage, INT32 n32Offset, UINT32
un32FixedRow= 0);
ImgRealignFrame(EROIC24* pSrcImage, EROIC24* pDstImage, INT32 n32Offset, UINT32
un32FixedRow= 0);

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
indicates the number of pixels by which to shift (positive to the right).
specifies wich frame remains unchanged (the frame made up of all lines
of the same parity as FixedRow; by default: un32FixedRow=0).

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

pointer to the source image/ROI.


index of the line used for comparison. Line FixedRow remains in place
and is compared with line (FixedRow+1), shifted by some amount.
minimum value of the allowed offset (positive to the right)
maximum value of the allowed offset (positive to the right)
estimated shift amplitude

EasyImage: Image Processing

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

pointer to the source image/ROI.


pointer to the destination image/ROI.

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

pointer to the source image/ROI.

Declare using
#include "EImage.h"

181

C++ Reference Manual 6.7.1

4.

ENUMERATION CONSTANTS

4.1

enum ARITH_LOGIC_OPERATIONS

Arithmetic and logical operations


IMG_COPY
IMG_INVERT *
IMG_ADD *
IMG_SUBTRACT *
IMG_MULTIPLY *
IMG_DIVIDE *
IMG_MODULO *
IMG_SHIFT_LEFT *
IMG_SHIFT_RIGHT *
IMG_SCALED_ADD *
IMG_SCALED_SUBTRACT *
IMG_SCALED_MULTIPLY *

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

EasyImage: Image Processing

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

the contour will be a 4-connected path.


the contour will be a 8-connected path.

enum CONTOUR_MODE

Contour tracing direction


IMG_CONTOUR_CLOCKWISE
IMG_CONTOUR_CLOCKWISE_CONTINUE_IF_BORDER

IMG_CONTOUR_CLOCKWISE_ALWAYS_CLOSED

IMG_CONTOUR_ANTICLOCKWISE
IMG_CONTOUR_ANTICLOCKWISE_CONTINUE_IF_BORDER
IMG_CONTOUR_ANTICLOCKWISE_ALWAYS_CLOSED

4.4

the contour is traversed clockwise.


contour traversal is restarted
counterclockwise when an image border is
met.
the contour is traversed clockwise and the
image border may be followed if necessary
to close the contour.
the contour is traversed counterclockwise.
contour traversal is restarted clockwise when
an image border is met.
the contour is traversed anticlockwise and
the image border may be followed if
necessary to close the contour.

enum CONTOUR_THRESHOLD

Contour tracing threshold mode


IMG_CONTOUR_ABOVE_THRESHOLD
IMG_CONTOUR_BELOW_THRESHOLD

4.5

traverse the pixels just above the threshold.


traverse the pixels just below the threshold.

enum IMG_HISTOGRAM_FEATURE

Histogram analysis options


IMG_MOST_FREQUENT_PIXEL_VALUE
IMG_MOST_FREQUENT_PIXEL_FREQUENCY
IMG_LEAST_FREQUENT_PIXEL_VALUE
IMG_LEAST_FREQUENT_PIXEL_FREQUENCY

value of the most frequent pixel.


frequency of the most frequent pixel.
value of the least frequent pixel.
frequency of the least frequent pixel.

183

C++ Reference Manual 6.7.1

IMG_SMALLEST_PIXEL_VALUE
IMG_GREATEST_PIXEL_VALUE
IMG_PIXEL_COUNT
IMG_AVERAGE_PIXEL_VALUE
IMG_PIXEL_VALUE_STD_DEV

4.6

smallest pixel value.


largest pixel value.
number of pixels.
mean of the pixel values.
standard deviation of the pixel values.

enum IMG_REFERENCE_NOISE

Signal to noise ratio


IMG_NOISE_NONE
IMG_NOISE_SAME_AS_IMAGE
IMG_NOISE_SAME_AS_IMAGE_INCLUSIVE

4.7

the reference image is free from noise (synthetic image


or noise source cancelled).
the reference image is contaminated by the same noise
source as the source image.
the reference image is contaminated by the same noise
source as the source image and the source image was
included in the sum (relevant only when integration of
several images was used).

enum IMG_THRESHOLD_MODES

Automatic threshold selection mode


IMG_ABSOLUTE_THRESHOLD

reserved value. For absolute thresholding, use the threshold


value itself, cast to enum IMG_THRESHOLD_MODES.

IMG_RELATIVE_THRESHOLD

relative threshold; determines the required threshold level so that


a given fraction of the image pixels lie below it.
selects a threshold value such that the quadratic difference
between the source and thresholded image is minimized.
selects a threshold value such that the entropy (i.e. the amount of
information) of the resulting thresholded image is maximized.
selects a threshold value that lies halfway between the average
dark gray value (i.e. gray levels below the threshold) and average
light gray values (i.e. gray levels above the 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.

EasyImage: Image Processing

4.9

enum KERNEL_ROTATION

Kernel rotation modes


NO_ROTATION
CLOCKWISE_ROTATION
ANTICLOCKWISE_ROTATION

no rotation of the structuring element.


clockwise rotation (one full turn per pass).
counterclockwise rotation (one full turn per pass).

4.10 enum KERNEL_TYPE


Predefined kernel types
E_WHITE_SKELET_KRNL
E_BLACK_SKELET_KRNL
E_EDGE_KRNL
E_SOBELX_KRNL
E_SOBELY_KRNL
E_PREWITX_KRNL
E_PREWITY_KRNL
E_LAPLACIAN4_KRNL
E_LAPLACIAN8_KRNL
E_LOWPASS1_KRNL
E_LOWPASS2_KRNL
E_LOWPASS3_KRNL
E_HIGHPASS1_KRNL
E_HIGHPASS2_KRNL

white skeleton morphological probe.


black skeleton morphological probe.
edge detection morphological probe.
X-axis Sobel derivative.
Y-axis Sobel derivative.
X-axis Prewitt derivative.
Y-axis Prewitt derivative.
4-connected Laplacian.
8-connected Laplacian.
low pass filter.
low pass filter (average of neighbors).
low pass filter (average).
high pass filter (value plus 4-connected Laplacian).
high pass filter (value plus 8-connected Laplacian).

185

C++ Reference Manual 6.7.1

5.

SAMPLE PROGRAMS
The available sample programs dedicated to the EasyImage library are the following:

ImgFilter: applies a few morphological or convolution filters (with a user-defined kernel).


Also shows how the menu items are handled in a windowed application.

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.

ImgShadingCorrection: performs a shading correction based on two reference vectors


built by means of a projection.

ImgStatistics: plots the histogram and computes statistical parameters over a region of
interest. Shows how colors can be used to plot graphs.

ImgThreshold: applies a threshold operation on an image and extracts the contour of a


blob.

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

EasyColor: Color Image Processing

EasyColor: Color Image Processing

1.

EASYCOLOR: INTRODUCTION

Visible color gamut in the XYZ color space.


EasyColor handles two different aspects of color imaging:

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);

EROIC24: region of interest mapped to an EImageC24 image;

EColorLookup: lookup table used to speed-up complex conversions;

EPseudoColorLookup: lookup table used for pseudo-coloring (assigning colors to gray-level


images);

189

C++ Reference Manual 6.7.1

The core function categories are:


Color Image Components Handling
Color Transformations
Quantized Color Conversions
Unquantized Color Conversions
Color Quantization/Dequantization
Color Image Transformation
Color Image Segmentation
Pseudo-coloring
Miscellaneous
Color System Variants
YUV Conversion

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;

the "intensity/saturation/hue" systems further describe the chromatic sensation in terms of


saturation and hue. These allow a more intuitive interpretation of colors and are very useful to
eliminate lighting effects.
Another way to class the color systems refers to the technical field involved:

190

the RGB components are mainly used for display purposes;

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.

EasyColor: Color Image Processing

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

ISH, LSH, VSH

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.

Quantized versus Continuous component values


Most of the time, the color coordinates used in the classical systems are described as continuous values,
often normalized to the [0..1] interval. Computations on such values, termed unquantized, are simpler. On
the other hand, the storage of images in frame buffer imposes to use a byte representation, corresponding
to discrete values in the [0..255] interval. Such values are termed quantized.
In principle, all image processing operations apply to the quantized representation; anyway, for
convenience, conversion operations between the various color systems can also be specified using
unquantized coordinates.

Color Image Processing


The color images not only contain three times more raw information than the gray-level ones, they also
allow richer processing. For instance, all three RGB components reflected by an object have amplitude
proportional to the intensity of the light source. By considering the ratio of two color components, one
obtains an illumination-independent image. With a clever combination of three pieces of information per
pixel, one can extract better features.
There are several ways to process a color image. These can be summarized as follows:

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.

Color Lookup Tables


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.

191

C++ Reference Manual 6.7.1

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

EasyColor: Color Image Processing

2.

CLASSES AND CLASS MEMBERS

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

C++ Reference Manual 6.7.1

2.1.2

EColorLookup Class Members

2.1.2.1

Construction

EColorLookup Construction
EColorLookup(UINT32 un32IndexBits= 5, BOOL bInterpolation= FALSE);

Constructs a color lookup table


Parameters
un32IndexBits
bInterpolation

2.1.2.2

Number of bits used for indexing the lookup table.


Interpolation mode.

Interpolation mode

EColorLookup::Get/SetInterpolation
BOOL GetInterpolation();

Returns the interpolation mode.


void SetInterpolation(BOOL bInterpolation);

Sets the interpolation mode.


Parameters
bInterpolation

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

EasyColor: Color Image Processing

Parameters
un32IndexBits

Number of bits used for indexing the lookup table.

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

Table size (bytes)

2(3x4) = 4096

14739

(3x5)

= 32768

107811

2(3x6) = 262144

823875

The larger the number of entries, the more accuracy is obtained.


Note. Be aware that each time a color lookup table is filled, all the entries are recomputed. When
IndexBits equals 6, this may take a very long time. Such large lookup tables should be computed once
only. Different combinations of IndexBits and Interpolation provide a trade-off between accuracy and
speed for the table pre-computation and table use. End of note.
After IndexBits has been changed, the lookup table needs to be recomputed.

2.1.2.4

Color systems

EColorLookup::GetColorSystemIn
enum E_COLOR_SYSTEM GetColorSystemIn();

Returns the input color system, as defined by enum E_COLOR_SYSTEM


Remarks
The EColorLookup objects keep track of the color system transformation, for consistency. When
applying a transformation, the source image color system (usually E_COLOR_SYSTEM_RGB) must
match the input color system; the destination image will be automatically be typed with the output color
system. In case of a mismatch, an error message is issued.
These two values are set by the lookup table initialization functions. An uninitialized lookup table has
both color systems set to E_COLOR_SYSTEM_NONE.
EColorLookup::GetColorSystemOut
enum E_COLOR_SYSTEM GetColorSystemOut();

Returns the output color system, as defined by enum E_COLOR_SYSTEM


Remarks
The EColorLookup objects keep track of the color system transformation, for consistency. When
applying a transformation, the source image color system (usually E_COLOR_SYSTEM_RGB) must
match the input color system; the destination image will be automatically be typed with the output color
system. In case of a mismatch, an error message is issued.
These two values are set by the lookup table initialization functions. An uninitialized lookup table has
both color systems set to E_COLOR_SYSTEM_NONE.

195

C++ Reference Manual 6.7.1

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

Target color system, as defined by enum E_COLOR_SYSTEM.


Gain to be applied to color component 0.
Offset to be applied to color component 0.
Gain to be applied to color component 1.
Offset to be applied to color component 1.
Gain to be applied to color component 2.
Offset to be applied to color component 2.

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);

Note. The offsets are specified as unquantized values. End of note.


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.

196

EasyColor: Color Image Processing

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

Color system, as defined by enum E_COLOR_SYSTEM.

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);

Sets a color transformation from the E_COLOR_SYSTEM_RGB representation to another system, as


defined by enum E_COLOR_SYSTEM. The input and output color systems are respectively
E_COLOR_SYSTEM_RGB and eColorSystem.
Parameters
eColorSystem

Color system, as defined by enum E_COLOR_SYSTEM.

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);

Sets a color transformation to recalibrate, using three reference colors.


Parameters
Color0
f32X0, f32Y0, f32Z0
Color1
f32X1, f32Y1, f32Z1
Color2
f32X2, f32Y2, f32Z2

Measured quantized values of a pixel of color 0.


CIE XYZ tristimulus unquantized values corresponding to color 0.
measured quantized values of a pixel of color 1.
CIE XYZ tristimulus unquantized values corresponding to color 1.
measured quantized values of a pixel of color 2.
CIE XYZ tristimulus unquantized values corresponding to color 2.

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);

Sets a color transformation to recalibrate, using four reference colors.

197

C++ Reference Manual 6.7.1

Parameters
Color0
f32X0, f32Y0, f32Z0
Color1
f32X1, f32Y1, f32Z1
Color2
f32X2, f32Y2, f32Z2
Color3
f33X3, f33Y3, f33Z3

Measured quantized values of a pixel of color 0.


CIE XYZ tristimulus unquantized values corresponding to color 0.
Measured quantized values of a pixel of color 1.
CIE XYZ tristimulus unquantized values corresponding to color 1.
Measured quantized values of a pixel of color 2.
CIE XYZ tristimulus unquantized values corresponding to color 2.
Measured quantized values of a pixel of color 3.
CIE XYZ tristimulus unquantized values corresponding to color 3.

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);

Sets an arbitrary user-defined transformation.


Parameters
Transform
eSystemIn
eSystemOut

function to express the transform to be applied to a source pixel, giving a


destination pixel; unquantized values are used.
input color system, as defined by enum E_COLOR_SYSTEM
output color system, as defined by enum E_COLOR_SYSTEM

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

global gain to be applied to all three color components. By default, the


image intensity remains unchanged.
gamma exponent. Setting this parameter will cancel the gamma precompensation feature of the camera, or apply it. By default, the no
gamma pre-compensation is assumed (linear response).
The gamma exponent can be chosen among the predefined values
CLR_COMPENSATE_ NTSC/PAL/SMPTE _GAMMA (pre-compensation)
or CLR_ NTSC/PAL/SMPTE _GAMMA (pre-compensation cancellation),
or be user-defined.

EasyColor: Color Image Processing

f32Balance Red/Green/Blue

color values to be used for white balance. These parameters should be


set to the measured average values of a white (or gray) pixels area,
allowing the white balance to adjust pre-component gains appropriately.
Use function ImgPixelAverage to obtain them. By default no white
balancing is performed.

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

color to be mapped on a black (value 0) pixel.


color to be mapped on a white (value 255) pixel.
color system in which interpolation takes place.
if the color system supports a hue component, indicates whether hue
wrap around must be applied.

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

C++ Reference Manual 6.7.1

3.

FUNCTIONS

3.1

Color Conversions

Quantized Color Conversions


These functions transform the color components (of a pixel) expressed in some color system to the
corresponding components in another system. The quantized color representation is used (also see
Unquantized 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);

Convert a quantized color from any system to RGB.


Parameters
In
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

EasyColor: Color Image Processing

Convert a quantized color from RGB to another system.


Parameters
In
Out

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"

Unquantized Color Conversions


These functions transform the color components (of a pixel) expressed in some color system to the
corresponding components in another system. The unquantized color representation is used (also see
Quantized Color Conversions).

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);

Convert an unquantized color from any system to RGB.


Parameters
In
Out

input color, as defined by the corresponding structure.


output color.
201

C++ Reference Manual 6.7.1

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);

Convert an unquantized color from RGB to another system.


Parameters
In
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

Color Quantization and Dequantization

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

EasyColor: Color Image Processing


void ClrQuantize(ELUV Src, EC24& Dst);
void ClrQuantize(ERGB Src, EC24& Dst);
void ClrQuantize(EVSH Src, EC24& Dst);
void ClrQuantize(EXYZ Src, EC24& Dst);
void ClrQuantize(EYIQ Src, EC24& Dst);
void ClrQuantize(EYSH Src, EC24& Dst);
void ClrQuantize(EYUV Src, EC24& Dst);

Convert an unquantized color of a given color system to a quantized color.


Parameters
Src
Dst

input unquantized color, as defined by the corresponding structure.


output quantized color.

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);

Convert a quantized value to a unquantized value of a given color system.


Parameters
Src
Dst

input quantized color.


output unquantized color, as defined by the corresponding structure.

203

C++ Reference Manual 6.7.1

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

Color Image Components

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

pointers to the three input gray level component images/ROIs.


pointer to the output color image/ROI.
pointer to the color lookup table, or NULL.

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

pointer to the input color image/ROI.


pointers to the three output gray level component images/ROIs.
pointer to the color lookup table, or NULL.

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

EasyColor: Color Image Processing

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

pointer to the input color image/ROI.


pointers to the output gray level component image/ROI.
color component index (0, 1, or 2).
pointer to the color lookup table, or NULL.

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

pointers to the input gray level component image/ROI.


pointer to the output color image/ROI.
color component index (0, 1, or 2).

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

pointers to the input image/ROI.


pointer to the output image/ROI.
horizontal shifting of the first plane (the red one in case of an RGB image),
expressed in pixels.

205

C++ Reference Manual 6.7.1

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

Color Image Transformation

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
pointer to the color lookup.

void ClrTransform(EROIC24* pSrcImage, EROIC24* pDstImage, void (*Transform)(EC24


SrcColor, EC24& DstColor), enum E_COLOR_SYSTEM eSystemIn= E_COLOR_SYSTEM_RGB, enum
E_COLOR_SYSTEM eSystemOut= E_COLOR_SYSTEM_RGB);

Applies to an image a user-defined quantized color transformation. No intermediate color lookup table
is used.
Parameters
pSrcImage
pDstImage
pLookup
eSystemIn
eSystemOut

pointer to the source image/ROI.


pointer to the destination image/ROI.
pointer to the color lookup.
input color system.
output color system.

void ClrTransform(EROIC24* pSrcImage, EROIC24* pDstImage, void (*Transform)(EColor


SrcColor, EColor& DstColor), enum E_COLOR_SYSTEM eSystemIn= E_COLOR_SYSTEM_RGB, enum
E_COLOR_SYSTEM eSystemOut= E_COLOR_SYSTEM_RGB);

Applies to an image a user-defined unquantized color transformation. No intermediate color lookup


table is used.

206

EasyColor: Color Image Processing

Parameters
pSrcImage
pDstImage
pLookup
eSystemIn
eSystemOut

pointer to the source image/ROI.


pointer to the destination image/ROI.
pointer to the color lookup.
input color system.
output color system.

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

pointer to the source gray-level image


pointer to the destination color image
pointer to the pseudo-color lookup table.

207

C++ Reference Manual 6.7.1

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

Color System Variants

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);

Sets the quantization mode for input values.


Parameters
eQuantization

Quantization mode, as defined by enum E_COLOR_QUANTIZATION.

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

RGB definition, as defined by enum E_RGB_STANDARD.

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

EasyColor: Color Image Processing

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);

Sets the quantization mode for output values.


Parameters
eQuantization

Quantization mode, as defined by enum E_COLOR_QUANTIZATION.

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);

Converts a YUV 4:2:2 image to a YUV 4:4:4 image using interpolation.


Parameters
pSrcImage
pDstImage
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);

Converts a YUV 4:4:4 image to a YUV 4:2:2 image using filtering


Parameters
pSrcImage
pDstImage
bYFirst

pointer to the input image/ROI.


pointer to the output image/ROI, stored using the 16 bits per pixel format.
flag indicating if the format is YUYVYUYV (TRUE) or UYVYUYVY (FALSE).

209

C++ Reference Manual 6.7.1

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

EasyColor: Color Image Processing

Bayer versus true color format


Declare using
#include "EColor.h"

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

pointer to the color input image/ROI.


pointer to the Bayer pattern output image/ROI, stored using the 8 bits per
pixel format.
TRUE if the leftmost destination image column cant contain blue pixels.
TRUE if the topmost destination image row cant contain red pixels.

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

C++ Reference Manual 6.7.1

Bayer versus true color format


Declare using
#include "EColor.h"

3.9

Color Image Segmentation

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

pointer to the source image/ROI.


pointer to the destination gray-level image/ROI.
pointer to the vector of the class centers.

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

EasyColor: Color Image Processing

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

pointer to the source image/ROI.


pointer to the destination image/ROI.
pointer to the vector of the class centers.

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

pointer to the source image/ROI.


pointer to the vector of the class centers.

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

C++ Reference Manual 6.7.1

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

pointer to the source image/ROI.


pointer to the vector of the class centers.
pointer to the vector of the average color values.

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

pointer to the source image/ROI.


pointer to the vector of the class centers.
pointer to the vector of the average color values.
pointer to the vector of the variance color values.

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

EasyColor: Color Image Processing

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.

Color mixture family


E_COLOR_SYSTEM_RGB
E_COLOR_SYSTEM_XYZ

NTSC/PAL/SMPTE Red, Green, Blue.


CIE XYZ.

Luma/chroma family
E_COLOR_SYSTEM_LAB
E_COLOR_SYSTEM_LUV
E_COLOR_SYSTEM_YUV
E_COLOR_SYSTEM_YIQ

CIE Lightness, a*, b*.


CIE Lightness, u*, v*.
CCIR Luma, U chroma, V chroma.
CCIR Luma, Inphase, Quadrature.

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

C++ Reference Manual 6.7.1

E_RGB_STANDARD_PAL

E_RGB_STANDARD_SMPTE

4.3

PAL primaries with the following CIE XYZ coordinates:


Red: (0.4303, 0.2219, 0.0202),
Green: (0.3416, 0.7068, 0.1296),
Blue: (0.1784, 0.0713, 0.9393)
SMPTE primaries with the following CIE XYZ coordinates:
Red: (0.393, 0.212, 0.019),
Green: (0.365, 0.701, 0.112),
Blue: (0.192, 0.087, 0.958)

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

EasyColor: Color Image Processing

5.

SAMPLE PROGRAMS
The available sample programs dedicated to the EasyColor library are the following:

ClrComponent: extracts a color component from an image, possibly converting to another


color system.

ClrSegment: performs color segmentation in three classes. A labeled blob analysis is


performed to display the results.

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

EasyObject: Blob Analysis

EasyObject: Blob Analysis

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

C++ Reference Manual 6.7.1

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

A feature is associated to an array of values, each corresponding to an object of given identification


number. A feature is also characterized by the size of the array, a feature number, data size/type
information and pointers to both ends of the array. The features can be accessed by their number (see
enum OBJECT_FEATURES).
To obtain the value of a given feature of a given object, just use the class member GetObjectFeature.

222

EasyObject: Blob Analysis

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

C++ Reference Manual 6.7.1

2.

CLASSES AND CLASS MEMBERS

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

ECodedImage Class members

2.1.2.1

Construction

ECodedImage: Construction
ECodedImage();

Constructs a void coded image.

2.1.2.2

Thresholding and segmentation

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

non zero if the black runs must be coded.

ECodedImage::Get/SetNeutralClass
INT16 GetNeutralClass();

Returns the neutral class index. Non zero when the neutral runs (between both thresholds) are coded.

224

EasyObject: Blob Analysis


void SetNeutralClass(INT16 n16NeutralClass= 2);

Assigns a class index to the neutral class (between both thresholds). 0 means "do not code this class".
2 by default.
Parameters
n16NeutralClass

non zero if the neutral runs must be coded.

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

non zero if the white runs must be coded.

ECodedImage::Get/SetHighThreshold
UINT32 GetHighThreshold();

Returns the value of the constant upper threshold (gray-level).


INT16 SetHighThreshold(UINT32 un32HighThreshold);

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();

Returns the value of the constant upper threshold (color).


void SetHighColorThreshold(EC24 c24HighThreshold);

Sets the value of the upper threshold used for image segmentation. The threshold value is constant
over the whole image.
Parameters
c24HighThreshold

threshold value (EC24).

ECodedImage::Get/SetHighImage
EGenericROI* GetHighImage();

Returns the pointer to the image used as an adaptive upper threshold, or NULL.

225

C++ Reference Manual 6.7.1


void SetHighImage(EBW8Image* pHighImage);

Sets the image used as an adaptive upper threshold. The threshold is adaptive, i.e. is specified pixel
by pixel.
Parameters
pHighImage

pointer to the image holding the threshold values.

ECodedImage::Get/SetLowThreshold
UINT32 GetLowThreshold();

Returns the value of the constant lower threshold (gray-level).


void SetLowThreshold(UINT32 un32LowThreshold);

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();

Returns the value of the constant lower threshold (color).


void SetLowColorThreshold(EC24 c24LowThreshold);

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

pointer to the image holding the threshold values.

ECodedImage::Get/SetConnexity
enum OBJECT_CONNEXITY GetConnexity();

Returns the connexity mode, as defined by enum OBJECT_CONNEXITY.

226

EasyObject: Blob Analysis


void SetConnexity(enum OBJECT_CONNEXITY eConnexity);

Sets the connexity mode, i.e. how neighboring pixels are considered to belong to the same objects.
Parameters
eConnexity

New connexity mode, as defined by enum OBJECT_CONNEXITY.

ECodedImage::Get/SetThreshold
UINT32 GetThreshold();

Returns the threshold mode as defined by enum IMG_THRESHOLD_MODES.


void SetThreshold(UINT32 un32Threshold= IMG_MIN_RESIDUE_THRESHOLD);

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

threshold mode, as defined by enum IMG_THRESHOLD_MODES.

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();

Returns the absolute threshold level when using a single threshold.


ECodedImage::SetThresholdImage
UINT32 SetThresholdImage(EROIBW8* pImage);

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

pointer to the image holding the threshold values.

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

C++ Reference Manual 6.7.1

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

pointer to the source image/ROI.

void ECodedImage::BuildObjects(EROIC24* 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

pointer to the source image/ROI.

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

pointer to the source image/ROI.

void BuildLabeledObjects(EROIBW16* 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

pointer to the source image/ROI.

EasyObject: Blob Analysis

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();

Returns the maximum number of objects to look for.


void SetMaxObjects(UINT32 un32Max);

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

maximum number of objects to look for.

Feature computation

ECodedImage::AnalyseObjects
void AnalyseObjects(INT16
n16Feature3 = NULL, INT16
n16Feature6 = NULL, INT16
n16Feature9 = NULL, INT16

n16Feature1 = NULL, INT16 n16Feature2 = NULL, INT16


n16Feature4 = NULL, INT16 n16Feature5 = NULL, INT16
n16Feature7 = NULL, INT16 n16Feature8 = NULL, INT16
n16Feature10 = NULL);

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);

Computes the minimum of the features of all currently selected objects.


Parameters
Feature
f32Minimum

feature code, as defined by enum OBJECT_FEATURES.


reference to the feature minimum.

229

C++ Reference Manual 6.7.1

ECodedImage::FeatureMaximum
void FeatureMaximum(enum OBJECT_FEATURES eFeature, FLOAT32& f32Maximum);

Computes the maximum of the features of all currently selected objects.


Parameters
Feature
f32Maximum

feature code, as defined by enum OBJECT_FEATURES.


reference to the feature maximum.

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

feature code, as defined by enum OBJECT_FEATURES.


reference to the feature average.

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

feature code, as defined by enum OBJECT_FEATURES.


reference to the feature average.
reference to the feature variance.

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

feature code, as defined by enum OBJECT_FEATURES.


reference to the feature average.
reference to the feature standard deviation.

ECodedImage::ObjectConvexHull
void ObjectConvexHull(EListItem* pObject, EPathVector* pDst);

Computes the convex hull of an object and stores it in a EPathVector.

230

EasyObject: Blob Analysis

Parameters
pListItem
EPathVector

pointer to the object list item.


vector containing the vertices coordinates of the convex hull.

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

angle of the skewed bounding box.

Object selection

ECodedImage::GetNumSelectedObjects
INT32 ECodedImage::GetNumSelectedObjects();

Returns the number of objects currently selected.


Remarks
After a call to the ECodedImage::BuildHoles function, the ECodedImage::GetNumSelectedObjects
function returns the total number of objects (i.e. real objects + holes).
ECodedImage::SetNumSelectedObjects
void SetNumSelectedObjects(INT32 n32NbSelectedObjects);

Sets the number of objects currently selected.


Parameters
n32NbSelectedObjects

new number value.

ECodedImage::IsObjectSelected
INT16 IsObjectSelected(INT32 n32ObjNum, BOOL& bSelected);

Sets bSelected to TRUE if an object is selected.


Parameters
n32ObjNum
bSelected

object identification number.


reference to the result.

INT16 IsObjectSelected(EListItem* pListItem, BOOL& bSelected);

Sets bSelected to TRUE if an object is selected.


Parameters
pListItem
bSelected

pointer to the object list item.


reference to the result.

231

C++ Reference Manual 6.7.1

ECodedImage::SelectAllObjects
void SelectAllObjects();

Selects all objects.


ECodedImage::SelectObject
void SelectObject(INT32 n32ObjNum);

Selects an object.
Parameters
n32ObjNum

object identification number.

void SelectObject(EListItem* pListItem);

Selects an object.
Parameters
pListItem

pointer to the object list item.

ECodedImage::UnselectAllObjects
void UnselectAllObjects();

Deselects all objects.


ECodedImage::UnselectObject
void UnselectObject(INT32 n32ObjNum);

Deselects an object.
Parameters
n32ObjNum

object identification number.

void UnselectObject(EListItem* pListItem);

Deselects an object.
Parameters
pListItem

pointer to the object list item.

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;

ElistItem *Object, NextObject;

232

EasyObject: Blob Analysis


for (Object = Blobs.GetFirstObjPtr(); Object != NULL; Object = NextObject)
{
NextObject = Blobs.GetNextObjPtr(Object);
Blobs.IsObjectSelected(Object, Selected);
If (Selected)
{

if (condition)
{
Blobs.UnselectObject(Object);

2.1.2.6

Selection and sorting

ECodedImage::SelectObjectsUsingFeature
void SelectObjectsUsingFeature(enum OBJECT_FEATURES Feature, Type Min, Type Max,
enum SELECT_OPTIONS Operation);

Selects or deselects objects according to the value of some feature.


Parameters
Feature
Min
Max
Operation

feature code, as defined by enum OBJECT_FEATURES.


selection interval lower bound.
selection interval upper bound.
selection mode, as defined by enum SELECT_OPTIONS.

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

abscissa of the upper left corner of the rectangle.


ordinate of the upper left corner of the rectangle.
rectangle width, in pixels.
rectangle height, in pixels.
selection mode, as defined by enum SELECT_BY_POSITION.
233

C++ Reference Manual 6.7.1

Example
CodedImage.SelectObjectsUsingPosition(100, 100, 200, 200, OBJ_INSERT_IN);
void SelectObjectsUsingPosition(EImage/ROI...* pROI, enum SELECT_OPTIONS Operation);

Selects or deselects objects, using a delimiting rectangle.


Parameters
pROI
Operation

pointer to an image/ROI whose position parameters will define the


selection rectangle.
selection mode, as defined by enum SELECT_BY_POSITION.

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);

Sorts objects according to the value of some feature.


Parameters
Feature
Operation

feature code, as defined by enum OBJECT_FEATURES.


selection mode, as defined by enum SORT_OPTIONS.

Example
CodedImage.SortObjectsUsingFeature(OBJ_PIXEL_MIN, OBJ_SORT_ASCENDING);

2.1.2.7

Drawing

ECodedImage::Get/Set DrawDiagonals
BOOL GetDrawDiagonals ();

Returns TRUE if the limit rectangle diagonals drawing is enabled.


void SetDrawDiagonals (BOOL bDrawDiagonals);

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

TRUE if the limit rectangle diagonals must be drawn.

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

EasyObject: Blob Analysis

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

handle of the device context on which to draw.


tells how the selected/unselected state of the objects is handled, as
defined by enum E_SELECTION_MODE.
horizontal zooming factor. By default, true scale is used.
vertical zooming factor. If set to 0, the default value, the horizontal
zooming factor is used instead, so as to provide isotropic zooming.
horizontal panning factor. By default, no panning occurs.
vertical panning factor. By default, no panning occurs.

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:

OBJ_GRAVITY_CENTER: upright cross

OBJ_CENTROID: skewed cross

OBJ_LIMIT: upright bounding rectangle with diagonals

OBJ_LIMIT45: skewed bounding rectangle with diagonals

OBJ_ELLIPSE: ellipse of inertia (edge and main axis)


If a required feature has not been computed for some object, nothing is drawn and no error message is
issued !
Parameters
hDC
eFeature

eSelectionMode
f32ZoomX
f32ZoomY
f32PanX
f32PanY

handle of the device context on which to draw.


feature to be drawn, as defined by enum OBJECT_FEATURES (use any
value matching the aforementioned features, f.i. OBJ_ELLIPSE_WIDTH
will draw the ellipse of inertia).
tells how the selected/unselected state of the objects is handled, as
defined by enum E_SELECTION_MODE.
horizontal zooming factor. By default, true scale is used.
vertical zooming factor. If set to 0, the default value, the horizontal
zooming factor is used instead, so as to provide isotropic zooming.
horizontal panning factor. By default, no panning occurs.
vertical panning factor. By default, no panning occurs.

235

C++ Reference Manual 6.7.1

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

handle of the device context on which to draw.


number of the object to be drawn.
pointer to the list item (from the objects list) corresponding to the object to
be drawn.
horizontal zooming factor. By default, true scale is used.
vertical zooming factor. If set to 0, the default value, the horizontal
zooming factor is used instead, so as to provide isotropic zooming.
horizontal panning factor. By default, no panning occurs.
vertical panning factor. By default, no panning occurs.

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

handle of the device context on which to draw.


feature to be drawn, as defined by enum OBJECT_FEATURES (use any
value matching the aforementioned features, f.i. OBJ_ELLIPSE_WIDTH
will draw the ellipse of inertia).
number of the object to be drawn.
pointer to the list item (from the objects list) corresponding to the object to
be drawn.
horizontal zooming factor. By default, true scale is used.
vertical zooming factor. If set to 0, the default value, the horizontal
zooming factor is used instead, so as to provide isotropic zooming.
horizontal panning factor. By default, no panning occurs.
vertical panning factor. By default, no panning occurs.

EasyObject: Blob Analysis

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

abscissa of the gravity center. (Float).


ordinate of the gravity center. (Float).
abscissa of the center of the bounding box. (Float).
ordinate of the center of the bounding box. (Float).
width of the bounding box (Ferret diameter 0). (Float).
height of the bounding box (Ferret diameter 90). (Float).
abscissa of the center of the 45 bounding box. (Float).
ordinate of the center of the 45 bounding box. (Float).
width of the center of the 45 bounding box (Ferret diameter 45). (Float).
height of the center of the 45 bounding box (Ferret diameter 135).
(Float).
abscissa of the center of the 22.5 bounding box. (Float).
ordinate of the center of the 22.5 bounding box. (Float).
width of the center of the 22.5 bounding box (Ferret diameter 45).
(Float).
height of the center of the 22.5 bounding box (Ferret diameter 112.5).
(Float).
abscissa of the center of the 67.5 bounding box. (Float).
ordinate of the center of the 67.5 bounding box. (Float).
width of the center of the 67.5 bounding box (Ferret diameter 67.5).
(Float).
height of the center of the 67.5 bounding box (Ferret diameter 157.5).
(Float).
abscissa of the Feret bounding box center. (Float).
ordinate of the Feret bounding box center. (Float).
width of the Feret bounding box. (Float).
height of the Feret bounding box. (Float).
direction of the Feret bounding box. (Float).
long axis of the ellipse of inertia. (Float).
short axis of the ellipse of inertia. (Float).
direction of the principal axis of inertia. (Float).
abscissa of the weighted gravity center. (Float).
ordinate of the weighted gravity center. (Float).

Object management

ECodedImage::GetCurrentObjData
void GetCurrentObjData(EObjectData* pObjData);

Returns the data of the current object.


Parameters
pObjData

pointer to an EObjectData struct to receive the data

237

C++ Reference Manual 6.7.1

ECodedImage::GetFirstObjData
void GetFirstObjData(EObjectData* pObject);

Moves the cursor to the first object and returns the associated data.
Parameters
pObject

pointer to an EObjectData struct to receive the data

ECodedImage::GetLastObjData
void GetLastObjData(EObjectData* pObject);

Moves the cursor to the last object and returns the associated data.
Parameters
pObject

pointer to an EObjectData struct to receive the data

ECodedImage::GetPreviousObjData
void GetPreviousObjData(EObjectData* pObject);

Moves the cursor to the previous object and returns the associated data.
Parameters
pObject

pointer to an EObjectData struct to receive the data.

ECodedImage::GetNextObjData
void GetNextObjData(EObjectData* pObject);

Moves the cursor to the next object and returns the associated data.
Parameters
pObject

pointer to an EObjectData struct to receive the data

ECodedImage::GetCurrentObjPtr
EListItem* GetCurrentObjPtr();

Returns a pointer to the current object list item, or NULL.


ECodedImage::GetFirstObjPtr
EListItem* GetFirstObjPtr();

Returns a pointer to the first object list item, or NULL.


ECodedImage::GetLastObjPtr
EListItem* GetLastObjPtr();

Returns a pointer to the last object list item, or NULL.

238

EasyObject: Blob Analysis

ECodedImage::GetPreviousObjPtr
EListItem* GetPreviousObjPtr(EListItem* pListItem);

Returns a pointer to the previous object list item, or NULL.


Parameters
pListItem

pointer to the current object list item.

ECodedImage::GetNextObjPtr
EListItem* GetNextObjPtr(EListItem* pListItem);

Returns a pointer to the next object list item, or NULL.


Parameters
pListItem

pointer to the current object list item.

ECodedImage::GetObjDataPtr
EObjectData* GetObjDataPtr(EListItem* pListItem);

Returns a pointer to the object data associated to an object list item. Also see GetCurrentObjData.
Parameters
pListItem

pointer to the current object list item.

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

pointer to an EObjectData struct to receive the data


object identification number

void GetObjectData(EObjectData* pObject, EListItem* pListItem);

Returns the object data associated to an object list item. Also see GetCurrentObjData.
Parameters
pObject
pListItem

pointer to an EObjectData struct to receive the object data


pointer to the current object list item.

ECodedImage::GetNumObjects
INT32 ECodedImage::GetNumObjects();

Returns the number of objects in the coded image.


Remarks
After a call to the ECodedImage::BuildHoles function, the ECodedImage::GetNumObjects function
returns the total number of objects (i.e. real objects + holes).
239

C++ Reference Manual 6.7.1

ECodedImage::GetObjPtr
EListItem* GetObjPtr(INT32 n32ObjNum);

Returns a pointer to the given object list item.


Parameters
n32ObjNum

object identification number.

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

absolute position in the object list, counting from 0 on.

ECodedImage::GetObjLastRunPtr
EListItem* GetObjLastRunPtr(EListItem* pListItem);

Returns a pointer to the last run list item of an object.


Parameters
pListItem

pointer to the object list item.

EListItem* GetObjLastRunPtr(INT32 n32ObjNum);

Returns a pointer to the last run list item of an object.


Parameters
n32ObjNum

object identification number.

ECodedImage::RemoveAllObjects
void RemoveAllObjects();

Deletes all objects from the objects list.


ECodedImage::RemoveObject
void RemoveObject(INT32 n32ObjNum);

240

EasyObject: Blob Analysis


void RemoveObject(EListItem* pListItem);

Deletes an object from the objects list.


Parameters
n32ObjNum
pListItem

2.1.2.9

object identification number.


pointer to the current object list item.

Hole construction

ECodedImage::BuildHoles
void ECodedImage::BuildHoles();

Creates holes related to all the previously selected real objects.


The newly created holes will be added to the list of the objects found in the image. If holes already
exist (resulting from a previous call to the ECodedImage::BuildHoles function), they will be removed
from the object list before the new hole building.
void ECodedImage::BuildHoles (EListItem* pObject);

Creates holes related only to the specified object.


The newly created holes will be added to the list of the objects found in the image. Previously created
holes are not removed before the new holes are built. If holes related to pObject have already been
constructed, they wont be recreated. If pObject is a hole or is NULL, no hole will be built.
Parameters
pObject

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.

2.1.2.10 Hole management


ECodedImage::IsHole
BOOL ECodedImage::IsHole(EListItem* pObject);

Returns TRUE if the specified object is a hole, FALSE otherwise.


Parameters
pObject

pointer to the object list item.

241

C++ Reference Manual 6.7.1

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);

Returns a pointer to the first hole related to the specified object.


Parameters
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

EasyObject: Blob Analysis

ECodedImage::GetHoleParentObject
EListItem* ECodedImage::GetHoleParentObject(EListItem* pHole);

Returns a pointer to the real object including the specified hole.


Parameters
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

C++ Reference Manual 6.7.1

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.

2.1.2.11 Run construction


ECodedImage::BuildRuns
void BuildRuns(EROIBW8* pSrcImage);

Converts a gray level image to white/neutral/black, using two thresholds, and extracts the runs from it.
Parameters
pSrcImage

pointer to the source image/ROI.

void BuildRuns(EROIC24* pSrcImage);

Converts a color image to white/black, using two color thresholds, and extracts the runs from it.
Parameters
pSrcImage

pointer to the source image/ROI.

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

EasyObject: Blob Analysis

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

pointer to the source image/ROI.

void BuildLabeledRuns(EROIBW16* 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

pointer to the source image/ROI.

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.

2.1.2.12 Run management


ECodedImage::GetCurrentRunData
void GetCurrentRunData(ERunData* pRun);

Returns the data of the current run.


pRun
pointer to a ERunData struct to receive the data
ECodedImage::GetFirstRunData
void GetFirstRunData(ERunData* pRun);

Moves the cursor to the first run and returns the associated data.
Parameters
pRun

pointer to a ERunData struct to receive the data

ECodedImage::GetLastRunData
void GetLastRunData(ERunData* pRun);

Moves the cursor to the last run and returns the associated data.
Parameters
pRun

pointer to a ERunData struct to receive the data

245

C++ Reference Manual 6.7.1

ECodedImage::GetPreviousRunData
void GetPreviousRunData(ERunData* pRun);

Moves the cursor to the previous run and returns the associated data.
Parameters
pRun

pointer to a ERunData struct to receive the data

ECodedImage::GetNextRunData
void GetNextRunData(ERunData* pRun);

Moves the cursor to the next run and returns the associated data.
Parameters
pRun

pointer to a ERunData struct to receive the data

ECodedImage::GetCurrentRunPtr
EListItem* GetCurrentRunPtr();

Returns a pointer to the current run list item, or NULL.


ECodedImage::GetFirstRunPtr
EListItem* GetFirstRunPtr();

Returns a pointer to the first run list item, or NULL.


ECodedImage::SetFirstRunPtr
INT16 SetFirstRunPtr(EListItem* pFirstRun, INT32 n32ObjNum);

Sets the first run list item of an object.


Parameters
n32ObjNum

object identification number.

INT16 SetFirstRunPtr(EListItem* pFirstRun, EListItem* pCurrentObject);

Sets the first run list item of an object.


Parameters
pListItem

pointer to the object list item.

ECodedImage::GetLastRunPtr
EListItem* GetLastRunPtr();

Returns a pointer to the last run list item, or NULL.

246

EasyObject: Blob Analysis

ECodedImage::SetLastRunPtr
INT16 SetLastRunPtr(EListItem* pFirstRun, INT32 n32ObjNum);

Sets the last run list item of an object.


Parameters
n32ObjNum

object identification number.

INT16 SetLastRunPtr(EListItem* pFirstRun, EListItem* pCurrentObject);

Sets the last run list item of an object.


Parameters
pListItem

pointer to the object list item.

ECodedImage::GetPreviousRunPtr
EListItem* GetPreviousRunPtr(EListItem* pListItem);

Returns a pointer to the previous run list item, or NULL.


Parameters
pListItem

pointer to the current run list item.

ECodedImage::GetNextRunPtr
EListItem* GetNextRunPtr(EListItem* pListItem);

Returns a pointer to the next run list item, or NULL.


Parameters
pListItem

pointer to the current run list item.

ECodedImage::GetRunDataPtr
ERunData* GetRunDataPtr(EListItem* pListItem);

Returns a pointer to the run data associated to a run list item. Also see GetCurrentRunData.
Parameters
pListItem

pointer to the current run list item.

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

pointer to a ERunData struct to receive the data


absolute position in the run list, counting from 0 on

247

C++ Reference Manual 6.7.1


void GetRunData(ERunData* pRun, EListItem* pListItem);

Returns the run data associated to a run list item. Also see GetCurrentRunData.
Parameters
pRun
pListItem

pointer to a ERunData struct to receive the run data.


pointer to the current run list item.

ECodedImage::GetNumRuns
INT32 ECodedImage::GetNumRuns();

Returns the total number of 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::GetNumHoleRuns
INT32 ECodedImage::GetNumHoleRuns();

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);

Returns a pointer to the first run list item of an object.


Parameters
n32ObjNum

object identification number.

EListItem* GetObjFirstRunPtr(EListItem* pListItem);

Returns a pointer to the first run list item of an object.


Parameters
pListItem

pointer to the object list item.

ECodedImage::GetNumObjectRuns
INT32 GetNumObjectRuns(INT32 n32ObjNum);

Returns the number of runs comprised in a given object.


Parameters
n32ObjNum

248

object identification number.

EasyObject: Blob Analysis


INT32 GetNumObjectRuns(EListItem* pListItem);

Returns the number of runs comprised in a given object.


Parameters
pListItem

pointer to an object list item.

ECodedImage::GetRunPtr
EListItem* GetRunPtr(INT32 n32Position);

Returns a pointer to the run list item of given absolute position, or NULL.
Parameters
n32Position

absolute position in the run list, counting from 0 on.

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();

Deletes all runs from the runs list.


ECodedImage::RemoveRun
void RemoveRun(INT32 n32Position);
void RemoveRun(EListItem* pListItem);

Deletes a run from the runs list.


Parameters
n32Position
pListItem

absolute position in the run list, counting from 0 on.


pointer to the current run list item.

2.1.2.13 Feature management


ECodedImage::GetObjectFeature
void GetObjectFeature(enum OBJECT_FEATURES eFeature, EListItem* pObject, Type&
Result);

Allows retrieving the value of a feature of a given object.

249

C++ Reference Manual 6.7.1

Parameters
eFeature
pObject
Result

feature number, as defined by enum OBJECT_FEATURES.


pointer to the list item (from the objects list) corresponding to the object.
reference to the feature value.

Remarks
Result can be of type INT8, INT16, INT32, FLOAT32 or FLOAT64.
INT16 GetObjectFeature(enum OBJECT_FEATURES eFeature, INT32 n32ObjNum, Type&
Result);

Allows retrieving the value of a feature of a given object.


Parameters
n32NumFeat
n32ObjNum
Result

feature number, as defined by enum OBJECT_FEATURES.


object number.
reference to the feature value.

Remarks
Result can be of type INT8, INT16, INT32, FLOAT32 or FLOAT64.
INT16 GetObjectFeature(EListItem* pCurrentFeature, INT32 n32ObjNum,Type& Result);

Allows retrieving the value of a feature of a given object.


Parameters
pCurrentFeature
n32ObjNum
Result

pointer to the feature list item.


object number.
reference to the feature value.

Remarks
Result can be of type INT8, INT16, INT32, FLOAT32 or FLOAT64.
ECodedImage::AddFeat
void AddFeat(EFeatureData* pFeat, INT32 n32NbObj);

Adds a feature to the list of features.


Parameters
pFeat
n32NbObj

pointer to a EFeatureData struct describing the feature.


number of objects for which the feature will be stored.

ECodedImage::BlankFeatures
void BlankFeatures();

Resets all values of all features.


ECodedImage::GetFeatArrayPtr
HPVoid GetFeatArrayPtr(INT32 n32Position);

250

EasyObject: Blob Analysis

Returns a pointer to the feature array for a feature at an absolute position.


Parameters
n32Position

absolute position in the features list, counting from 0 on.

HPVoid GetFeatArrayPtr(EListItem* pCurrentFeature);

Returns a pointer to the feature array for a given feature.


Parameters
pCurrentFeature

pointer to the feature list item.

ECodedImage::GetFeatDataPtr
EFeatureData* GetFeatDataPtr(EListItem* pCurrentFeature);

Returns a pointer to the EFeatureData struct associated to a given feature list item, or NULL.
Parameters
pCurrentFeature

pointer to the feature list item.

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

absolute position in the features list, counting from 0 on.


pointer to the list item (from the objects list) corresponding to the object to
be drawn.

NT32 GetFeatDataSize(EListItem* pCurrentFeature);

Returns the data size of a given feature, as defined by enum DATA_SIZE.


Parameters
pCurrentFeature

pointer to the feature list item.

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

absolute position in the features list, counting from 0 on.

INT32 GetFeatDataType(EListItem* pCurrentFeature);

Returns the data type of a given feature, as defined by enum DATA_TYPE.


Parameters
pCurrentFeature

pointer to the feature list item.

251

C++ Reference Manual 6.7.1

ECodedImage::GetFeatNum
INT32 GetFeatNum(INT32 n32Position);

Returns the code number of a feature at an absolute position, as defined by enum


OBJECT_FEATURES.
Parameters
n32Position

absolute position in the features list, counting from 0 on.

INT32 GetFeatNum(EListItem* pCurrentFeature);

Returns the code number of a given feature, as defined by enum OBJECT_FEATURES.


Parameters
pCurrentFeature

pointer to the feature list item.

ECodedImage::GetFeatPtrByNum
EListItem* GetFeatPtrByNum(INT32 n32NumFeat);

Returns a pointer to the feature list item for a given feature number, or NULL.
Parameters
n32NumFeat

feature number, as defined by enum OBJECT_FEATURES.

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

absolute position in the features list, counting from 0 on.

INT32 GetFeatSize(EListItem* pCurrentFeature);

Returns the size (number of elements) of the feature array for a given feature.
Parameters
pCurrentFeature

pointer to the feature list item.

ECodedImage::GetNumFeatures
INT32 GetNumFeatures();

Returns the number of features currently in use.


ECodedImage::RemoveAllFeats
void RemoveAllFeats();

Deletes all features from the features list.

252

EasyObject: Blob Analysis

ECodedImage::SetFeatInfo
void SetFeatInfo(EFeatureData* pFeature, INT16 n16Feature);

Sets the appropriate data size and type for a predefined feature.
Parameters
pFeat
n16Feature

pointer to a EFeatureData struct describing the feature.


feature code, as defined by enum OBJECT_FEATURES.

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

C++ Reference Manual 6.7.1

3.

FUNCTIONS

3.1

Features computation

ObjContourArea
void ObjContourArea(EPathVector* pPathVector, INT32& n32Area);

Computes the area of an object from its contour.


Parameters
pPathVector
n32Area

pointer to the source vector.


reference to the area to compute.

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

pointer to the source vector.


reference to the area to compute.
reference to the abscissa of the gravity center to compute.
reference to the ordinate of the gravity center to compute.

Declare using
#include "EObject.h"

ObjContourInertia
void ObjContourInertia(EPathVector* pPathVector, INT32& n32Area, FLOAT32&
f32GravityCenterX, FLOAT32& f32GravityCenterY, FLOAT32& f32SigmaX, FLOAT32&
f32SigmaY, FLOAT32& f32SigmaXY);

Computes the inertia parameters of an object from its contour.


Parameters
pPathVector
n32Area
f32GravityCenterX
f32GravityCenterY
f32SigmaX
f32SigmaY
f32SigmaXY
Declare using
#include "EObject.h"

254

pointer to the source vector.


reference to the area to compute.
reference to the abscissa of the gravity center to compute.
reference to the ordinate of the gravity center to compute.
Centered moment of inertia around X.
Centered moment of inertia around Y.
Centered cross moment of inertia.

EasyObject: Blob Analysis

4.

ENUMERATION CONSTANTS

4.1

enum OBJECT_CONNEXITY

Contour connexity
OBJ_CONNEXITY_4
OBJ_CONNEXITY_8

4.2

pixels touching by an edge are considered connected


pixels touching by an edge or a corner are considere connected

enum OBJECT_FEATURES

All the features are stored using E_32_BIT_DATA data length.


OBJ_OBJ_NUM
identification number.
OBJ_CLASS
class number.
OBJ_RUNS_NUMBER
number of runs.
OBJ_AREA
number of pixels. (Signed Integer).
OBJ_LARGEST_RUN
size of the longest run. (Signed Integer).
OBJ_GRAVITY_CENTER_X
abscissa of the gravity center. (Float).
OBJ_GRAVITY_CENTER_Y
ordinate of the gravity center. (Float).
OBJ_LIMIT_CENTER_X
abscissa of the center of the bounding box. (Float).
OBJ_LIMIT_CENTER_Y
ordinate of the center of the bounding box. (Float).
OBJ_LIMIT_WIDTH
width of the bounding box (Ferret diameter 0). (Float).
OBJ_LIMIT_HEIGHT
height of the bounding box (Ferret diameter 90). (Float).
OBJ_LIMIT45_CENTER_X
abscissa of the center of the 45 bounding box. (Float).
OBJ_LIMIT45_CENTER_Y
ordinate of the center of the 45 bounding box. (Float).
OBJ_LIMIT45_WIDTH
width of the 45 bounding box (Ferret diameter 45). (Float).
OBJ_LIMIT45_HEIGHT
height of the 45 bounding box (Ferret diameter 135). (Float).
OBJ_LIMIT22_CENTER_X
abscissa of the center of the 22.5 bounding box. (Float).
OBJ_LIMIT22_CENTER_Y
ordinate of the center of the 22.5 bounding box. (Float).
OBJ_LIMIT22_WIDTH
width of the 22.5 bounding box (Ferret diameter 22.5). (Float).
OBJ_LIMIT22_HEIGHT
height the 22.5 bounding box (Ferret diameter 112.5). (Float).
OBJ_LIMIT68_CENTER_X
abscissa of the center of the 67.5 bounding box. (Float).
OBJ_LIMIT68_CENTER_Y
ordinate of the center of the 67.5 bounding box. (Float).
OBJ_LIMIT68_WIDTH
width of the 67.5 bounding box (Ferret diameter 67.5). (Float).
OBJ_LIMIT68_HEIGHT
height of the 67.5 bounding box (Ferret diameter 157.5). (Float).
OBJ_LIMIT_ANGLED_CENTER_X
abscissa of the center of the bounding box having a skew angle
defined by the LimitAngle property. (Float).
OBJ_LIMIT_ANGLED _CENTER_Y ordinate of the center of the bounding box having a skew angle
defined by the LimitAngle property. (Float).
OBJ_LIMIT_ANGLED _WIDTH
width of the bounding box having a skew angle defined by the
LimitAngle property (Ferret diameter [LimitAngle]). (Float).
OBJ_LIMIT_ANGLED _HEIGHT
height of the bounding box having a skew angle defined by the
LimitAngle property (Ferret diameter [LimitAngle + 90]). (Float).
OBJ_FERET_CENTER_X
abscissa of the Feret bounding box center. (Float).

255

C++ Reference Manual 6.7.1

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

ordinate of the Feret bounding box center. (Float).


width of the Feret bounding box. (Float).
height of the Feret bounding box. (Float).
direction of the Feret bounding box. (Float).
starting point abscissa of the object contour. (Signed Integer).
starting point ordinate of the object contour. (Signed Integer).
minimum gray level of all pixels. (Signed Integer).
maximum gray level of all pixels. (Signed Integer).
centered moment of inertia around X (average squared Xdeviation). (Float).
centered moment of inertia around Y (average squared Ydeviation). (Float).
centered cross moment of inertia (average X-deviation times Ydeviation). (Float).
reduced, centered moment of inertia (around the principal inertia
axis). (Float).
reduced, centered moment of inertia (around the secondary inertia
axis). (Float).
long axis of the ellipse of inertia. (Float).
short axis of the ellipse of inertia. (Float).
direction of the principal axis of inertia. (Float).
abscissa of the weighted gravity center. (Float).
ordinate of the weighted gravity center. (Float).
average gray-level value of the object pixels. (Float).
variance of the gray-level value of the object pixels. (Float).

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

run of white pixels.


run of neutral pixels.
run of black pixels.

EasyObject: Blob Analysis

4.4

enum SELECT_OPTIONS

OBJ_INSERT_ALL
OBJ_INSERT_GREATER_OR_EQUAL
OBJ_INSERT_LESSER_OR_EQUAL
OBJ_INSERT_RANGE

add all objects.


add all objects with feature value above the upper threshold.
add all objects with feature value below the lower threshold.
add all objects with feature value between or equal to the
lower and upper thresholds.
OBJ_INSERT_OUT_OF_RANGE
add all objects with feature value above the upper and below
the lower threshold.
OBJ_REMOVE_ALL
delete all objects.
OBJ_REMOVE_GREATER_OR_EQUAL delete all objects with feature value above the lower
threshold.
OBJ_REMOVE_LESSER_OR_EQUAL
delete all objects with feature value below the upper
threshold.
OBJ_REMOVE_RANGE
delete all objects with feature value between or equal to the
lower and upper thresholds.
OBJ_REMOVE_OUT_OF_RANGE
delete all objects with feature value above the upper and
below the lower threshold.

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

insert those objects wholly inside the given rectangle


insert those objects with a non-empty intersection with the given rectangle
insert those objects wholly outside the given rectangle
remove those objects wholly inside the given rectangle
remove those objects with a non-empty intersection with the given
rectangle
remove those objects wholly outside the given rectangle
remove the objects touching the image border

enum SORT_OPTIONS

OBJ_SORT_ASCENDING
OBJ_SORT_DESCENDING

sort by increasing feature values.


sort by decreasing feature values.

257

C++ Reference Manual 6.7.1

5.

STRUCTURES

5.1

EFeatureData structure

The EFeatureData structure describes object features.


struct {
INT32 n32Size;
INT32 n32FeatNum;
INT32 n32FeatDataType;
INT32 n32FeatDataSize;
void* hpvStartPtr;
void* hpvEndPtr;
} EFeatureData;

Members
n32Size
n32FeatNum
n32FeatDataType
n32FeatDataSize
hpvStartPtr
hpvEndPtr

5.2

Number of objects for which the feature is stored.


Code (see enum OBJECT_FEATURES).
Data type (see enum DATA_TYPE).
Data size (see enum DATA_SIZE).
Reserved.
Reserved.

EObjectData structure

The EObjectData structure describes objects.


struct {
INT32 n32Class;
INT32 n32ObjNum;
INT32 n32ObjNbRun;
INT32 n32ObjNbHole;
UINT8 un8IsSelected;
void* hpvReserved1;
void* hpvReserved2;
BOOL bIsHole;
void* hpvParent;
void* hpvFirstHole;
void* hpvNextHole;
} EObjectData;

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.

EasyObject: Blob Analysis

hpvFirstHole
hpvNextHole

5.3

Pointer to the first hole.


Pointer to the hole that follows the "pPreviousHole" hole in the object hole
list.

ERunData structure

The ERunData structure describes runs.


struct {
INT32 n32OrgX;
INT32 n32OrgY;
INT32 n32Len;
INT32 n32Class;
INT32 n32ObjNum;
void* hpvReserved;
} ERunData;

Members
n32OrgX
n32OrgY
n32Len
n32Class
n32ObjNum
hpvReserved

5.4

Start point abscissa.


Start point ordinate.
Length.
Class.
Identification number of the object to which the run belongs.
Reserved.

EListItem structure

The EListItem structure describes general list items.

struct {
struct EListStruct* pPrev;
INT8* pn8Data;
struct EListStruct* pNext;
} EListItem;

Members
pPrev
pn8Data
pNext

Pointer to the previous item in the list.


Pointer to the data of this item.
Pointer to the next item in the list.

259

C++ Reference Manual 6.7.1

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

EasyGauge: Subpixel Measurement

EasyGauge: Subpixel Measurement

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:

EPointGauge: manages a complete point measurement context.


ELineGauge: manages a complete line measurement context.
ECircleGauge: manages a complete circle measurement context.
ERectangleGauge: manages a complete rectangle measurement context.
EWedgeGauge: manages a complete wedge measurement context.
EFrameShape: allows the grouping of several gauges or other frames.
According to the type of measurement to perform, create the corresponding 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).
Declare using
#include "EGauge.h"
#include "EInspect.h"

263

C++ Reference Manual 6.7.1

2.

CLASSES AND CLASS MEMBERS

2.1

E...Gauge Common Members

2.1.1

E Gauge overview [Common Members]

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

E... Gauge Common Class Members

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

EasyGauge: Subpixel Measurement

Parameters
pGauge
bRecursive

pointer to the EGauge object in which the current EGauge object


parameters have to be copied.
TRUE if the daughter gauges have to be copied as well, FALSE
otherwise.

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

EGauge object to be copied.

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:

a parent: an upper level object that contains the object to be copied;

children: sub-objects belonging to the object to be copied;

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:

it has the same parent as its model;

it is a sibling of its model and has the same internal parameters;

265

C++ Reference Manual 6.7.1

2.1.2.2

Gauge position

EGauge::Get/Set Center
EPoint GetCenter();

Returns the center coordinates of a point location or model fitting gauge.


void SetCenter(EPoint Point);
void SetCenter(FLOAT32 f32CenterX, FLOAT32 f32CenterY);

Sets the center coordinates of a point location or model fitting gauge.


Parameters
Point
f32CenterX/Y

center coordinates of a point location or model fitting gauge.


abscissa/ordinate of the center of a point location or model fitting gauge.

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);

Attach the gauge to a mother gauge or shape.


Parameters
pMother

pointer to the mother gauge or shape.

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();

Detach the gauge from its mother gauge or shape.


EGauge::DetachDaughters
void DetachDaughters();

Detach the daughter gauges or shapes.


EGauge::GetNumDaughters
UINT32 GetNumDaughters();

Returns the number of daughters attached to the gauge.

266

EasyGauge: Subpixel Measurement

EGauge::GetMother
EShape* GetMother();

Returns a pointer to the mother gauge or shape.


EGauge::GetDaughter
EShape* GetDaughter(UINT32 un32DaughterIndex);

Returns a pointer to the specified daughter gauge or shape.


Parameters
un32DaughterIndex

daughter gauge or shape index.

EGauge::GetShapeNamed
EShape* GetShapeNamed(const char* pszName);

Returns a pointer to a daughter gauge or shape specified by its name.


Parameters
pszName

2.1.2.4

name of the daughter gauge or shape.

Gauge behavior

EGauge::Get/Set Active
BOOL GetActive();

Returns the flag indicating whether the gauge is active or not.


void SetActive(BOOL bActive, BOOL bDaughters= FALSE);

Sets the flag indicating whether the gauge is active or not.


Parameters
bActive

flag indicating whether the gauge is active (TRUE) or not (FALSE).

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

C++ Reference Manual 6.7.1


void SetLabeled(BOOL bLabeled, BOOL bDaughters= FALSE);

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

flag indicating whether the gauge transition symbol should be displayed


(TRUE) or not (FALSE).
flag indicating whether the daughters shapes inherit of the same behavior.

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

flag indicating whether the gauge should be drawn quickly but


inaccurately (TRUE) or slowly but exactly (FALSE).
flag indicating whether the daughters shapes inherit of the same behavior.

Remarks
Get/Set QuickDraw is only relevant when perspective or optical distortion is handled.
By default, the gauges are quickly drawn (TRUE).

268

EasyGauge: Subpixel Measurement

2.1.2.5

Transition parameters

EGauge::Get/Set TransitionType
enum GGE_TRANSITION_TYPE GetTransitionType();

Returns the transition type, as defined by enum GGE_TRANSITION_TYPE.


void SetTransitionType(enum GGE_TRANSITION_TYPE eTransitionType);

Sets the transition type, as defined by enum GGE_TRANSITION_TYPE.


Parameters
eTransitionType

transition type, as defined by enum GGE_TRANSITION_TYPE.

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();

Returns the transition choice, as defined by enum GGE_TRANSITION_CHOICE.


void SetTransitionChoice(enum GGE_TRANSITION_CHOICE eTransitionChoice);

Sets the transition choice, as defined by enum GGE_TRANSITION_ CHOICE.


Parameters
eTransitionChoice

transition choice, as defined by enum GGE_TRANSITION_ CHOICE.

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

transition index. The default value is 0.

269

C++ Reference Manual 6.7.1

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();

Returns the MinAmplitude value.


void SetMinAmplitude (UINT32 un32MinAmplitude);

Sets the MinAmplitude value.


Parameters
un32MinAmplitude

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

EasyGauge: Subpixel Measurement

EGauge::Get/Set MinArea
UINT32 GetMinArea ();

Returns the minimum area value.


void SetMinArea(UINT32 un32MinArea);

Sets the minimum area value.


Parameters
un32MinArea

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

C++ Reference Manual 6.7.1

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

strength of the low pass filter. The default value is 1.

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);

Trigger the point location or the model fitting operation.


Parameters
pSrc

pointer to the source image.

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

pointer to the source image.


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.
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

EasyGauge: Subpixel Measurement

Parameters
pSrc
un32PathIndex

pointer to the source image/ROI.


sample path index.

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

by default, (FALSE value) all inquiries return a result pertaining to the


nominal gauge.
TRUE if the daughters shapes inherit of the same behavior.

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

distance between sampled points during a model fitting operation.

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

C++ Reference Manual 6.7.1


void SetFilteringThreshold(FLOAT32 f32FilteringThreshold);

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

status of the restriction on the orientation of the point location gauge or


model fitting sample paths. By default, (FALSE value) the orientation is
not horizontally or vertically constrained.

Remarks
We call "sample paths" the point location gauges placed along the model to be fitted.

274

EasyGauge: Subpixel Measurement

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

C++ Reference Manual 6.7.1

Parameters
start
end

beginning of the skip range.


end of the skip range.

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

index of the skip range.


beginning of the skip range.
end of the skip range.

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();

Removes all the skip ranges previously created by a call to EGauge::AddSkipRange.

276

EasyGauge: Subpixel Measurement

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

C++ Reference Manual 6.7.1

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

EasyGauge: Subpixel Measurement

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

index of the desired derivative peak (in case of a multiple transition


mode).

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

C++ Reference Manual 6.7.1


FLOAT32 Distance(ELine Line, BOOL bSegmentOnly= FALSE);

Returns the distance between the addressed point and a line.


FLOAT32 Distance(ECircle Circle, BOOL bArcOnly= FALSE);

Returns the distance between the addressed point and a circle.


FLOAT32 Distance(ERectangle Rectangle, BOOL bEdgesOnly= FALSE);

Returns the distance between the addressed point and a rectangle.


Parameters
bSegmentOnly

by default, FALSE value, the line is not restricted to a segment.

bArcOnly

by default, FALSE value, the circle is not restricted to an arc.

bEdgesOnly

by default, FALSE value, the rectangle is not restricted to its edges.

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);

// This sample code computes the distance


// between the center of two fitted circles.
ECircleGauge Circle1, Circle2;

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

handle of the device context on which to draw.


indicates how the point location or model fitting gauge must be displayed,
as defined by enum INS_DRAWING_MODES.
TRUE if the daughters gauges are to be displayed also.

EasyGauge: Subpixel Measurement

EGauge::SetCursor
void SetCursor(INT32 n32CursorX, INT32 n32CursorY);

Sets the cursor current coordinates.


Parameters
n32CursorX/Y

cursor current coordinates.

EGauge::HitTest
BOOL HitTest(BOOL bDaughters= TRUE);

Checks whether the cursor is positioned over a handle (TRUE) or not (FALSE).
Parameters
bDaughters

TRUE if the daughters gauges handles have to be considered as well.

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();

Returns a pointer to the shape currently under the cursor.


Remarks
When the cursor is over a particular shape, the cursor shape could be changed for feedback.
EGauge::Drag
void Drag(INT32 n32CursorX, INT32 n32CursorY);

Moves a handle to a new position and updates the position parameters of the gauge.
Parameters
n32CursorX/Y

cursor current coordinates.

EGauge::Plot
void Plot(HDC hDC, enum GGE_PLOT_ITEMS eDrawItems, FLOAT32 f32Width, FLOAT32
f32Height, FLOAT32 f32OrgX= 0.f, FLOAT32 f32OrgY= 0.f);

Draws the profile across a gauge as defined by enum GGE_PLOT_ITEMS.

281

C++ Reference Manual 6.7.1

Parameters
hDC
eDrawingItems
f32Width, f32Height
f32OrgX, f32OrgY

handle of the device context on which to draw.


indicates which items must be displayed, as defined by enum
GGE_PLOT_ITEMS.
width and height of the plot.
origin point coordinates of the plot.

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

EasyGauge: Subpixel Measurement

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();

Returns the dragging mode, as defined by enum INS_DRAGGING_MODES.


void SetDraggingMode(enum INS_DRAGGING_MODES eDraggingMode, BOOL bDaughters= FALSE);

Sets the dragging mode as defined by enum INS_DRAGGING_MODES.


Parameters
eDraggingMode
bDaughters

dragging mode, as defined by enum INS_DRAGGING_MODES.


flag indicating whether the daughters shapes inherit of the dragging mode.

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);

Saves the gauge parameters.


Parameters
pszPathName
bDaughters

full path and filename of the file.


flag indicating whether the possibly attached gauges have to be saved as
well, default value is 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);

Loads the gauge parameters.


Parameters
pszPathName
bDaughters

full path and filename of the file.


flag indicating whether the possibly attached gauges have to be loaded as
well, default value is FALSE.

283

C++ Reference Manual 6.7.1

2.1.2.10 Miscellaneous
EGauge::GetType
enum INS_SHAPE_TYPES GetType();

Returns the shape type as defined by enum INS_SHAPE_TYPES.

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.

Point location gauge

284

EasyGauge: Subpixel Measurement

S-shaped curve and its derivative


By carefully selecting an appropriate peak along the derivative profile, one can obtain an accurate
estimate of the edge position. To reduce the effect of noise, a local pre-filtering of the image values is
possible.
The parameters to be set can be grouped as follows:
Center: position of the center of the point location gauge;
Tolerance, ToleranceAngle: direction of the point location gauge;
Thickness, Smoothing: pre-filtering of the image data;
Threshold, MinAmplitude: peak detection thresholds;
TransitionType, TransitionChoice, TransitionIndex, MinArea: peak selection options.

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

EPointGauge Class Members

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

C++ Reference Manual 6.7.1

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();

Returns the half length of the point location gauge.


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.
EPointGauge::SetTolerance
void SetTolerance(FLOAT32 f32Tolerance, FLOAT32 f32Angle);

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();

Returns the rotation angle of the point location gauge.


286

EasyGauge: Subpixel Measurement

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

Line fitting gauge


287

C++ Reference Manual 6.7.1

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

ELineGauge Class Members

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

EasyGauge: Subpixel Measurement

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

line of known position (center coordinates), length and rotation angle.

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();

Returns the length of the line fitting gauge.


void SetLength(FLOAT32 f32Length);

Sets the length of the line fitting gauge.


Parameters
f32Length

length of the line fitting gauge. The default value is 100.

289

C++ Reference Manual 6.7.1

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();

Returns the origin point coordinates of the line fitting gauge.


Epoint GetEnd();

Returns the end point coordinates of the line fitting gauge.


ELineGauge::Get/Set Angle
FLOAT32 GetAngle();

Returns the rotation angle of the line fitting gauge.


void SetAngle(FLOAT32 f32Angle);

Sets the rotation angle of the line fitting gauge.


Parameters
f32Angle

rotation angle of the line fitting gauge. The default value is 0.

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

EasyGauge: Subpixel Measurement

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);

Sets the clipping mode.


Parameters
eClippingMode

clipping mode as defined by enum GGE_CLIPPING_MODE. The default


value is GGE_CLIPPING_CENTERED_NOMINAL.

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();

Provides a means to retrieve the information pertaining to the fitted line.

291

C++ Reference Manual 6.7.1

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

Circle fitting gauge


292

EasyGauge: Subpixel Measurement

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

ECircleGauge Class Members

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

C++ Reference Manual 6.7.1

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

circle of known position (center coordinates), diameter, angular origin and


amplitude.

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

EasyGauge: Subpixel Measurement

ECircleGauge::Get/Set Radius
FLOAT32 GetRadius();

Returns the radius of the circle fitting gauge.


void SetRadius(FLOAT32 f32Radius);

Sets the radius of the circle fitting gauge.


Parameters
f32Radius

radius of the circle fitting gauge. The default value is 50.

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();

Returns the diameter of the circle fitting gauge.


void SetDiameter(FLOAT32 f32Diameter);

Sets the diameter of the circle fitting gauge.


Parameters
f32Diameter

diameter of the circle fitting gauge. The default value is 100.

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();

Returns the circle arc length 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.

295

C++ Reference Manual 6.7.1

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

EasyGauge: Subpixel Measurement

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 origin point coordinates of the circle fitting gauge.


ECircleGauge::GetApex
Epoint GetApex();

Returns the apex point coordinates of the circle fitting gauge.


ECircleGauge::GetEnd
Epoint GetEnd();

Returns the end point coordinates of the circle fitting gauge.


ECircleGauge::GetFull
BOOL GetFull();

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

C++ Reference Manual 6.7.1

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);

Sets the inner filtering threshold.


Parameters
f32InnerFilteringThreshold

inner filtering threshold.

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

EasyGauge: Subpixel Measurement

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();

Provides a means to retrieve information pertaining to the fitted circle.


Example
// Perform a circle fitting
CircleGauge.Measure();
// Get the fitted circle center coordinates and radius
f32X= CircleGauge.GetMeasuredCircle().GetX();
f32Y= CircleGauge.GetMeasuredCircle ().GetY();
f32Radius= CircleGauge.GetMeasuredCircle().GetRadius();

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

C++ Reference Manual 6.7.1

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

Rectangle fitting gauge


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 rectangle fitting gauge;
Size: dimension of the rectangle fitting gauge;
Angle: orientation of the rectangle fitting gauge;
Tolerance, SamplingStep: spreading of the point location gauge along the model;
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 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

EasyGauge: Subpixel Measurement

2.5.2

ERectangleGauge Class Members

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)

Constructs a rectangle measurement context based on a pre-existing ERectangleGauge object. The


gauge children are copied according to the value of the global flag that can be set using
ESetRecursiveCopyBehavior.
Parameters
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

rectangle of known position (center coordinates), size and rotation angle.

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

C++ Reference Manual 6.7.1

Parameters
Center
f32SizeX, f32SizeY
f32Angle
Origin
End
Middle

center coordinates of the rectangle at its nominal position. The default


value is (0, 0).
nominal size X/Y of the rectangle. Both default values are 100.
nominal rotation angle of the rectangle. The default value is 0.
origin point coordinates of the rectangle.
end point coordinates of the rectangle.
middle point coordinates of the rectangle.

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);

Sets the size of the rectangle fitting gauge.


Parameters
f32SizeX, 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();

Returns the size X/Y of the rectangle fitting gauge.


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.
ERectangleGauge::GetMidEdges
void GetMidEdges(EPoint& Px, EPoint& PX, EPoint& Py, EPoint& PY);

Retrieves the center coordinates of each edge of the rectangle fitting gauge.
Parameters
Px
PX
Py
PY

302

center coordinates of the leftmost edge of the rectangle fitting gauge.


center coordinates of the rightmost edge of the rectangle fitting gauge.
center coordinates of the lower edge of the rectangle fitting gauge.
center coordinates of the upper edge of the rectangle fitting gauge.

EasyGauge: Subpixel Measurement

ERectangleGauge::GetCorners
void GetCorners(EPoint& Pxy, EPoint& PXy, EPoint& PxY, EPoint& PXY);

Retrieves the coordinates of each corner of the rectangle fitting gauge.


Parameters
Pxy
PXy
PxY
PXY

coordinates of the lower leftmost corner of the rectangle fitting gauge.


coordinates of the lower rightmost corner of the rectangle fitting gauge.
coordinates of the upper leftmost corner of the rectangle fitting gauge.
coordinates of the upper rightmost corner of the rectangle fitting gauge.

ERectangleGauge::GetEdges
void GetEdges(ELine& Ex, ELine& EX, ELine& Ey, ELine& EY);

Retrieves each edge of the rectangle fitting gauge.


Parameters
Ex
EX
Ey
EY

leftmost edge of the rectangle fitting gauge.


rightmost edge of the rectangle fitting gauge.
lower edge of the rectangle fitting gauge.
upper edge of the rectangle fitting gauge.

ERectangleGauge::Get/Set Angle
FLOAT32 GetAngle();

Returns the rotation angle of the rectangle fitting gauge.


void SetAngle(FLOAT32 f32Angle);

Sets the rotation angle of the rectangle fitting gauge.


Parameters
f32Angle

rotation angle of the rectangle fitting gauge. The default value is 0.

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

C++ Reference Manual 6.7.1


void SetTolerance(FLOAT32 f32Tolerance);

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();

Returns the active edges, as defined by enum INS_HANDLES.


void SetActiveEdges(UINT32 un32Edges);

Sets the active edges, as defined by enum INS_ HANDLES.


Parameters
un32Edges

active edges, as defined by enum INS_ HANDLES.

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

EasyGauge: Subpixel Measurement

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);

Sets the inner filtering threshold.


Parameters
f32InnerFilteringThreshold

inner filtering threshold.

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

C++ Reference Manual 6.7.1

2.5.2.5

Measurement Results

ERectangleGauge::GetMeasuredRectangle
ERectangle GetMeasuredRectangle();

Provides a means to retrieve information pertaining to the fitted rectangle.


Example
// Perform a rectangle fitting
RectangleGauge.Measure();
// Get the fitted rectangle center coordinates and radius
f32X= RectangleGauge.GetMeasuredRectangle().GetCenterX();
f32Y= RectangleGauge.GetMeasuredRectangle().GetCenterY();
f32Angle= RectangleGauge.GetMeasuredRectangle().GetAngle();
f32SizeX= RectangleGauge.GetMeasuredRectangle().GetSizeX();
f32SizeY= RectangleGauge.GetMeasuredRectangle().GetSizeY();

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

point location expressed as a fraction of the rectangle edges (range -1,


+1).

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

EasyGauge: Subpixel Measurement

Wedge fitting

Wedge fitting gauge


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 model;
Tolerance, SamplingStep: spreading of the point location gauges along the model;
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 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

EWedgeGauge Class Members

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

C++ Reference Manual 6.7.1

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

wedge of known position (center coordinates), diameter, breadth, angular


origin and amplitude.

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.

EasyGauge: Subpixel Measurement

f32Breadth
f32OrgAngle
f32Amplitude
Origin
End
Middle
bDirect

nominal breadth of the wedge. The default value is 50.


nominal angular origin of the wedge. The default value is 0.
nominal angular amplitude of the wedge. The default value is 360.
origin point coordinates of the wedge.
end point coordinates of the wedge.
middle point coordinates of the wedge.
TRUE (default value) means that angles increase anticlockwise in a direct
coordinate system and clockwise in an inverse coordinate system.
bFull
TRUE (default value) in case of a full turn wedge.
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 wedge 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.
EWedgeGauge::SetRadii
void SetRadius(FLOAT32 f32Radius, FLOAT32 f32Breadth);

Sets the nominal radius and breadth of the wedge fitting gauge.
Parameters
f32Radius
f32Breadth

radius of the wedge fitting gauge. The default value is 50.


breadth of the wedge fitting gauge. The default value is -50.

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

inner/outer diameter of the wedge fitting gauge (in case of a


positive/negative breadth value). The default value is 100.
breadth of the wedge fitting gauge. The default value is 50.

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

C++ Reference Manual 6.7.1

EWedgeGauge::Get Inner/Outer Radius


FLOAT32 GetInnerRadius();

Returns the inner radius of the wedge fitting gauge.


FLOAT32 GetOuterRadius();

Returns the outer radius 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::Get Inner/Outer Diameter
FLOAT32 GetInnerDiameter();

Returns the inner diameter of the wedge fitting gauge.


FLOAT32 GetOuterDiameter();

Returns the outer diameter 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::GetBreadth
FLOAT32 GetBreadth();

Returns the breadth 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::Get Inner/Outer ArcLength
FLOAT32 GetInnerArcLength();

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

EasyGauge: Subpixel Measurement

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

C++ Reference Manual 6.7.1

EWedgeGauge::GetEndAngle
FLOAT32 GetEndAngle();

Returns the ending angular position 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.
EWedgeGauge::GetAmplitude
FLOAT32 GetAmplitude();

Returns the angular amplitude 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.
EWedgeGauge::Get Inner/Outer Org
EPoint GetInnerOrg();

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

EasyGauge: Subpixel Measurement

EWedgeGauge::Get Inner/Outer End


EPoint GetInnerEnd();

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

center coordinates of the origin edge of the wedge fitting gauge.


center coordinates of the end edge of the wedge fitting gauge.
center coordinates of the inner edge of the wedge fitting gauge.
center coordinates of the outer edge of the wedge fitting gauge.

EWedgeGauge::GetCorners
void GetCorners(EPoint& Par, EPoint& PAr, EPoint& PaR, EPoint& PAR);

Retrieves the coordinates of each corner of the wedge fitting gauge.


Parameters
Par
PAr
PaR
PAR

coordinates of the inner origin corner of the wedge fitting gauge.


coordinates of the inner end corner of the wedge fitting gauge.
coordinates of the outer origin corner of the wedge fitting gauge.
coordinates of the outer end corner of the wedge fitting gauge.

313

C++ Reference Manual 6.7.1

EWedgeGauge::GetEdges
void GetEdges(ELine& Ea, ELine& EA, ECircle& Er, ECircle& ER);

Retrieves each edge of the wedge fitting gauge.


Parameters
Ea
EA
Er
ER

origin edge of the wedge fitting gauge.


end edge of the wedge fitting gauge.
inner edge of the wedge fitting gauge.
outer edge of the wedge fitting gauge.

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();

Returns the active edges, as defined by enum INS_HANDLES.


void SetActivesEdges(UINT32 un32Edges);

Sets the active edges, as defined by enum INS_ HANDLES.


Parameters
un32Edges

active edges, as defined by enum INS_ HANDLES.

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

EasyGauge: Subpixel Measurement

2.6.2.4

Measurement Results

EWedgeGauge::GetMeasuredWedge
EWedge GetMeasuredWedge();

Provides a means to retrieve information pertaining to the fitted wedge.


Example
// Perform a wedge fitting
WedgeGauge.Measure();
// Get the fitted wedge center coordinates and inner radius
f32CenterX= WedgeGauge.GetMeasuredWedge().GetCenterX();
f32CenterY= WedgeGauge.GetMeasuredWedge().GetCenterY();
f32InnerRadius= WedgeGauge.GetMeasuredWedge().GetInnerRadius();

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

C++ Reference Manual 6.7.1

Declare using
#include "EInspect.h"

2.7.2

EFrameShape Class Members

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);

Sets the origin point coordinates and orientation of the frame.


Parameters
Center
f32Angle

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);

Sets the origin point coordinates of the frame.


Parameters
Center
f32CenterX/Y

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.

EasyGauge: Subpixel Measurement

EFrameShape::SetAngle
void SetAngle(FLOAT32 f32Angle);

Sets the orientation of the frame.


Parameters
f32Angle

rotation angle of the frame. The default value is 0.

EFrameShape::SetSize
void SetSize(FLOAT32 f32SizeX, FLOAT32 f32SizeY= 0);

Sets the frame size.


Parameters
f32SizeX
f32SizeY

frame X-axis length. The default value is 100.


frame Y-axis length. By default, both axes have the same length.

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();

Returns the frame X/Y-axis length.


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.

2.7.2.3

Frame grouping

EFrameShape::Attach
void Attach(EShape* pMother);

Attach the shape to a mother shape.


Parameters
PMother

pointer to the mother shape.

EFrameShape::Detach
void Detach();

Detach the shape from its mother shape.

317

C++ Reference Manual 6.7.1

EFrameShape::DetachDaughters
void DetachDaughters();

Detach the daughter shapes.


EFrameShape::GetMother
EShape* GetMother();

Returns a pointer to the mother shape.


EFrameShape::GetNumDaughters
UINT32 GetNumDaughters();

Returns the number of daughters attached to the shape.


EFrameShape::GetDaughter
EShape* GetDaughter(UINT32 un32DaughterIndex);

Returns a pointer to the specified daughter shape.


Parameters
un32DaughterIndex

2.7.2.4

daughter shape index.

Graphical interaction

EFrameShape::Draw
void draw(HDC hDC, enum INS_DRAWING_MODES eDrawingMode= INS_DRAW_NOMINAL, BOOL
bDaughters= FALSE);

Draws a graphical representation of a shape as defined by enum INS_DRAWING_MODES.


Parameters
HDC
eDrawingMode
bDaughters

handle of the device context on which to draw.


indicates how the shape must be displayed, as defined by enum
INS_DRAWING_MODES.
TRUE if the daughter shapes are to be displayed also.

EFrameShape::HitTest
BOOL HitTest(BOOL bDaughters= TRUE);

Checks whether the cursor is positioned over a handle (TRUE) or not (FALSE).
Parameters
BDaughters

318

TRUE if the daughters shapes handles have to be considered as well.

EasyGauge: Subpixel Measurement

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

current cursor coordinates.

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

C++ Reference Manual 6.7.1

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

Nth transition from the beginning (counting from 0).


Nth transition from the end (counting from 0).
transition which peak has the largest amplitude value.
transition which peak has the largest area value.
transition closest to the center.
all transitions.

enum GGE_CLIPPING_MODE

Clipping mode
GGE_CLIPPING_CENTERED_NOMINAL
GGE_CLIPPING_CLIPPED_TO_VALID_SAMPLES

GGE_CLIPPING_CLIPPED_IN_NOMINAL_SHAPE

320

regular mode: the fitted segment always has the


nominal length of the line gauge.
the fitted segment does not extend beyond valid
samples. It is clipped to the projection of the valid
samples on the fitted line.
the segment is built by clipping the fitted line in the
rectangular range where the ELineGauge looks for
valid transition samples ,i.e. the rectangle which is
centered and aligned on the ELineGauge nominal
line, and which height is two times the gauge
tolerance (provided by the
ELineGauge::GetTolerance method).

EasyGauge: Subpixel Measurement

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

defines a point location gauge.


defines a line fitting gauge.
defines a circle fitting gauge.
defines a rectangle fitting gauge.
defines a wedge fitting gauge.
defines a frame shape.

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

Draws the sampled segments along the model.


Draws the sampled segment specified by
Draws the sampled points along the model.
Draws the sampled point specified by MeasureSample.
Draws the skipped sampled points in addition to the
Draws the invalid sampled points along the model.

enum GGE_PLOT_ITEMS

GGE_PLOT_TRANSITIONS
GGE_PLOT_PEAKS
GGE_PLOT_THRESHOLDS
GGE_PLOT_POINTS

3.7

Draws the nominal point location or model fitting gauge.


Draws the located point or the fitted model.

Displays the profile along a point location gauge.


Displays the corresponding derivative curve.
Displays the threshold and minimum amplitude levels.
Displays the valid transitions.

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

C++ Reference Manual 6.7.1

INS_HANDLE_TOL_0
INS_HANDLE_TOL_1

First tolerance handle.


Second tolerance handle.

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

Rectangle leftmost first tolerance handle.


Rectangle leftmost second tolerance handle.
Rectangle lower first tolerance handle.
Rectangle lower second tolerance handle.
Rectangle rightmost first tolerance handle.
Rectangle rightmost second tolerance handle.
Rectangle upper first tolerance handle.
Rectangle upper second tolerance handle.
Rectangle leftmost edge handle.
Rectangle rightmost edge handle.
Rectangle lower edge handle.
Rectangle upper edge handle.

322

EasyGauge: Subpixel Measurement

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

Wedge leftmost first tolerance handle.


Wedge leftmost second tolerance handle.
Wedge rightmost first tolerance handle.
Wedge rightmost second tolerance handle.
Wedge inner first tolerance handle.
Wedge inner second tolerance handle.
Wedge outer first tolerance handle.
Wedge outer second tolerance handle.
Wedge leftmost edge handle.
Wedge rightmost edge handle.
Wedge inner edge handle.
Wedge outer edge handle.

323

C++ Reference Manual 6.7.1

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

identifies a visible shape


identifies a selected shape
identifies a selectable shape
identifies a dragable shape
identifies a rotatable shape
identifies a resizable shape
identifies a labeled shape
identifies an active shape
identifies a non defective shape

enum INS_DRAGGING_MODES

Shapes dragging mode


INS_DRAG_STANDARD
INS_DRAG_TO_EDGES

324

allows positioning the shape edges symmetrically.


allows positioning each shape edge individually.

EasyGauge: Subpixel Measurement

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

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 character isolation

After recognition

329

C++ Reference Manual 6.7.1

The recognition process is achieved by means of the following calls:


1. Load reads a pre-recorded font from a disk file;
2. BuildObjects segments the image to locate the characters;
3. FindAllChars selects the objects considered as characters and sorts them from left to right;
4. ReadText performs the matching.
Steps 2 to 4 can be repeated at will to process other images or ROIs.
If additional information, such as the geometric position of the detected characters, is required, some
query functions may be used: CharGetOrgX, CharGetOrgY, CharGetWidth, CharGetHeight,

Recognition parameters
The recognition process is governed by a few parameters that need to be fine tuned to obtain the most
reliable results.

330

The following two parameters are used during segmentation:


- TextColor: black text on a white background, or conversely, with or without thresholding;
- Threshold: threshold value used to separate the text from the background. The threshold value
should be chosen such that the characters are well separated.

The following geometric parameters are used during character isolation:


- RemoveBorder: most of the time, blobs that are found along the image/ROI edges are
spurious and cannot be exploited for character recognition. By default they are discarded for
character isolation;
- NoiseArea: if a blob has an area smaller than this value, it is considered as noise and
discarded. The NoiseArea should be chosen such that the noise blobs are discarded but
small character features are preserved (f.i., the dot over an "i" letter);
- MaxWidth, MaxHeight: if a blob does not fit within a rectangle with these dimensions, it is not
considered as a possible character (too large) and is discarded. Furthermore, if several blobs
fit in a rectangle with these dimensions, they are grouped together, forming a single character.
The outer rectangle size should be chosen such that it can contain the largest character from
the font, enlarged by a small safety margin;
- MinWidth, MinHeight: if a blob or a group of blobs does fit in a rectangle with these
dimensions, it is not considered as a possible character (too small) and is discarded. The
inner rectangle size should be chosen such that it is contained in the smallest character from
the font, shrunk by a small safety margin;
- RemoveNarrowOrFlat: by default, small characters are discarded when they both narrow and
flat. This behavior can be changed so that they are discarded when either condition is met.
- Spacing: if to blobs are separated by a vertical gap wider than this value, they are considered
to belong to different characters. This feature is useful to avoid the grouping of thin characters
that would fit in the outer rectangle. Its value should be set to the width of the smallest gap
between adjacent letters. If it is set to a large value (larger than MaxWidth), it has no effect.
- CutLargeChars: when a blob or grouping of blobs is larger than the maximum allowed width, it
is considered as clutter and discarded. When the CutLargeChars mode is enabled, the blob is
split in as many parts as necessary to fit. This is an attempt to separate touching characters;
- RelativeSpacing: when the CutLargeChars mode is enabled, setting this value allows
specifying the amount of white space that should be inserted between the split parts of the
blobs;

EasyOCR: Printed Character Recognition

Example of invalid parameter settings

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_KEEP_OBJECTS: in this mode, a character is made up of a single blob; no attempt is


made to group blobs corresponding to damaged characters. For this reason, non connected
characters cannot be handled. Small features such as accents and dots will be discarded by
the inner rectangle criterion.

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

C++ Reference Manual 6.7.1

The learning process is achieved by means of the following calls:


1. NewFont clears the current font;
2. LearnPattern or LearnPatterns add the patterns from the source image to the font. Pattern or
ordered by their index value, as assigned by the FindAllChars process.
3. Possibly, an erroneously learnt pattern might be removed from the font using RemovePattern
4. SaveFont writes the contents of the font to a disk file.
Note. The characters used through the learning phase should be as representative of those to be read as
possible. Futhermore, the segmentation parameters (color, spacing,) MUST be the same for both
learning and recognition process. End of note.
Declare using
#include "EOCR.h"

332

EasyOCR: Printed Character Recognition

2.

CLASSES AND CLASS MEMBERS

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

EOCR Class Members

2.1.2.1

Construction

EOCR Construction
EOCR();

Constructs an OCR context.

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

new spacing value.

Remark
The segmentation parameters MUST be the same for both learning and recognition process.

333

C++ Reference Manual 6.7.1

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

new height value.

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

new width value.

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

new height value.

Remark
The segmentation parameters MUST be the same for both learning and recognition process.

334

EasyOCR: Printed Character Recognition

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

new width value.

Remark
The segmentation parameters MUST be the same for both learning and recognition process.
EOCR::Get/SetRemoveNarrowOrFlat
BOOL GetRemoveNarrowOrFlat();

Returns the current status of the RemoveNarrowOrFlat parameter.


void SetRemoveNarrowOrFlat(BOOL bRemoveNarrowOrFlat);

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

new option value.

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

new area value.

Remark
The segmentation parameters MUST be the same for both learning and recognition process.

335

C++ Reference Manual 6.7.1

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

new rating option value.

EOCR::Get/SetSegmentationMode
enum OCRSegmentationMode GetSegmentationMode();

Returns the segmentation mode, as defined by enum OCRSegmentationMode.


INT16 SetSegmentationMode(enum OCRSegmentationMode eMode);

Sets the segmentation mode, as defined by enum OCRSegmentationMode.


Parameters
eMode

new segmentation mode.

Remark
The segmentation parameters MUST be the same for both learning and recognition process.
EOCR::Get/SetCutLargeChars
BOOL GetCutLargeChars();

Returns TRUE when the large chars cutting mode is used.


void SetCutLargeChars(BOOL bCutLargeChars);

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

new cutting option value.

Remark
The segmentation parameters MUST be the same for both learning and recognition process.
EOCR::Get/SetRelativeSpacing
FLOAT32 GetRelativeSpacing();

Returns the relative spacing value.

336

EasyOCR: Printed Character Recognition


void SetRelativeSpacing(FLOAT32 f32RelativeSpacing);

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

new relative spacing value.

Remark
The segmentation parameters MUST be the same for both learning and recognition process.
EOCR::Get/SetRemoveBorder
BOOL GetRemoveBorder();

Returns TRUE when the RemoveBorder mode is used.


void SetRemoveBorder(BOOL bRemoveBorder);

Sets the RemoveBorder mode. When TRUE, all blobs touching the ROI edges are automatically
discarded. By default, this feature is turned on.
Parameters
bRemoveBorder

new RemoveBorder mode value.

Remark
The segmentation parameters MUST be the same for both learning and recognition process.
EOCR::Get/SetTextColor
enum OCRColor GetTextColor( );

Returns the text color, as defined by enum OCRColor.


void SetTextColor(enum OCRColor eTextColor);

Sets the text color, as defined by enum OCRColor.


Parameters
eTextColor

new text color.

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

C++ Reference Manual 6.7.1


void SetThreshold(INT32 un32Threshold= IMG_MIN_RESIDUE_THRESHOLD);

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

new threshold mode, as defined by enum IMG_THRESHOLD_MODES.

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();

Returns the matching mode used to compare characters to the template.


void SetMatchingMode(OCR_MATCHING_MODES eMatchingMode);

Sets the matching mode to use to compare characters to the template. By default, the root-meansquare error method is used.
Parameters
eMatchingMode

new matching mode as defined by enum OCR_MATCHING_MODES.

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

horizontal translation tolerance.

EasyOCR: Printed Character Recognition

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

vertical translation tolerance.

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();

Returns the shifting mode used to compare characters to the template.


void SetShiftingMode(OCR_SHIFTING_MODES eShiftingMode);

Sets the shifting mode to use to compare characters to the template.


Parameters
eShiftingMode

2.1.2.3

new shifting mode as defined by enum OCR_SHIFTING_MODES.

Recognition

EOCR::EmptyChars
void EmptyChars ();

Empties the list of known characters. See member AddChar.


EOCR::AddChar
void AddChar (INT32 n32OrgX, INT32 n32OrgY, INT32 n32EndX, INT32 n32EndY);

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

C++ Reference Manual 6.7.1

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

horizontal position of the top left corner of the character.


vertical position of the top left corner of the character.
horizontal position of the bottom right corner of the character.
vertical position of the bottom right corner of the character.

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

pointer to the source image/ROI.

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

pointer to the source image/ROI.

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

pointer to the source image/ROI.


logical mask obtained by combining the values of enum OCRClasses, to
specify to what classes the character may belong.
character number (in range 0..GetNumChars()-1).
horizontal translation applied to the character.
vertical translation applied to the character.

EOCR::ReadText
INT16 ReadText(EROIBW8* pSrcImage, INT32 n32MaxChars, UINT32 un32Classes, CHAR*
pszString, BOOL bAutoSegmentation= TRUE);

340

EasyOCR: Printed Character Recognition


INT16 ReadText(EROIBW8* pSrcImage, INT32 n32MaxChars, UINT32 un32Classes, 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
un32Classes

pszString

bAutoSegmentation

pointer to the source image/ROI.


maximum number of characters to be read.
logical mask obtained by combining the values of enum OCRClasses, to
specify to what classes the character may belong. The mask applies to all
the characters.
character array that will receive the codes of the recognized characters
(best match). The array must be large enough to accommodate
n32MaxChars characters.
boolean indicating whether the calculation of the true threshold has to be
forced (default TRUE) or bypassed (FALSE).

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

pointer to the source image/ROI.


maximum number of characters to be read.
pointer to an array of logical masks obtained by combining the values of
enum OCRClasses, to specify to what classes the character may belong.
Each mask value in the array applies to the corresponding character.
character array that will receive the codes of the recognized characters
(best match). The array must be large enough to accommodate
n32MaxChars characters.
boolean indicating whether the calculation of the true threshold has to be
forced (default TRUE) or bypassed (FALSE).

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

C++ Reference Manual 6.7.1

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

pointer to the source image/ROI.


maximum number of characters to be read.
logical mask obtained by combining the values of enum OCRClasses, to
specify to what classes the character may belong. The mask applies to all
the characters.
pointer to an array of logical mask obtained by combining the values of
enum OCRClasses, to specify to what classes the character may belong.
Each mask value in the array applies to the corresponding character.
character array that will receive the codes of the recognized characters
(best match). The array must be large enough to accommodate
n32MaxChars characters.

Recognized Characters

EOCR::GetNumChars
INT32 GetNumChars( );

Returns the number of recognized characters.


EOCR::CharGetOrgX
INT32 CharGetOrgX(INT32 n32Index);

Returns the abscissa of the upper left corner of a recognized character.


Parameters
n32Index

character number (in range 0..GetNumChars()-1).

EOCR::CharGetOrgY
INT32 CharGetOrgY(INT32 n32Index);

Returns the ordinate of the upper left corner of a recognized character.


Parameters
n32Index

character number (in range 0..GetNumChars()-1).

EOCR::CharGetDstX
INT32 CharGetDstX(INT32 n32Index);

Returns the abscissa of the lower right corner of a recognized character.


Parameters
n32Index

342

character number (in range 0..GetNumChars()-1).

EasyOCR: Printed Character Recognition

EOCR::CharGetDstY
INT32 CharGetDstY(INT32 n32Index);

Returns the ordinate of the lower right corner of a recognized character.


Parameters
n32Index

character number (in range 0..GetNumChars()-1).

EOCR::CharGetWidth
INT32 CharGetWidth(INT32 n32Index);

Returns the width of a recognized character.


n32Index
character number (in range 0..GetNumChars()-1).
EOCR::CharGetHeight
INT32 CharGetHeight(INT32 n32Index);

Returns the height of a recognized character.


Parameters
n32Index

character number (in range 0..GetNumChars()-1).

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

character number (in range 0..GetNumChars()-1).

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

character number (in range 0..GetNumChars()-1).

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

C++ Reference Manual 6.7.1

Parameters
n32Index

character number (in range 0..GetNumChars()-1).

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

character number (in range 0..GetNumChars()-1).

EOCR::GetFirstCharCode
INT32 GetFirstCharCode(INT32 n32Index);

Returns the code of the pattern that matches at best a recognized character.
Parameters
n32Index

character number (in range 0..GetNumChars()-1).

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

character number (in range 0..GetNumChars()-1).

EOCR::GetSecondCharCode
INT32 GetSecondCharCode(INT32 n32Index);

Returns the code of the pattern that matches at second best a recognized character.
Parameters
n32Index

character number (in range 0..GetNumChars()-1).

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

character number (in range 0..GetNumChars()-1).

EasyOCR: Printed Character Recognition

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

character number (in range 0..GetNumChars()-1).

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

pointer to the source image/ROI.


abscissa of the upper left corner of the bounding box of the pattern.
ordinate of the upper left corner of the bounding box of the pattern.
width of the bounding box of the pattern.
height of the bounding box of the pattern.
character code of the pattern.
class of the pattern, as defined by enum OCRClasses.

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

current cursor coordinates.


index of the character to be hit.
horizontal zooming factor. By default, true scale is used.
vertical zooming factor. If set to 0, the default value, the horizontal
zooming factor is used instead, so as to provide isotropic zooming.
horizontal panning factor. By default, no panning occurs.
vertical panning factor. By default, no panning occurs.

345

C++ Reference Manual 6.7.1

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

current cursor coordinates.


index of the character hit.
horizontal zooming factor. By default, true scale is used.
vertical zooming factor. If set to 0, the default value, the horizontal
zooming factor is used instead, so as to provide isotropic zooming.
horizontal panning factor. By default, no panning occurs.
vertical panning factor. By default, no panning occurs.

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

pointer to the source image/ROI.


index of the character (ASCII or Unicode) to learn.
character code of the pattern.
class of the pattern, as defined by enum OCRClasses.
boolean indicating whether the calculation of the true threshold has to be
forced (default TRUE) or bypassed (FALSE).

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

EasyOCR: Printed Character Recognition


void LearnPatterns(EROIBW8* pSrcImage, const UNICHAR* pszString, UINT32*
pun32Classes, 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. An array of classes determines the class(es) of each character
in the string.
Parameters
pSrcImage
pszString
pun32Class
bAutoSegmentation

pointer to the source image/ROI.


string containing character codes of the patterns.
pointer to an array of classes to match each character of the string, each
element is as defined by enum OCRClasses.
boolean indicating whether the calculation of the true threshold has to be
forced (default TRUE) or bypassed (FALSE).

EOCR::RemovePattern
void RemovePattern(UINT32 un32Index);

Removes a given pattern from the current font.


Parameters
un32Index

index of the pattern to be removed from the current font.

EOCR::GetNumPatterns
INT32 GetNumPatterns();

Returns the number of patterns in the current font.


EOCR::GetPatternCode
INT32 GetPatternCode(INT32 n32Index);

Returns the character code of a given pattern in the current font.


Parameters
n32Index

pattern number (in range 0..GetNumPatterns()-1).

EOCR::GetPatternClass
UINT32 GetPatternClass(INT32 n32Index);

Returns the class of a given pattern in the current font.


Parameters
n32Index

pattern number (in range 0..GetNumPatterns()-1).

EOCR::GetPatternBitmap
EBW8* GetPatternBitmap(INT32 n32Index);

Returns a pointer to the memory area holding the image of the pattern of the given index.

347

C++ Reference Manual 6.7.1

Parameters
n32Index

pattern number (in range 0..GetNumPatterns()-1).

EOCR::Load
INT16 Load(const CHAR* pszPathName);

Loads a new font from a file. This overwrites the previous contents of the font.
Parameters
pszPathName

full specification of the font file path and name.

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

width of the normalized pattern representation, in pixels.


height of the normalized pattern representation, in pixels.

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);

Writes the contents of the current font to a file.


Parameters
pszPathName

full specification of the font file path and name.

EOCR::Dump
void Dump ( );

Outputs a readable report of the OCR context contents to the standard output console.

348

EasyOCR: Printed Character Recognition

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

handle of the device context on which to draw.


character index, in range 0..GetNumChars()-1.
horizontal zooming factor. By default, true scale is used.
vertical zooming factor. If set to 0, the default value, the horizontal
zooming factor is used instead, so as to provide isotropic zooming.
horizontal panning factor. By default, no panning occurs.
vertical panning factor. By default, no panning occurs.

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

handle of the device context on which to draw.


horizontal zooming factor. By default, true scale is used.
vertical zooming factor. If set to 0, the default value, the horizontal
zooming factor is used instead, so as to provide isotropic zooming.
horizontal panning factor. By default, no panning occurs.
vertical panning factor. By default, no panning occurs.

349

C++ Reference Manual 6.7.1

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

character belongs to class 0.


character belongs to class 1.
character belongs to class 2.
character belongs to class 3.
character belongs to class 4.
character belongs to class 5.
character belongs to class 6.
character belongs to class 7.
character belongs to class 8.
character belongs to class 9.
character belongs to class 10.
character belongs to class 11.
character belongs to class 12.
character belongs to class 13.
character belongs to class 14.
character belongs to class 15.
character belongs to class 16.
character belongs to class 17.
character belongs to class 18.
character belongs to class 19.
character belongs to class 20.
character belongs to class 21.
character belongs to class 22.
character belongs to class 23.
character belongs to class 24.
character belongs to class 25.
character belongs to class 26.
character belongs to class 27.
character belongs to class 28.
character belongs to class 29.
character belongs to class 30.
character belongs to class 31.
character belongs to all classes, from 0 to 31 included.

the characters appear darker than the background.


the characters appear lighter than the background.

EasyOCR: Printed Character Recognition

OCR_DARK_ON_LIGHT
OCR_LIGHT_ON_DARK

3.3

the characters appear darker than the background. No thresholding takes


place when the characters are learnt and/or recognized.
the characters appear lighter than the background. No thresholding takes
place when the characters are learnt and/or recognized.

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

after segmentation, keep the blobs as they were found.


after segmentation, group together the blobs believed to belong to the
same character.

root-mean-square error method is used.


gray-level correlation method is used.
normalized gray-level correlation method is used.

enum OCR_SHIFTING_MODES

OCR_SHIFT_CHARS
OCR_SHIFT_TEXT

each character is moved individually.


the all set of characters is moved together.

351

C++ Reference Manual 6.7.1

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.

EasyFind is robust against noise, occlusion, blurring and illumination variations.


EasyFinds usage is straightforward:
1. Learning process where EasyFind extracts information for subsequent finding functions (see
Learn method of the PatternFinder object).
2. Finding function in search fields using the finding function (see Find method of the PatternFinder
object).
3. Retrieving information about found instances (Refer to FoundPattern class).
Declare using
#include "EFind.h"

355

C++ Reference Manual 6.7.1

2.

CLASSES

2.1

EasyFind: Introduction to Classes

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

FoundPattern, both in the Euresys.eVision package.

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

C++ Reference Manual 6.7.1

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

C++ Reference Manual 6.7.1

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

image or part of an image in which the learnt model has to be searched


for.

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

model to be learnt (ROI).

void PatternFinder::Learn(const EROIBW8& pattern, const EROIBW8& dontcare);

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

model to be learnt (ROI).


"don't care" area mask (ROI).

Remark
The "don't care" area mask should have the same size than the model.
PatternFinder::LearningDone
BOOL PatternFinder::LearningDone( ) const;

Allows knowing whether a pattern has already been learnt.

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);

Draw the model features with an overlay in image coordinates.


Parameters
hDC
f32ZoomX
f32ZoomY
f32PanX
f32PanY

2.2.3.4

Handle to the device context of the destination windows.


Horizontal zooming factor.
Vertical zooming factor. If set to 0, the horizontal zooming factor will be
used for isotropic zooming.
Horizontal panning offset.
Vertical panning offset.

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

C++ Reference Manual 6.7.1

Parameters
path

full path and name specification of the storage file.

void PatternFinder::Load(ESerializer* serializer);

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

full path and name specification of the storage file.

void PatternFinder::Save(ESerializer* serializer);

Appends the PatternFinder model data to the supplied serializer.


Parameters
serializer

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

C++ Reference Manual 6.7.1

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

Handle to the device context of the destination window.


Flag defining if the feature points are drawn (TRUE) or not (FALSE, the
default value).
Horizontal zooming factor.
Vertical zooming factor. If set to 0, the horizontal zooming factor will be
used for isotropic zooming.
Horizontal panning factor.
Vertical panning factor.

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

Handle to the device context of the destination window.


Flag defining if the feature points are drawn (TRUE) or not (FALSE, the
default value).
Horizontal zooming factor.
Vertical zooming factor. If set to 0, the horizontal zooming factor will be
used for isotropic zooming.
Horizontal panning factor.
Vertical panning factor.

EasyFind

3.

ENUMERATION CONSTANTS

3.1

enum Contrast::Type

This enumeration is in the Euresys::eVision::EasyFind package.


Contrast::Normal
Accepts instances with normal contrast (default mode).
Contrast::Inverse
Accepts instances with reversed contrast.
Contrast::Any
Accepts instances with normal and/or reversed contrast.

3.2

enum PatternType::Type

This enumeration is in the Euresys::eVision::EasyFind package.


PatternType::ConsistentEdges
Defines the ConsistentEdges pattern type.
PatternType::ThinStructure
Defines the ThinStructure pattern type.
PatternType::ContrastingRegions Defines the ContrastingRegions pattern type.
Refer to EasyFind User's Guide for definition of these pattern types.

3.3

enum ThinStructureMode::Type

This enumeration is in the Euresys::eVision::EasyFind package.


ThinStructureMode::Auto
Lets EasyFind choose automatically the best contrast of thin elements.
ThinStructureMode::Dark
Favors thin elements darker than regions.
ThinStructureMode::Bright
Favors thin elements brighter than regions.

365

C++ Reference Manual 6.7.1

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

EasyMatch: Pattern Matching

EasyMatch: Pattern Matching

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:

multiple pattern occurrences: several occurrences of a pattern, up to a user-defined number,


are returned. Only the reliable ones are retained.

standard, offset-normalized, gain-normalized and fully normalized correlation: the


correlation is computed on continuous tone values (as opposed to binary); the offset-normalized
correlation compensates for a change in intensity of the target image; the gain-normalized
correlation compensates for a change in contrast of the target image; the normalized correlation
compensates for both changes in intensity and contrast (combined offset and gain) of the target
image. Such changes may be local (due to non-uniform illumination) or global (offest and/or gain
drift between the pattern and image).

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:

EMatchPosition: holds the coordinates of the matched position.

369

C++ Reference Manual 6.7.1

Learning and matching processes


For obvious reasons, pattern matching is a complex and lengthy process when many degrees of freedom
are involved. In order to reduce the processing time, it is important to understand the working parameters
and fine tune them for a given application.
There are two phases in a pattern matching process: first, one selects an image (or ROI) containing the
pattern to be searched for and one lets the matching context preprocess it: this is the learning phase. It is
performed using a single function call:
EMatch::LearnPattern: receives the image/ROI as its argument and preprocesses it.

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

EasyMatch: Pattern Matching

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;

allowing anisotropic scaling;

allowing several matches;

setting the MinReducedArea parameter to a large value.


End of note.
Declare using
#include "EMatch.h"

371

C++ Reference Manual 6.7.1

2.

CLASSES AND CLASS MEMBERS

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

EMatch Class Members

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);

Constructs a matching context based on a pre-existing EMatch object.


Parameters
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

maximum number of degrees of freedom (this number must be comprised


between 2 and 5).

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

EasyMatch: Pattern Matching

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

pointer to the EMatch object in which the current EMatch object


parameters are to be copied. If NULL (the default value), a new EMatch
object will be created and returned.

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

EMatch object to be copied.

Example
EMatch Match1, Match2;
// Copy Match1 into Match2
Match2=Match1;

2.1.2.2

Learning and Matching

EMatch::LearnPattern
void EMatch::LearnPattern(EROIBW8* pPattern);
void EMatch::LearnPattern(EROIC24* pPattern);

Prepares a pattern for a subsequent matching operation.


Parameters
pPattern

pointer to a pattern image/ROI.

373

C++ Reference Manual 6.7.1

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();

Returns the minimum reduced area parameter.


void EMatch::SetMinReducedArea(UINT32 un32Area);

Sets the minimum reduced area parameter.


Parameters
un32Area

374

minimum reduced area.

EasyMatch: Pattern Matching

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();

Returns the dont care threshold.


void EMatch::SetDontCareThreshold(UINT32 un32Threshold);

Sets the dont care threshold.


Parameters
un32Threshold

dont care threshold.

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();

Returns the selected filtering mode.


void EMatch::SetFilteringMode(enum MCH_FILTERING_MODE eFilteringMode);

Sets the filtering mode.


Parameters
eFilteringMode

filtering mode, as defined by enum MCH_FILTERING_MODE.

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

C++ Reference Manual 6.7.1

EMatch::GetPattern Width/Height
INT32 EMatch::GetPatternWidth();

Returns the learnt pattern width.


INT32 EMatch::GetPatternHeight();

Returns the learnt pattern height.

2.1.2.4

Matching Parameters

EMatch::Get/SetCorrelationMode
enum E_CORRELATION_MODE EMatch::GetCorrelationMode();

Returns the correlation mode.


void EMatch::SetCorrelationMode(enum E_CORRELATION_MODE eMode);

Sets the correlation mode.


Parameters
eMode

correlation mode, as defined by enum E_CORRELATION_MODE.

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();

Returns the contrast mode.


void EMatch::SetContrastMode(enum MCH_CONTRAST_MODE eMode);

Sets the contrast mode.


Parameters
eMode

contrast mode, as defined by enum MCH_CONTRAST_MODE.

Remarks
By default, the contrast mode is set to Normal (MCH_CONTRAST_NORMAL).
EMatch::Get/SetInterpolate
BOOL EMatch::GetInterpolate();

Returns the interpolation mode.


void EMatch::SetInterpolate(BOOL bInterpolate);

Sets the interpolation mode.

376

EasyMatch: Pattern Matching

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();

Returns the maximum number of positions.


void EMatch::SetMaxPositions(UINT32 un32MaxPositions);

Sets the maximum number of positions.


Parameters
un32MaxPositions

maximum number of positions.

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();

Returns the index of the last reduction.


void EMatch::SetFinalReduction(UINT32 un32FinalReduction);

Sets the index of the last reduction.


Parameters
un32FinalReduction

index of the last reduction.

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

C++ Reference Manual 6.7.1

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

maximum number of positions at the first stage of the matching process.

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();

Returns the minimum score.


void EMatch::SetMinScore(FLOAT32 f32Score);

Sets the minimum score.


Parameters
f32Score

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

EasyMatch: Pattern Matching

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

initial minimum score.

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);

Sets the physical pixel dimensions.


void EMatch::GetPixelDimensions(FLOAT32& f32Width, FLOAT32& f32Height);

Gets the physical pixel dimensions.


Parameters
f32Width
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

minimum angle, expressed using the current angle unit

379

C++ Reference Manual 6.7.1

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

maximum angle, expressed using the current angle unit

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();

Returns the minimum scale factor for isotropic scaling.


void EMatch::SetMinScale(FLOAT32 f32Scale);

Sets the minimum scale factor for isotropic scaling.


Parameters
f32Scale

minimum scale factor.

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();

Returns the maximum scale factor for isotropic scaling


void EMatch::SetMaxScale(FLOAT32 f32Scale);

Sets the maximum scale factor for isotropic scaling


Parameters
f32Scale

380

maximum scale factor.

EasyMatch: Pattern Matching

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();

Returns the minimum horizontal scale factor for anisotropic scaling.


void EMatch::SetMinScaleX(FLOAT32 f32Scale);

Sets the minimum horizontal scale factor for anisotropic scaling.


Parameters
f32Scale

minimum scale factor.

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();

Returns the maximum horizontal scale factor for anisotropic scaling.


void EMatch::SetMaxScaleX(FLOAT32 f32Scale);

Sets the maximum horizontal scale factor for anisotropic scaling.


Parameters
f32Scale

maximum scale factor.

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();

Returns the minimum vertical scale factor for anisotropic scaling.

381

C++ Reference Manual 6.7.1


void EMatch::SetMinScaleY(FLOAT32 f32Scale);

Sets the minimum vertical scale factor for anisotropic scaling.


Parameters
f32Scale

minimum scale factor.

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();

Returns the maximum vertical scale factor for anisotropic scaling.


void EMatch::SetMaxScaleY(FLOAT32 f32Scale);

Sets the maximum vertical scale factor for anisotropic scaling.


Parameters
f32Scale

maximum scale factor.

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();

Returns the current value of angle step.


EMatch::GetScaleStep
FLOAT32 EMatch::GetScaleStep();

Returns the current value of scale step.

382

EasyMatch: Pattern Matching

EMatch::GetScaleX/YStep
FLOAT32 EMatch::GetScaleXStep();
FLOAT32 EMatch::GetScaleYStep();

Returns the current value of scale X/Y step.


EMatch::SetExtension
EMatch::SetExtension(INT32 n32ExtensionX, INT32 n32ExtensionY);

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

extension outside the matching ROI along its Width, in pixels.


extension outside the matching ROI along its Height, in pixels.

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);

Returns a pointer to an EMatchPosition object containing the position coordinates.


Parameters
un32Index

index to the desired position, between 0 and GetNumPositions()-1


included. The positions are stored by decreasing score.

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

handle of the device context on which to draw.


occurrence index, in range 0..GetNumPositions()-1.
TRUE if the corner mark is to be drawn. FALSE by default. (This mark is
useful when large rotations are allowed.)

383

C++ Reference Manual 6.7.1

f32ZoomX
f32ZoomY
f32PanX
f32PanY

horizontal zooming factor. By default, true scale is used.


vertical zooming factor. If set to 0, the default value, the horizontal
zooming factor is used instead, so as to provide isotropic zooming.
horizontal panning factor. By default, no panning occurs.
vertical panning factor. By default, no panning occurs.

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

handle of the device context on which to draw.


TRUE if the corner mark is to be drawn. FALSE by default. (This mark is
useful when large rotations are allowed.)
horizontal zooming factor. By default, true scale is used.
vertical zooming factor. If set to 0, the default value, the horizontal
zooming factor is used instead, so as to provide isotropic zooming.
horizontal panning factor. By default, no panning occurs.
vertical panning factor. By default, no panning occurs.

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

EasyMatch: Pattern Matching

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

C++ Reference Manual 6.7.1

Parameters
pszPathName

full path and name specification of the storage file. Use of file extension
.MCH is recommended though not mandatory.

void EMatch::Save(FILE* file);

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();

Returns the EMatch object version number.

386

EasyMatch: Pattern Matching

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

C++ Reference Manual 6.7.1

3.

ENUMERATION CONSTANTS

3.1

enum E_CORRELATION_MODE

E_MATCH_STANDARD
E_MATCH_OFFSET_NORMALIZED
E_MATCH_GAIN_NORMALIZED
E_MATCH_NORMALIZED

correlation sensitive to changes in intensity and/or contrast


(computed from the raw image/pattern gray values).
correlation made unsensitive to changes in intensity (computed
from the centered image/pattern gray values).
correlation made unsensitive to changes in contrast (computed
from the reduced image/pattern gray values).
correlation made unsensitive to changes in both intensity and
contrast (computed from the centered and reduced
image/pattern gray values). Default mode.

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

Normal contrast. Pattern occurrences will be found with the same


contrast as at learn time. Default mode.
Inverse contrast. Pattern occurrences will be found with reversed
contrast.
Normal or inverse contrast. Pattern occurrences can be found both
with normal and inverse contrast.

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.

EasyMatch: Pattern Matching

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

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.

Template model structure


It is important to understand how the template model is organized. Inspection takes place in a rectangular
region of interest. In this region, several pieces of text can be defined. A piece of text is a set of characters
rigidly tight to each other. In practice, all the marks that are printed simultaneously should be considered a
single text. During inspection, the different texts are allowed to move independently of each other.

Texts are sets of characters


Important note: a text item need not be defined for every row of text or every word of a sentence. The
true goal of defining more than one text is to allow several parts of the marking to be inspected separately,
i.e. have different inspection parameters and quality acceptance criteria. End of note.
A character is the smallest part of a mark that can be inspected separately. The characters are attached to
a text but a small displacement from their nominal position can be allowed and measured.

393

C++ Reference Manual 6.7.1

Characters are sets of blobs


A character can be composed of several blobs grouped together. A blob is a connected component of a
thresholded image, as handled by EasyObject.

Blobs are the "atomic" constituents of markings

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

EasyOCV: Optical Character Verification

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.

Degrees of freedom for location


During inspection, the best match between the template model and the sample image is found during a
search phase called location. The following degrees of freedom can be allowed and their amplitude
specified:

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

C++ Reference Manual 6.7.1

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.

All degrees of freedom combined

Specification of the degrees of freedom


The location degrees of freedom are specified with respect to the nominal position, i.e. the position at
learning time (the text centers are remembered relative to the template image center, the skew and shear
angles are set to 0 and scale factors to 1; the characters are remembered relative to the corresponding
text center).
The parameters are allowed to vary in an acceptance interval, specified as a Tolerance around a Bias
value: the range bounds are computed as Bias + or - Tolerance. When a bias parameter is set to 0, the
range is centered around the nominal value. When a tolerance parameter is set to 0, the corresponding
degree of freedom is not used.

396

EasyOCV: Optical Character Verification

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

(contrast) and offset (intensity).


3. correlation-based: normalized correlation, as used in pattern matching techniques (EasyMatch),
is a way to rate the mismatches between two images. The correlation parameter is a global score
in range 0 to 1, which is implicitly corrected for a change in gain and offset.
The area-based indicators rely on thresholding of the sample image. If necessary, the threshold level must
be compensated for a change in offset. The sum-based indicators do not rely on thresholding of the
sample image, but the reference foreground and background gray-levels must take into account changes
in gain and offset. With these indicators, acceptance/rejection of the characters is decided by comparing
the values related to the sample and the template: if the difference is larger than the specified tolerance, a
defect is reported. Too small a foreground value indicates under-printing or missing character parts; too
large a background value indicates over-printing or spurious character parts. Character mismatches
provoke both kinds of anomalies.
The correlation-based indicator is a global measure of mismatch that should be as close as possible to 1.
It is not sensitive at all to changes in gain or offset.
After computation of the quality indicators, the detected defects are reported by two ways:

explanatory diagnostics are associated to each inspected character and text;

the items for which diagnostics are reported are automatically selected so that they can be
immediately highlighted on the display.
397

C++ Reference Manual 6.7.1

Template model definition


A very careful preparation of the template is the key to successful OCV. The eVision package includes a
ready-made model editor that provides all means to interactively build and modify the structure of the
template and then archive it. Writing your own template editor is also possible, though this is not a trivial
task.
The template definition follows a logical sequence of steps:

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.

Lastly, the inspection parameters must be defined. These include:


1. the allowed ranges for the location parameters of the texts with respect to their nominal position
in the inspected ROI. These parameters correspond to translation, rotation, scaling in both
horizontal and vertical directions, and shearing;
2. the allowed ranges for the location parameters of the characters with respect to their nominal
position in the inspected texts. These parameters correspond to translation only;
3. the allowed ranges for the quality ratings with respect to their nominal values. These parameters
can be chosen among the area of the character background and foreground, the average gray
level of these areas, and a similarity coefficient.
When the allowed ranges are specified, per text and per character, the template can be saved.
Before commencing the interactive definition of the template, one should consider the inspection problem
at hand and decide:

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

EasyOCV: Optical Character Verification

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).

Overview of the classes involved


The OCV learning and inspection operations are implemented by means of three related classes:

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.

Accessing the model components


The OCV context (EOCV class) contains a vector of texts (EOCVText class). Each element of the vector
of text is itself a vector of characters (EOCVChar class).
There are essentially two ways of traversing the hierarchy of model components (texts and characters) to
retrieve or modify the associated values (data members): by indexed access, or by selection.
In the indexed mode, you access the elements one at a time. To address a particular text, you provide its
index. To address a particular character, you provide both the index of the text that contains it and the
index of the character within this text. The text and character indices are assigned at learning time.
In the selection mode, you access the elements globally using a selection tag. Every text and every
character is set in a selected/unselected state so that in a single operation, you can read or write the value
of some data member for all currently selected elements. When reading a data member, a value is only
returned when it is identical for all selected elements.
The selected mode is very handy for implementing interactive editors that allow to list and modifiy
parameters for groups of elements. The indexed mode is preferred to produce exhaustive lists of values.
Both modes of access allow you to separately read or modify all public members of the OCVText and
OCVChar classes, provided they are not read-only.

Overview of the function categories


EOCV
Persistent storage
Template Drawing

file storage and retrival of the model.


graphical representation of the learnt text and characters.

399

C++ Reference Manual 6.7.1

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

graphical representation of the inspected text and characters.


handling of blobs during model edition.
handling of characters during model edition.
handling of texts during model edition.
access to text parameters.
access to character parameters.
selection and deselection of texts and characters.
learning operation.
image thresholding.
location modes.
inspection modes.
access to statistics.
location process tuning.
degrees of freedom.
inspection tuning and quality indicators.

restores all parameters to an undefined value.


location process tuning.
degrees of freedom.
inspection tuning and quality indicators.

restores all parameters to an undefined value.

EasyOCV: Optical Character Verification

2.

CLASSES AND CLASS MEMBERS

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

EOCV Class Members

2.1.2.1

Construction

EOCV: Construction
Only the default constructor is needed.
EOCV();

Constructs an OCV context

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

C++ Reference Manual 6.7.1

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

device context of the drawing window.


selection mode for the objects, as defined by enum
E_SELECTION_MODE. By default, only the selected objects are drawn.
zooming parameters.
panning parameters.

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);

Draws the free characters as bounding rectangles.


Parameters
hDC

402

device context of the drawing window.

EasyOCV: Optical Character Verification

eCharsSelectionMode

f32ZoomX, f32ZoomY
f32OrgX, f32OrgY

selection mode for the free characters, as defined by enum


E_SELECTION_MODE. By default, only the selected characters are
drawn.
zooming parameters.
panning parameters.

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);

Draws the texts as bounding rectangles.


Parameters
hDC
eTextsSelectionMode
f32ZoomX, f32ZoomY
f32OrgX, f32OrgY

device context of the drawing window.


selection mode for the free texts, as defined by enum
E_SELECTION_MODE. By default only the selected texts are drawn.
zooming parameters.
panning parameters.

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);

Draws the characters of the texts as bounding rectangles.


Parameters
hDC
eTextsSelectionMode
eCharsSelectionMode

f32ZoomX, f32ZoomY
f32OrgX, f32OrgY

device context of the drawing window.


selection mode for the texts, as defined by enum E_SELECTION_MODE.
By default, only characters from the selected texts are drawn.
selection mode for the characters, as defined by enum
E_SELECTION_MODE. By default, only the selected characters of the
selected texts are drawn.
zooming parameters.
panning parameters.

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

C++ Reference Manual 6.7.1

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

device context of the drawing window.


reference to the desired text can be obtained by indexing the m_Texts
vector.
zooming parameters.
panning parameters.

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

device context of the drawing window.


texts selection mode, as defined by enum E_SELECTION_MODE.
zooming parameters.
panning parameters.

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

EasyOCV: Optical Character Verification

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

device context of the drawing window.


reference to the desired text can be obtained by indexing the m_Texts
vector.
characters selection mode, as defined by enum E_SELECTION_MODE.
zooming parameters.
panning parameters.

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);

Draws a tight bounding box around all characters of all texts.


Parameters
hDC
eTextsSelectionMode
eCharsSelectionMode
f32ZoomX, f32ZoomY
f32OrgX, f32OrgY

device context of the drawing window.


texts selection mode, as defined by enum E_SELECTION_MODE.
characters selection mode, as defined by enum E_SELECTION_MODE.
zooming parameters.
panning parameters.

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);

Computes the coordinates of a point located relatively to a given text.

405

C++ Reference Manual 6.7.1

Parameters
un32TextIndex
n32X
n32Y
f32ReducedX
f32ReducedY
f32ZoomX, f32ZoomY
f32PanX, f32PanY

text index in range 0 to NumTexts, excluded.


returned abscissa of the requested point.
returned ordinate of the requested point.
X position of the requested point relatively the text bounding box, as
defined on the picture below.
Y position of the requested point relatively to the text bounding box, as
defined on the picture below
zooming parameters.
panning parameters.

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);

Computes the coordinates of a point located relatively to a given character.


Parameters
un32TextIndex
un32CharIndex
n32X
n32Y
f32ReducedX
f32ReducedY
f32ZoomX, f32ZoomY
f32PanX, f32PanY

406

text index in range 0 to NumTexts, excluded.


character index in range 0 to NumTextChars, excluded.
returned abscissa of the requested point.
returned ordinate of the requested point.
X position of the requested point relatively to the character bounding box,
as defined on the picture below.
Y position of the requested point relatively to the character bounding box,
as defined on the picture below
zooming parameters.
panning parameters.

EasyOCV: Optical Character Verification

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

pointer to the source image/ROI.

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

Holds a copy of the template image.


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.

407

C++ Reference Manual 6.7.1

2.1.2.6

Free objects management

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

selection mode for the objects, as defined by enum


E_SELECTION_MODE. By default, only the selected objects are created.

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

absolute coordinates of the selection rectangle (relative to the topmost


parent image).
limits of the selection rectangle.
selection mode for the objects, as defined by enum
E_SELECTION_MODE. By default, all objects are processed.

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

EasyOCV: Optical Character Verification

Removes free objects from the OCV context.


Parameters
eObjectsSelectionMode

selection mode for the objects, as defined by enum


E_SELECTION_MODE. By default, only the selected objects are deleted.

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

Free characters management

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

selection mode for the objects, as defined by enum


E_SELECTION_MODE. By default, only the selected objects are created.
free objects grouping criterion, as defined by enum
OCV_CHAR_CREATION_MODES. By default, the free objects whose
bounding rectangle overlap are considered as belonging to the same
character.

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

C++ Reference Manual 6.7.1

Parameters
n32OrgX, n32OrgY
n32Width, n32Height
eCharsSelectionMode

absolute coordinates of the selection rectangle (relative to the topmost


parent image).
limits of the selection rectangle
selection mode for the free characters, as defined by enum
E_SELECTION_MODE. By default, all free characters are processed.

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);

Removes free characters from the OCV context.


Parameters
eCharsSelectionMode

selection mode for the free characters, as defined by enum


E_SELECTION_MODE. By default, only the selected free characters are
deleted.

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

Template texts management

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

EasyOCV: Optical Character Verification

Parameters
eCharsSelectionMode

selection mode for the free characters, as defined by enum


E_SELECTION_MODE. By default, only the selected free characters are
processed.

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

absolute coordinates of the selection rectangle (relative to the topmost


parent image).
limits of the selection rectangle.
selection mode for the template texts, as defined by enum
E_SELECTION_MODE. By default, all texts are processed.

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);

Removes template texts from the OCV context.


Parameters
eTextsSelectionMode

selection mode for the template texts, as defined by enum


E_SELECTION_MODE. By default, only the selected texts are deleted.

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

C++ Reference Manual 6.7.1

2.1.2.9

Text parameters

EOCV: Text parameters overview


The texts have many associated parameters related to location as well as inspection. These are
defined as members of the EOCVText class and documented accordingly.
In order to retrieve or modify a parameter associated with a piece of text, a temporary EOCVText
object is required and passed to the access function. There are two ways to specify the target texts:

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

temporary EOCVText object.


Text index in range 0 to NumTexts, excluded.

void SetTextParameters(EOCVText& Text, UINT32 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

temporary EOCVText object.


Text index in range 0 to NumTexts, excluded.

EasyOCV: Optical Character Verification

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

temporary EOCVText object.


Text index in range 0 to NumTexts, excluded.

void SetTextParameters(EOCVText& Text, UINT32 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

temporary EOCVText object.


Text index in range 0 to NumTexts, excluded.

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

temporary EOCVText object.


selection mode for the texts, as defined by enum E_SELECTION_MODE.

void ScatterTextsParameters(EOCVText& Text, enum E_SELECTION_MODE


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

temporary EOCVText object.


selection mode for the texts, as defined by enum E_SELECTION_MODE.

413

C++ Reference Manual 6.7.1

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

temporary EOCVText object.


selection mode for the texts, as defined by enum E_SELECTION_MODE.

void ScatterTextsParameters(EOCVText& Text, enum E_SELECTION_MODE


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

temporary EOCVText object.


selection mode for the texts, as defined by enum E_SELECTION_MODE.

2.1.2.10 Text character parameters


EOCV: Text character parameters overview
The text characters have many associated parameters related to location as well as inspection. These
are defined as members of the EOCVChar class and documented accordingly.
In order to retrieve or modify a parameter associated with a text character, a temporary EOCVChar
object is required and passed to the access function. There are two ways to specify the target
characters:

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

EasyOCV: Optical Character Verification

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

index of the desired text, in range 0 to NumTexts-1.

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

temporary EOCVChar object.


character index in range 0 to NumTexts-1.
character index in range 0 to NumTextChars-1.

void SetTextCharParameters(EOCVChar& Char, UINT32 un32TextIndex, UINT32


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

temporary EOCVChar object.


character index in range 0 to NumTexts-1.
character index in range 0 to NumTextChars-1.

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

temporary EOCVChar object.


character index in range 0 to NumTexts-1.
character index in range 0 to NumTextChars-1.

415

C++ Reference Manual 6.7.1


void SetTextCharParameters(EOCVChar& Char, UINT32 un32TextIndex, UINT32
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

temporary EOCVChar object.


character index in range 0 to NumTexts-1.
character index in range 0 to NumTextChars-1.

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

temporary EOCVChar object.


selection mode for the texts, as defined by enum E_SELECTION_MODE.
selection mode for the text characters, as defined by enum
E_SELECTION_MODE.

void ScatterTextsCharsParameters(EOCVChar& Char, enum E_SELECTION_MODE


eTextsSelectionMode, enum E_SELECTION_MODE 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

temporary EOCVChar object.


selection mode for the texts, as defined by enum E_SELECTION_MODE.
selection mode for the text characters, as defined by enum
E_SELECTION_MODE.

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

EasyOCV: Optical Character Verification

Parameters
Char
eTextsSelectionMode
eCharsSelectionMode

temporary EOCVChar object.


selection mode for the texts, as defined by enum E_SELECTION_MODE.
selection mode for the text characters, as defined by enum
E_SELECTION_MODE.

void ScatterTextsCharsParameters(EOCVChar& Char, enum E_SELECTION_MODE


eTextsSelectionMode, enum E_SELECTION_MODE 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

temporary EOCVChar object.


selection mode for the texts, as defined by enum E_SELECTION_MODE.
selection mode for the text characters, as defined by enum
E_SELECTION_MODE.

2.1.2.11 Sample Texts and character selection


EOCV: Texts and characters selection modes
Several operations are performed selectively on the OCV model components they can be applied to all
texts, all selected texts or all deselected texts. In a similar way, they can be applied to all characters, all
selected character or all deselected characters of the designated texts.
This behavior is specified through arguments eTextsSelectionMode and eCharsSelectionMode, as
specified by enum E_SELECTION_MODE.
When a Get... member function is invoked to return the value of a data member of a set of Texts or
characters, the function returns TRUE only if the data values of all designated items are identical.
EOCV::SelectSampleTexts
void SelectSampleTexts(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
become selected and conversely).
Parameters
n32OrgX, n32OrgY
n32Width, n32Height
eTextsSelectionMode

absolute coordinates of the selection rectangle (relative to the topmost


parent image).
limits of the selection rectangle.
selection mode for the template texts, as defined by enum
E_SELECTION_MODE. By default, all texts are checked for intersection

Remarks
Reading or changing properties of the sample texts and the characters they contain can be done on
basis of selection.

417

C++ Reference Manual 6.7.1

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

absolute coordinates of the selection rectangle (relative to the topmost


parent image).
limits of the selection rectangle.
selection mode for the sample texts, as defined by enum
E_SELECTION_MODE. By default, all texts are checked for intersection
selection mode for the sample text characters, as defined by enum
E_SELECTION_MODE. By default, all characters of all texts are checked
for intersection

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

pointer to the template image/ROI.


Characters selection mode, as defined by enum E_SELECTION_MODE.
Texts selection mode, as defined by enum E_SELECTION_MODE.

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.

EasyOCV: Optical Character Verification

Remarks
An explicit call of this method is performed by method Learn at the end of the learning stage.

2.1.2.13 Contrast options


EOCV: Contrast parameters
Image contrast is an important factor during both learning and inspection. The background and foreground
information must be separated using an appropriate threshold, possibly determined automatically. After a
threshold is given, the average gray level of the background and foreground areas are computed
separately. These serve as reference gray levels to measure the image contrast and normalize the gray
level quality indicators.
The background and foreground reference gray levels are computed for both the template and sample
images. They are used for contrast assessment as well as gray-level normalization.
m_f32TemplateBackground FLOAT32. Reference background gray levels determined during learning
of the template.
m_f32TemplateForeground FLOAT32. Reference foreground gray levels determined during learning of
the template.
m_bw8TemplateThreshold EBW8 . Threshold level applied to the template during learning.
m_bw8SampleThreshold
EBW8 . Threshold level applied to the sample during inspection.
m_f32SampleBackground
FLOAT32. Reference background gray levels determined during
inspection of the sample.
m_f32SampleForeground
FLOAT32. Reference foreground gray levels determined during inspection
of the sample.
The Contrast parameter is defined as the ratio of the reference gray-levels difference over their sum. This
parameter is maximum (100 %) for a perfectly contrasted image (white on black).
FLOAT32 GetTemplateContrast();

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

C++ Reference Manual 6.7.1

Parameters
f32Tolerance

allowed tolerance value on the global contrast.

EOCV::Get/SetWhiteOnBlack
BOOL EOCV::GetWhiteOnBlack();

Returns the value of the WhiteOnBlack parameter.


void EOCV::SetWhiteOnBlack(BOOL bWhiteOnBlack);

Sets the WhiteOnBlack parameter.


When the boolean bWhiteOnBlack is set to TRUE, the learning and inspection steps used white
characters on a black background. If it is set to FALSE, black characters on a white background are
taken into account.
Parameters
bWhiteOnBlack

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.

2.1.2.14 Location options


EOCV: Location parameters
The location process is an important phase of the inspection task. It allows the OCV context to accurately
find the template position in the sample image, using all allowed degrees of freedom. This process can be
tuned in several ways to trade speed for robustness.
m_eLocationMode
enum OCV_LOCATION_MODE. Specifies what kind of pre-processing
should be applied to the sample image, as defined by enum
OCV_LOCATION_MODE.

2.1.2.15 Inspection options


EOCV::Get/SetUsedQualityIndicators
UINT32 GetUsedQualityIndicators();

Returns the choice of quality indicators.


void SetUsedQualityIndicators(UINT32 un32UsedQualityIndicators);

Sets the choice of quality indicators.


Parameters
un32UsedQualityIndicators bitwise combination (OR) of the quality indicators to be computed, as
defined by enum OCV_QUALITY_INDICATORS.

420

EasyOCV: Optical Character Verification

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();

Returns the character resampling mode.


void SetResampleChars(BOOL bResampleChars);

Sets the character resampling mode.


Parameters
bResampleChars

character resampling mode. TRUE if the characters pixels are resampled


in case of rotation, shearing and scaling.

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();

Returns the current location score reduction mode.


void SetReduceLocationScore(BOOL bReduceLocationScore)

Sets the current location score reduction mode.


Parameters
bReduceLocationScore

boolean value used to set the location score reduction mode.

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();

Returns the current location score normalization mode.


void SetNormalizeLocationScore(BOOL bNormalizeLocationScore);

Sets the current location score normalization mode.

421

C++ Reference Manual 6.7.1

Parameters
bNormalizeLocationScore

boolean value used to set the location score normalization mode.

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();

Returns the current texts location scoring mode.


void SetAccurateTextsLocationScore(BOOL bAccurate);

Sets the current texts location scoring mode.


Parameters
bAccurate

boolean value used to set the texts location scoring mode

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

pointer to the image/ROI to be inspected. The center of this image serves


as a reference point on which the center of the template image is aligned.
threshold level suitable for the sample image. The same convention as
that of ImgThreshold is used for automatic thresholding.

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

EasyOCV: Optical Character Verification

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

C++ Reference Manual 6.7.1

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

safety factor to use when re-computing the tolerances. See remarks


below.
tells on which texts the adjustment should be applied, as defined by enum
E_SELECTION_MODE.

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

safety factor to use when re-computing the tolerances. See remarks


below.
tells on which texts the adjustment should be applied, as defined by enum
E_SELECTION_MODE.
tells on which chars the adjustment should be applied, as defined by
enum E_SELECTION_MODE.

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

EasyOCV: Optical Character Verification

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

safety factor to use when re-computing the tolerances. See remarks


below.
tells on which texts the adjustment should be applied, as defined by enum
E_SELECTION_MODE.

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

safety factor to use when re-computing the tolerances. See remarks


below.
tells on which texts the adjustment should be applied, as defined by enum
E_SELECTION_MODE.
tells on which chars the adjustment should be applied, as defined by
enum E_SELECTION_MODE.

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

C++ Reference Manual 6.7.1

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 Class Members

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

EasyOCV: Optical Character Verification

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

FLOAT32. Measured horizontal translation.


FLOAT32. Horizontal translation bias. 0 corresponds to the nominal
position.
FLOAT32. Horizontal translation tolerance.
UINT32. First pass stride for the horizontal translation.

ShiftY
m_f32ShiftY
m_f32ShiftYBias
m_f32ShiftYTolerance
m_un32ShiftYStride

FLOAT32. Measured vertical translation.


FLOAT32. Vertical translation bias. 0 corresponds to the nominal position.
FLOAT32. Vertical translation tolerance.
UINT32. First pass stride for the vertical translation.

EOCVChar: Character inspection parameters


Diagnostics
After inspection, each character is tagged with a logical combination of diagnostics, each
corresponding to a kind of defect.
m_un32Diagnostics
UINT32. Logical combination (bitwise OR) of defects, as defined by enum
OCV_DIAGNOSTICS.
Quality indicators
A set of parameters are computed on demand (see Inspection Options) during inspection. The values
of these parameters are used to detect defects of various kinds by checking that they remain in a given
tolerance interval. If not, a diagnostic is issued.

427

C++ Reference Manual 6.7.1

Area based
m_un32TemplateForegroundArea
m_un32SampleForegroundArea
m_un32ForegroundAreaTolerance
m_un32TemplateBackgroundArea
m_un32SampleBackgroundArea
m_un32BackgroundAreaTolerance

UINT32. Number of pixels in the template foreground of this


character.
UINT32. Number of foreground pixels of this character
corresponding to a foreground pixel of the template character.
UINT32. Maximum allowed difference between the sample and
template foreground areas.
UINT32. Number of pixels in the background of this character.
UINT32. Number of background pixels of this character
corresponding to a background pixel of the template character.
UINT32. Maximum allowed difference between the sample and
template background areas.

Normalized gray value based


m_f32TemplateForegroundSum
m_f32SampleForegroundSum

m_f32ForegroundSumTolerance
m_f32TemplateBackgroundSum
m_f32SampleBackgroundSum

m_f32BackgroundSumTolerance

FLOAT32. Sum of the normalized gray-level values of the


foreground pixels of this character.
FLOAT32. Sum of the normalized gray-level values of the
pixels of this character corresponding to a foreground pixel of
the template character.
FLOAT32. Maximum allowed difference between the sample
and template foreground sums.
FLOAT32. Sum of the normalized gray-level values of the
background pixels of this character.
FLOAT32. Sum of the normalized gray-level values of the
pixels of this character corresponding to a background pixel of
the template character.
FLOAT32. Maximum allowed difference between the sample
and template background sums.

Normalized correlation based


m_f32Correlation
m_f32CorrelationTolerance

FLOAT32. Normalized correlation involving the template and


sample character images.
FLOAT32. Maximum allowed difference between the
normalized correlation and unity.

Miscellaneous
m_un32MarginWidth

2.2.2.1

UINT32. Width of the extra space to be used around the


characters bounding box (on all four sides) when computing a
quality indicator.

EOCVChar: Character statistics

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

EasyOCV: Optical Character Verification

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

FLOAT32. Shift X standard deviation.


FLOAT32. Minimum Shift X.
FLOAT32. Maximum Shift X.
FLOAT32. Shift Y average.
FLOAT32. Shift Y standard deviation.
FLOAT32. Minimum Shift Y.
FLOAT32. Maximum Shift Y.
FLOAT32. Foreground area average.
FLOAT32. Foreground area standard deviation.
FLOAT32. Background area average.
FLOAT32. Background area standard deviation.
FLOAT32. Foreground sum average.
FLOAT32. Foreground sum standard deviation.
FLOAT32. Background sum average.
FLOAT32. Background sum standard deviation.
FLOAT32. Correlation average.
FLOAT32. Correlation standard deviation.

EOCVChar: Miscellaneous character parameters


m_bWhiteOnBlack
m_bSelected

2.3
2.3.1

BOOL. Character contrast: TRUE for light characters on a dark


background.
BOOL. Selection state: TRUE when selected.

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 Class Members

EOCVText::ResetParameters
void ResetParameters();

Sets all text parameters to the undefined value for use before a SetTextParameter or
ScatterTextsParameters operation.

429

C++ Reference Manual 6.7.1

EOCVText: Text location parameters


Number of contour points
The location process relies on points from the external contours of the constituent blobs of the text
characters. The number of points to be used can be adjusted. The smaller this value, the faster the
location, but too small a value can cause mismatches.
m_un32NumContourPoints
UINT32 . Number of contour points used for location of this text.
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 text 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 text not found diagnostic is issued.
EOCVText: Text position parameters
Each text can be translated horizontally and vertically, rotated, scaled horizontally and vertically and
sheared with respect to its nominal position, to cope with mechanical displacement of the marking device.
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.
Note. The stride parameters apply to the two translation degrees of freedom only. End of note.
ShiftX
m_f32ShiftX
m_f32ShiftXBias
m_f32ShiftXTolerance
m_un32ShiftXStride

FLOAT32. Measured horizontal translation, in pixels.


FLOAT32. Horizontal translation bias. 0 corresponds to the nominal
position.
FLOAT32. Horizontal translation tolerance.
UINT32. First pass stride for the horizontal translation.

ShiftY
m_f32ShiftY
m_f32ShiftYBias
m_f32ShiftYTolerance
m_un32ShiftYStride

FLOAT32. Measured vertical translation, in pixels.


FLOAT32. Vertical translation bias. 0 corresponds to the nominal
position.
FLOAT32. Vertical translation tolerance.
UINT32. First pass stride for the vertical translation.

Skew
m_f32Skew
m_f32SkewBias

430

FLOAT32. Measured rotation, clockwise from the horizontal direction,


expressed in the current angle unit.
FLOAT32. Rotation bias. 0 corresponds to the nominal, horizontal
position.

EasyOCV: Optical Character Verification

m_f32SkewTolerance
m_un32SkewCount

FLOAT32. Rotation tolerance.


UINT32. Number of values to be tried in the Bias + or - Tolerance range,
bounds included.

Isotropic Scaling
m_bIsotropicScaling

BOOL. Indicates whether the scaling degree of freedom should be


considered isotropic (ScaleX and ScaleY identical) or not. In most cases,
isotropic scaling, which is the default mode, is recommended. Isotropic
scaling executes faster and is more realistic.
In case of isotropic scaling search, the ScaleY... values are meaningless.

ScaleX
m_f32ScaleX
m_f32ScaleXBias
m_f32ScaleXTolerance
m_un32ScaleXCount

FLOAT32. Measured horizontal scaling, expressed as a dimensionless


ratio.
FLOAT32. Horizontal scaling bias. 0 corresponds to the nominal, true
scale factor.
FLOAT32. Horizontal scaling tolerance.
UINT32. Number of values to be tried in the Bias + or - Tolerance range,
bounds included.

ScaleY
m_f32ScaleY
m_f32ScaleYBias
m_f32ScaleYTolerance
m_un32ScaleYCount

FLOAT32. Measured vertical scaling, expressed as a dimensionless


ratio.
FLOAT32. Vertical scaling bias. 0 corresponds to the nominal, true scale
factor.
FLOAT32. Vertical scaling tolerance.
UINT32. Number of values to be tried in the Bias + or - Tolerance range,
bounds included.

Shear
m_f32Shear
m_f32ShearBias
m_f32ShearTolerance
m_un32ShearCount

FLOAT32. Measured shearing, clockwise from the vertical direction,


expressed in the current angle unit.
FLOAT32. Shearing bias. 0 corresponds to the nominal, upright position.
FLOAT32. Shearing tolerance.
UINT32. Number of values to be tried in the Bias + or - Tolerance range,
bounds included.

EOCVText: Text inspection parameters


Diagnostics
After inspection, each text is tagged with a logical combination of diagnostics, each corresponding to a
kind of defect. The defects of the characters belonging to this texts are also added to this combination.
m_un32Diagnostics
UINT32. Logical combination (bitwise OR) of defects, as defined by enum
OCV_DIAGNOSTICS.
Quality indicators
A set of parameters are computed on demand (see Inspection Options) during inspection. The values
of these parameters are used to detect defects of various kinds by checking that they remain in a given
tolerance interval. If not, a diagnostic is issued.

431

C++ Reference Manual 6.7.1

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

UINT32. Number of pixels in the foreground of all characters


of this text.
UINT32. Number of foreground pixels of this text
corresponding to a foreground pixel of the characters of the
template text.
UINT32. Maximum allowed difference between the sample
and template foreground areas.
UINT32. Number of pixels in the background of the characters
of this text.
UINT32. Number of background pixels of this text
corresponding to a background pixel of the characters of the
template text.
UINT32. Maximum allowed difference between the sample
and template background areas.

Normalized gray value based


m_f32TemplateForegroundSum
m_f32SampleForegroundSum

m_f32ForegroundSumTolerance
m_f32TemplateBackgroundSum
m_f32SampleBackgroundSum

m_f32BackgroundSumTolerance

FLOAT32. Sum of the normalized gray-level values of the


foreground pixels of the characters of this text.
FLOAT32. Sum of the normalized gray-level values of the
pixels of this text corresponding to a foreground pixel of the
characters of the template text.
FLOAT32. Maximum allowed difference between the sample
and template foreground sums.
FLOAT32. Sum of the normalized gray-level values of the
background pixels of the characters of this text.
FLOAT32. Sum of the normalized gray-level values of the
pixels of this text corresponding to a background pixel of the
characters of the template text.
FLOAT32. Maximum allowed difference between the sample
and template background sums.

Normalized correlation based


m_f32Correlation
m_f32CorrelationTolerance

FLOAT32. Normalized correlation involving the template and


sample images of the characters of this text.
FLOAT32. Maximum allowed difference between the
normalized correlation and unity.

Miscellaneous
m_un32MarginWidth

Unused.

EOCVText: Text statistics


The statistics available for each text 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.

432

EasyOCV: Optical Character Verification

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

BOOL. Selection state: TRUE when selected.

433

C++ Reference Manual 6.7.1

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

global scores based on the edge pixels of the characters.


foreground and background pixel counts.
sum of the normalized foreground and background gray level
values.
normalized correlation.
global contrast of the inspected ROI.

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

form a single character comprising all blobs.


form single characters out of blobs whose bounding box
overlap.
form one character for each blob.

insufficient location score for a character.


insufficient location score for a text.
too much inking on a character.
too little inking on a character.
wrong character shape.
too much inking on a text.
too little inking on a text.
wrong text shape.
global contrast (of inspection ROI) out of range.

enum OCV_LOCATION_MODE

OCV_LOCATION_RAW
OCV_LOCATION_BINARIZED
OCV_LOCATION_GRADIENT
OCV_LOCATION_LAPLACIAN

The raw gray-level image is used to locate the characters.


The gray-level image is thresholded before location, thus
enhancing contrast between the characters and the foreground.
The gradient (edge-detection) of the image is operated on.
The Laplacian of the image is operated on.

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

EasyOCV: Optical Character Verification

4.

SAMPLE PROGRAMS
The available sample programs dedicated to the EasyOCV library are the following:
Ocv: is a simple OCV inspection application.

OcvLearn: shows how to build an OCV model with statistical learning.

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

EChecker: Flaw Detection


by Image Comparison

EChecker: Flaw Detection by Image Comparison

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

C++ Reference Manual 6.7.1

2.

CLASSES AND CLASS MEMBERS

2.1

EChecker

2.1.1

EChecker Overview

Manages a complete EChecker context.


Declare using
#include "EOCV.h"

2.1.2

EChecker Class Members

2.1.2.1

Construction

EChecker Construction
EChecker();

Constructs an uninitialized checker context.

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

pointer to the source image.

EChecker::GetSrcImage
EROIBW8* GetSrcImage();

Returns a pointer to the current source image, or NULL.

2.1.2.3

Search Tolerances

EChecker::GetTolerance X/Y
UINT32 GetToleranceX();

Returns the current horizontal search tolerance, in pixels.

440

EChecker: Flaw Detection by Image Comparison


UINT32 GetToleranceY();

Returns the current vertical search tolerance, in pixels.


EChecker::SetTolerance
void SetToleranceX(UINT32 un32ToleranceX, UINT32 un32ToleranceY);

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

horizontal search tolerance, in pixels.


vertical search tolerance, in pixels.

Allowed Degrees of Freedom

EChecker::Get/Set DegreesOfFreedom
UINT32 GetDegreesOfFreedom();

Returns the combination of possible degrees of freedom.


void SetDegreesOfFreedom(UINT32 un32Degrees);

Sets the combination of possible degrees of freedom.


Parameters
un32Degrees

2.1.2.5

some of the allowed degrees of freedom, as defined by enum


OCV_DEGREES_OF_FREEDOM.

Gray-level Normalisation

EChecker::Get/Set Normalize
enum OCV_NORMALIZATION_MODE GetNormalize();

Returns the current normalization mode, as defined by enum OCV_NORMALIZATION_MODE.


void SetNormalize(enum OCV_NORMALIZATION_MODE eNormalize);

Sets the current normalization mode.


Parameters
eNormalize

New normalization mode, as defined by enum


OCV_NORMALIZATION_MODE.

EChecker::GetAverage
FLOAT32 GetAverage();

Returns the global intensity of the mother image (valid in mode OCV_NORMALIZE_MOMENTS only).

441

C++ Reference Manual 6.7.1

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

Current mode of operation in the learning sequence, as defined by enum


OCV_LEARNING_MODES.

Remarks
A typical sequence with three reference images goes as follows:

For standard deviation estimation:


Checker.Learn(OCV_RESET); initialize
Checker.Register(); realigns and normalize 1st source image.
Checker.Learn(OCV_RMS_DEVIATION); process 1st image for deviation info
Checker.Register(); realigns and normalize 2nd source image.

442

EChecker: Flaw Detection by Image Comparison

Checker.Learn(OCV_RMS_DEVIATION); process 2nd image for deviation info


Checker.Register(); realigns and normalize 3rd source image.
Checker.Learn(OCV_RMS_DEVIATION); process 3rd image for deviation info
Checker.Learn(OCV_READY); compute the threshold images

For robust deviation estimation:


Checker.Learn(OCV_RESET); initialize
Checker.Register(); realigns and normalize 1st source image.
Checker.Learn(OCV_AVERAGE); process 1st image for average info
Checker.Register(); realigns and normalize 2nd source image.
Checker.Learn(OCV_AVERAGE); process 2nd image for average info
Checker.Register(); realigns and normalize 3rd source image.
Checker.Learn(OCV_AVERAGE); process 3rd image for average info
Checker.Register(); realigns and normalize 1st source image.
Checker.Learn(OCV_RMS_DEVIATION); process 1st image for deviation info
Checker.Register(); realigns and normalize 2nd source image.
Checker.Learn(OCV_RMS_DEVIATION); process 2nd image for deviation info
Checker.Register(); realigns and normalize 3rd source image.
Checker.Learn(OCV_RMS_DEVIATION); process 3rd image for deviation info
Checker.Learn(OCV_READY); compute the threshold images

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

Tolerance factor. Typical values vary from 3 (strict control) to 10 (loose


control).

Batch Learning

EChecker::EmptyPathNames
void EmptyPathNames();

Clears the list of file pathnames.


EChecker::AddPathName
void AddPathName(const char* pszPathName);

Adds a single file pathname.

443

C++ Reference Manual 6.7.1

Parameters
pszPathName

NULL terminated text string containing the file pathname.

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

OCV_RMS_DEVIATION or OCV_ABS_DEVIATION, depending on the


prefered method of computing the deviations.

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

Device context of the drawing window.


ROI to be drawn, as defined by enum OCV_DRAWING_MODES.
TRUE if the dragging handles must be displayed.
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).
horizontal panning factor. By default, no panning occurs.
vertical panning factor. By default, no panning occurs.

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

Current horizontal cursor position.


Current vertical cursor position.

EChecker::GetHitHandle
enum E_HANDLES GetHitHandle();

Returns the handle currently hit, as defined by enum E_HANDLES.

444

EChecker: Flaw Detection by Image Comparison

EChecker::GetHitRoi
enum ROI_HIT GetHitRoi();

Returns the ROI currently hit, as defined by enum ROI_HIT.


EChecker::Drag
void Drag(INT32 n32X, INT32 n32Y);

Moves the relevant ROI by means of its handle.


Parameters
n32X
n32Y

New horizontal cursor position.


New vertical cursor position.

2.1.2.10 Zooming and Panning


EChecker::SetZoom
void SetZoom (FLOAT32 f32Zoom);

Sets the zooming factor for use in display operations.


void SetZoom (FLOAT32 f32ZoomX, FLOAT32 f32ZoomY);

Sets the anisotropic zooming factor for use in display operations.


Parameters
f32Zoom
f32ZoomX
f32ZoomY

magnification factor for zooming in or out in the horizontal and vertical


directions.
magnification factor for zooming in or out in the horizontal direction.
magnification factor for zooming in or out in the vertical direction.

EChecker::SetPan
void SetPan (FLOAT32 f32PanX, FLOAT32 f32PanY);

Sets the panning factor for use in display operations.


Parameters
f32PanX
f32PanY

horizontal panning factor.


vertical panning factor.

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

C++ Reference Manual 6.7.1

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.

2.1.2.11 Persistent storage


EChecker::Save
void Save(const char* pszPathName);

Archives a whole EChecker context to a file.


Parameters
pszPathName

Path name of the file.

EChecker::Load
void Load(const char* pszPathName);

Reloads a whole EChecker context from a file.


Parameters
pszPathName

Path name of the file.

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

EChecker: Flaw Detection by Image Comparison

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

no gray-level normalization (contrast changes will be detected).


contrast normalization based on linear change.
contrast normalization based on non-linear change.

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

draw the pattern learning ROI(s).


draw the pattern searching ROI(s).
draw the found pattern ROI(s).
draw the inspected ROI.
draw the largest possible inspected ROI.

447

C++ Reference Manual 6.7.1

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

EasyBarCode: Bar Code Reading

EasyBarCode: Bar Code Reading

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.

Barcode (EAN 13)


The data content of the barcode (a string of characters) is encoded by means of an array of parallel
rectangular bars and spaces of varying thickness. Bars and spaces are arranged according to the rules of
a particular encoding convention, called a symbology.
Two approaches for the symbol location are supported:

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

C++ Reference Manual 6.7.1

2.

CLASSES AND CLASS MEMBERS

2.1

EBarCode Overview

All of the required functionalities are encapsulated in a single C++ objects:

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 Class Members


Construction/Destruction

EBarCode Constructor
EBarCode();

Creates an EBarCode object.


~ EBarCode Destructor
~EBarCode();

Destroys an EBarCode object.

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

pointer to the image containing the barcode.

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

EasyBarCode: Bar Code Reading

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

specified symbology, as defined by enum BRC_SYMBOLOGIES (this


symbology must have been enabled).
pointer to the character buffer to receive the decoded information. A null
byte is appended at the end.
length of the character buffer, not counting the terminating null byte.

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

pointer to the image containing the barcode.


pointer to the character buffer to receive the decoded information. A null
byte is appended at the end.
length of the character buffer, not counting the terminating null byte.

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 enabled symbologies.


EBarCode::GetNumDecodedSymbologies
UINT32 GetNumDecodedSymbologies();

Returns the number of symbologies (among the enabled ones) for which the decoding process was
successful.

453

C++ Reference Manual 6.7.1

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

index of the specified symbology (range 0 to


GetNumDecodedSymbologies -1).

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

specified symbology, as defined by enum BRC_SYMBOLOGIES (this


symbology must have been enabled).
boolean holding the encoding direction status.

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

specified symbology, as defined by enum BRC_SYMBOLOGIES (this


symbology must have been enabled).
returned bar code reading angle value.
cut angle value defining the allowed range for the bar code reading angle
( ]f32CutAngle, f32CutAngle+360] ). By default, the cut angle equals
-45.

EasyBarCode: Bar Code Reading

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

specified symbology, as defined by enum BRC_SYMBOLOGIES (this


symbology must have been enabled).
returned bar code reading rectangle.

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

enabled symbologies belonging to the group of standard symbologies, as


defined by enum BRC_SYMBOLOGIES.

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

enabled symbologies belonging to the group of additional symbologies, as


defined by enum BRC_SYMBOLOGIES.

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

C++ Reference Manual 6.7.1

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();

Returns the module value.


void SetModule(FLOAT32 f32Module);

Sets the module value.


Parameters
f32Module

456

module value.

EasyBarCode: Bar Code Reading

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();

Returns the bars thickness ratio.


void SetThicknessRatio(FLOAT32 f32ThicknessRatio);

Sets the bars thickness ratio.


Parameters
f32ThicknessRatio

bars thickness ratio.

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();

Returns the VerifyChecksum mode.


void SetVerifyChecksum(BOOL bVerifyChecksum);

Sets the VerifyChecksum mode.


Parameters
bVerifyChecksum

checksum verification mode.

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

C++ Reference Manual 6.7.1

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

rectangle of known position (center coordinates), size and rotation angle.

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

center coordinates of the rectangle at its nominal position.


nominal size X/Y of the rectangle.
nominal rotation angle of the rectangle.

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();

Returns the reading area abscissa, relative to the symbol position.


FLOAT32 GetRelativeReadingY();

Returns the reading area ordinate, relative to the symbol position.


EBarCode::SetReadingSize
void SetReadingSize(FLOAT32 f32RelativeSizeX, FLOAT32 f32RelativeSizeY);

Sets the reading area size, relative to the symbol extent.


Parameters
f32RelativeSizeX
f32RelativeSizeY

458

reading area width, relative to the symbol extent.


reading area height, relative to the symbol extent.

EasyBarCode: Bar Code Reading

EBarCode::GetRelativeReadingSize X/Y
FLOAT32 GetRelativeReadingSizeX();

Returns the reading area width, relative to the symbol extent.


FLOAT32 GetRelativeReadingSizeY();

Returns the reading area height, relative to the symbol extent.


EBarCode::Get/Set ReadingAngle
FLOAT32 GetReadingAngle();

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

reading area rotation angle, relative to the symbol skewing.

Graphical interaction

EBarCode::Draw
Void draw(HDC hDC, enum INS_DRAWING_MODES eDrawingMode= INS_DRAW_NOMINAL, BOOL
bDaughters= FALSE);

Draws the symbol bounding box.


Parameters
hDC
eDrawingMode
bDaughters

handle of the device context on which to draw.


indicates how the symbol bounding box must be displayed, as defined by
enum INS_DRAWING_MODES.
TRUE if the shapes attached to the symbol bounding box are to be
displayed as well.

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

C++ Reference Manual 6.7.1

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

cursor current coordinates.

EBarCode::SetZoom
void SetZoom(FLOAT32 f32ZoomX= 1, FLOAT32 f32ZoomY= 0);

Sets the horizontal and vertical zooming factors for drawing operations.
Parameters
f32ZoomX
f32ZoomY

horizontal zooming factor. By default, true scale is used.


vertical zooming factor. If set to 0, the default value, the horizontal
zooming factor is used instead, so as to provide isotropic zooming.

EBarCode::GetZoom X/Y
FLOAT32 GetZoomX();
FLOAT32 GetZoomY();

Returns the current horizontal/vertical zooming factor for drawing operations.


EBarCode::SetPan
void SetPan(FLOAT32 f32PanX= 0, FLOAT32 f32PanY= 0);

Sets the horizontal and vertical panning factors for drawing operations.
Parameters
f32PanX
f32PanY

horizontal panning factor. By default, no panning occurs.


vertical panning factor. By default, no panning occurs.

EBarCode::GetPan X/Y
FLOAT32 GetPanX();
FLOAT32 GetPanY();

Returns the current horizontal/vertical panning factor for drawing operations.

460

EasyBarCode: Bar Code Reading

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

Binary Code symbology.


Code ABC Anker symbology.
Code BC 412 symbology.
Code 11 symbology.
Code 25 DataLogic symbology.
Code 25 Matrix symbology.
Code 25 IATA symbology.
Code 25 Industry symbology.
Code 25 Compressed symbology.
Code 25 Inverted symbology.
Code 32 symbology.
Code 39 Extended symbology.
Code 39 Reduced symbology.
Code 93 symbology.
Code 93 Extended symbology.
Code BCD Matrix symbology.
Code CIP symbology.
Code STK symbology.
EAN 8 symbology.
IBM Delta Distance A symbology.
Plessey symbology.
Telepen symbology.
gathers all the symbologies belonging to the additional group.
undefined symbology.

461

C++ Reference Manual 6.7.1

4.

SAMPLE PROGRAMS
The available sample program dedicated to the EasyBarCode library is the following:

BrcReading: automatically performs a bar code reading.

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

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.

Data Matrix code (ECC 200, 26 x 26 cells)

Data Matrix code (ECC 200, 18 x 18 cells)

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

C++ Reference Manual 6.7.1

2.

EASYMATRIXCODE: WHAT'S NEW?

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:

Improvements in the underlying reading engine, with a better handling of:


o small sized Matrix Codes;
o non uniform contrast;
o poor contrast;
o over exposed images;
o textured images (when the underlying substrate is not uniform);
o blurred Data Matrix codes (because of blurred image or blurred printing);
o anisotropic scaling (non uniform image deformation);
o noisy images;
o skewed images
o non-square cells

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

Improvements in the API:


o exceptions are now used, in order to ease error handling;
o C++ namespaces and new-style enumerations are used so that complex "context
prefixes" can be avoided once for all with "using" directives.
VERY IMPORTANT NOTE
There is no degradation of performance for Data Matrix codes that were already successfully read by
the previous library. The more complex algorithms will be used only if needed. So, it's a win-win
situation for the customer who uses the new version.

466

EasyMatrixCode: Data Matrix Code Reading

3.

CLASSES

3.1

EasyMatrixCode: Introduction to Classes

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:

MatrixCode, in the Euresys.eVision package,

SearchParamsType, in the Euresys.eVision.MatrixCodeReader package, and

MatrixCodeReader, in the Euresys.eVision package.


A MatrixCode embeds all the information regarding a single Data Matrix code: its decoded string, its
grading, its errors
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 in and has an interface of its own.
The SearchParamsType object needs to be used only if you wish to modify what has to be learnt
(logical size, contrast, ...).
Declare using
#include "EMatrixCode.h"

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

C++ Reference Manual 6.7.1

Declare using
#include "EMatrixCode.h"

3.2.2

MatrixCode Properties and Methods

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]

This retrieves the first corner in variable p.

468

EasyMatrixCode: Data Matrix Code Reading

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

C++ Reference Manual 6.7.1

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.

Print quality grading


MatrixCode::Contrast property
FLOAT32. This is the measured symbol contrast 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::ContrastGrade property
INT32. This is the measured symbol contrast 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::PrintGrowth property
FLOAT32. This is the normalized measured print growth value, as defined by the AIM standard, after a
read operation, provided that the print quality assessment has been enabled.
The normalization is computed from the Minimum/Maximum/Nominal PrintGrowth properties in the
EasyMatrixCode Reader.
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::MeasuredPrintGrowth property
FLOAT32. This is the raw, un-normalized print quality parameter (1.0 to 0 scale), after a read
operation, provided that the print quality assessment has been enabled.

470

EasyMatrixCode: Data Matrix Code Reading

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

C++ Reference Manual 6.7.1

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

EasyMatrixCode: Data Matrix Code Reading

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.

MatrixCode assignment operator


MatrixCode& MatrixCode::Operator=(const MatrixCode& MatrixCode);

Copies all the parameters of the current MatrixCode object into another MatrixCode object.
Parameters
MatrixCode

MatrixCode object to be copied.

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

handle of the device context on which to draw.


horizontal zooming factor. A value greater than 1 means zoom in. By
default, true scale is used.
vertical zooming factor. A value greater than 1 means zoom in. If set to 0,
the default value, the horizontal zooming factor is used instead, so as to
provide isotropic zooming.
horizontal panning factor, in pixels. By default, no panning occurs.
vertical panning factor, in pixels. By default, no panning occurs.

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

handle of the device context on which to draw.


horizontal zooming factor. A value greater than 1 means zoom in. By
default, true scale is used.
vertical zooming factor. A value greater than 1 means zoom in. If set to 0,
the default value, the horizontal zooming factor is used instead, so as to
provide isotropic zooming.
horizontal panning factor, in pixels. By default, no panning occurs.
vertical panning factor, in pixels. By default, no panning occurs.
473

C++ Reference Manual 6.7.1

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

EasyMatrixCode: Data Matrix Code Reading

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

MatrixCodeReader Properties and Methods

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

C++ Reference Manual 6.7.1

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

EasyMatrixCode: Data Matrix Code Reading

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

ROI in which the Data Matrix has to be found.

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

ROI in which the Data Matrix has to be found.

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

C++ Reference Manual 6.7.1

The decoding results can be found in the returned MatrixCode object.


Parameters
bw8Roi

ROI in which the Data Matrix has to be found.

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

EasyMatrixCode: Data Matrix Code Reading

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.

void MatrixCodeReader::Save(FILE* file);

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

C++ Reference Manual 6.7.1

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

EasyMatrixCode: Data Matrix Code Reading

4.

ENUMERATION CONSTANTS

4.1

enum LearnParams::Type

Represents the kind of parameter that can be learnt.


This enumeration is in the Euresys::eVision::EasyMatrixCode package.
LearnParams::LogicalSize
LearnParams::ContrastType
LearnParams::Flipping
LearnParams::Family

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

Represents a data matrix code logical size.


This enumeration is in the Euresys::eVision::EasyMatrixCode package.
_9x9, _11x11, _13x13,
_15x15, _17x17, _19x19,
_21x21, _23x23, _25x25,
_27x27, _29x29, _31x31,
_33x33, _35x35, _37x37,
_39x39, _41x41, _43x43,
_45x45, _47x47, _49x49

ECC 000-140 squares.

_10x10, _12x12, _14x14,


_16x16, _18x18, _20x20,
_22x22, _24x24, _26x26,
_32x32, _36x36, _40x40,
_44x44, _48x48, _52x52,
_64x64, _72x72, _80x80,
_88x88, _96x96, _104x104,
_120x120, _132x132,
_144x144

ECC 200 squares.

_8x18, _8x32, _12x26,


_12x36, _16x36, _16x48

ECC 200 rectangles.

Unknown

to be determined at Read or Learn time.

4.3

enum Contrast::Type

This enumeration is in the Euresys::eVision::EasyMatrixCode package.


Contrast::BlackOnWhite
Contrast::WhiteOnBlack
Contrast::Unknown

dark cells on a light background.


light cells on a dark background.
to be determined at Read or Learn time.

481

C++ Reference Manual 6.7.1

4.4

enum Flipping::Type

This enumeration is in the Euresys::eVision::EasyMatrixCode package.


Flipping::Yes
Flipping::No
Flipping::Unknown

4.5

image is flipped.
image is not flipped.
to be determined at Read or Learn time.

enum Family::Type

This enumeration is in the Euresys::eVision::EasyMatrixCode package.


Family::ECC000
ECC 000, no error recovery capability by convolutional coding.
Family::ECC050
ECC 050, 2.8% error recovery capability by convolutional coding.
Family::ECC080
ECC 080, 5.5% error recovery capability by convolutional coding.
Family::ECC100
ECC 100, 12.6% error recovery capability by convolutional coding.
Family::ECC140
ECC 140, 25% error recovery capability by convolutional coding.
Family::ECC200
ECC 200, 20% error recovery capability.
Family::Unknown
undefined so far.

4.6

enum Handles::Type

This enumeration is in the Euresys::eVision::EasyMatrixCode package.


Handles::NoHandle
Handles::Corner00
Handles::Corner10
Handles::Corner11
Handles::Corner01
Handles::AddCorner = NoHandle
Handles::Unknown

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.

EasyMatrixCode: Data Matrix Code Reading

5.

SAMPLE PROGRAMS
The available sample program dedicated to the EasyMatrixCode library is the following:

MxcLearnAndRead: automatically performs data matrix code learning.

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

EasyBGA: BGA Inspection

EasyBGA: BGA Inspection

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

C++ Reference Manual 6.7.1

2.

CLASSES AND CLASS MEMBERS

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

EBGA Class Members

2.1.2.1

Construction/Destruction

EBGA Construction
EBGA();

Constructs an uninitialized EBGA object.

486

EasyBGA: BGA Inspection

Remark
Be aware that you have to call AddArray at least once to get a valid BGA device.
EBGA Destruction
~EBGA();

Destroys an EBGA object.

2.1.2.2

Measurement units

EBGA::Get/Set Unit
enum E_MEASUREMENT_UNITS GetUnit();

Returns the current measurement unit, as defined by enum E_MEASUREMENT_UNITS.


void SetUnit(enum E_MEASUREMENT_UNITS eUnit);

Sets the current measurement unit.


Parameters
eUnit

2.1.2.3

new measurement unit, as defined by enum E_MEASUREMENT_UNITS.


Usually one of E_UNIT_MM or E_UNIT_MIL. The measurement unit
applies to the whole model.

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

pointer to the source image.

Tolerances
EBGA::Get/Set BallDiameterTolerance
FLOAT32 GetBallDiameterTolerance();

Returns the allowed tolerance on the ball diameters, in calibrated units.


void SetBallDiameterTolerance(FLOAT32 f32Tolerance);

Sets the allowed tolerance on the ball diameters, in calibrated units.

487

C++ Reference Manual 6.7.1

Parameters
f32Tolerance

tolerance in calibrated units.

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 circularity indicator.


void SetBallDiameterTolerance(FLOAT32 f32Tolerance);

Sets the allowed tolerance on the ball circularity indicator.


Parameters
f32Tolerance

tolerance on the ball circularity indicator.

EBGA::GetBallOffset X/Y Tolerance


FLOAT32 GetBallOffsetXTolerance();
FLOAT32 GetBallOffsetYTolerance();

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

tolerance on the ball center horizontal position.


tolerance on the ball center vertical position. If not specified, same as X
Tolerance.

EBGA::GetBallPitch X/Y Tolerance


FLOAT32 GetBallPitchXTolerance();
FLOAT32 GetBallPitchYTolerance();

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

EasyBGA: BGA Inspection

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

tolerance on the ball horizontal pitches.


tolerance on the ball vertical pitches. If not specified, the Y tolerance gets
the same value as the X tolerance.

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

Minimum doughnutness value.

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

C++ Reference Manual 6.7.1

Parameters
f32BallQualityFactorTolerance

Minimum gray level quality factor tolerance.

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();

Returns the ball contrast.


void SetWhiteOnBlack(BOOL bContrast);

Sets the ball contrast.


By default (TRUE value), white (bright metal) on black (dark substrate) is assumed. Reverse contrast
(FALSE value) can be handled.
Parameters
bContrast

new ball contrast.

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

Threshold mode or value. If not specified, the minimum residue method is


used to determine the threshold value.

EasyBGA: BGA Inspection

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

Maximum tolerated area of the blobs in pixels.

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

Minimum tolerated area of the blobs in pixels.

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();

Returns the current mode.


void SetSingulatedComponents(BOOL bSingulated);

Sets the new mode.


Parameters
bSingulated

new mode. TRUE indicates that the components are singluated.

EBGA::Get/Set MaxMissingBalls
UINT32 GetMaxMissingBalls();

Returns the maximum number of missing balls to be allowed.

491

C++ Reference Manual 6.7.1


void SetMaxMissingBalls(UINT32 un32Balls);

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

maximum number of missing balls.

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

Relative diameter value of the annular ROI outer edge.

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

Relative diameter value of the annular ROI inner edge.

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;

Returns the value of the PackCloseBlobs parameter.


492

EasyBGA: BGA Inspection


void SetPackCloseBlobs(BOOL bPackCloseBlobs);

Sets the PackCloseBlobs parameter.


The TRUE value means that neighbouring blobs are merged together to form a unique ball (first
method) and the FALSE value means that only connected blobs are considered to form a ball (second
method).
So, when a ball is split in several parts, it will be treated as a unique ball if the first method is used
though it will be erroneously considered as several balls with the second method.
But, if clutter is present close to a well-formed ball, the first method will include erroneously this clutter
into the ball.
Parameters
bPackCloseBlobs

close blobs management parameter. TRUE if close blobs have to be


merged to form a unique ball, FALSE otherwise.

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();

Returns the value of the 'MeasureAssessment' parameter.


void SetMeasureAssessment(enum BGA_MEASURE_ASSESSMENT eMeasureAssessment);

Sets the 'MeasureAssessment' parameter.


This parameter reflects the method used for ball measurement. Three modes exist:

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

Measure assessment mode defined by enum


BGA_MEASURE_ASSESSMENT.

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

C++ Reference Manual 6.7.1

EBGA::Get/Set CircularityAssessment
enum BGA_CIRCULARITY_ASSESSMENT GetCircularityAssessment();

Returns the value of the 'CircularityAssessment' parameter.


void SetCircularityAssessment(enum BGA_CIRCULARITY_ASSESSMENT
eCircularityAssessment);

Sets the 'CircularityAssessment' parameter.


This parameter reflects the method used for ball circularity measurement. Two modes exist:

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

Circularity assessment mode defined by enum


BGA_CIRCULARITY_ASSESSMENT.

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 Fine MeasureAssessment mode, the Basic CircularityAssessment mode is considered as


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();

Returns the value of the FineBallMeasure parameter.


void SetFineBallMeasure(BOOL bFineBallMeasure);

Sets the FineBallMeasure parameter.


This parameter reflects the method used for ball measurement. The TRUE value means that the new
improved method is used and the FALSE value means that the former method is used.
Parameters
bFineBallMeasure

TRUE means that the new improved method is used.

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

EasyBGA: BGA Inspection

EBGA::Get/Set FineCircularity
These methods are obsolete and should not be used anymore. Use EBGA::Get/Set
CircularityAssessment methods instead.
BOOL GetFineCircularity();

Returns the value of the FineCircularity parameter.


void SetFineCircularity(BOOL bFineCircularity);

Sets the FineCircularity parameter.


This parameter reflects the method used for ball circularity measurement. The TRUE value means that
the new improved method is used and the FALSE value means that the former method is used.
Parameters
bFineCircularity

TRUE means that the new improved method is used.

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

Quality indicators as a combination of enum


BGA_QUALITY_INDICATORS.

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

C++ Reference Manual 6.7.1

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

Quality indicators as a combination of enum


BGA_QUALITY_INDICATORS.

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);

Returns TRUE if the specified diagnostic is turned on.

496

EasyBGA: BGA Inspection

Parameters
eDiagnostic

diagnostic identifier as defined by enum BGA_DIAGNOSTICS.

EBGA::GetNumBallsFound
UINT32 GetNumBallsFound();

Returns the total number of balls found in the field of view.


EBGA::GetNumMissingBalls
UINT32 GetNumMissingBalls();

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();

This property contains references to the problematic balls.

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

C++ Reference Manual 6.7.1

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

EasyBGA: BGA Inspection

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

C++ Reference Manual 6.7.1

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

EasyBGA: BGA Inspection

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

C++ Reference Manual 6.7.1

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

EasyBGA: BGA Inspection

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);

Resets the statistics for each ball before a batch is processed.


Parameters
bEnable

TRUE if batch statistics should be computed. This is the default value.

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);

Draws the component(s) package(s) as located during inspection.


Parameters
hDC

handle of the device context on which to draw.

EBGA::DrawClutter
void DrawClutter(HDC hDC);

Draws the clutter objects found during inspection.


Parameters
hDC

handle of the device context on which to draw.

EBGA::DrawExtraBalls
void DrawExtraBalls(HDC hDC);

Draws the extra balls found during inspection.


Parameters
hDC

handle of the device context on which to draw.

503

C++ Reference Manual 6.7.1

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();

Evenly arranges the balls in the current array.

Persistent storage
EBGA::Load
void Load(const CHAR* pszPathName, BOOL bRecurse= TRUE);

Loads a model from a file.


Parameters
pszPathName
bRecurse

full path and filename of the source file.


reserved.

EBGA::Save
void Save(const CHAR* pszPathName, BOOL bRecurse= TRUE);

Saves a model to a file.


Parameters
pszPathName
bRecurse

full path and filename of the file.


reserved.

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

EasyBGA: BGA Inspection

Parameters
hDC
eDrawingMode
bRecurse

handle of the device context on which to draw.


drawing mode, as defined by enum INS_DRAWING_MODES.
reserved.

EBGA::DrawArrayLabels
void DrawArrayLabels(HDC hDC);

Displays the label of each column and row of balls.


Parameters
hDC

handle of the device context on which to draw.

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

C++ Reference Manual 6.7.1

Parameters
eBehaviour
bValue

filter type as defined by enum INS_SHAPE_BEHAVIOR, in this case


always equal to INS_PASSED.
boolean value that specifies whether normal inspected balls (TRUE) or
defective inspected balls (FALSE) are to be drawn.

EBGA::DisableBehaviorFilter
void DisableBehaviorFilter(enum INS_SHAPE_BEHAVIOR eBehavior);

Cancels the filter applied by EnableBehaviorFilter function.


Parameters
eBehaviour

filter type to cancel as defined by enum INS_SHAPE_BEHAVIOR; in this


case, could be INS_PASSED.

Package
EBGA::GetPackage Width/Height
FLOAT32 GetPackageWidth();

Returns the package width, in calibrated units.


FLOAT32 GetPackageHeight();

Returns the package height, in calibrated units.


EBGA::SetPackageSize
void SetPackageSize(FLOAT32 f32PackageWidth, FLOAT32 f32PackageHeight= 0);

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();

Returns the user-defined textual identification of the package.


void SetPackageName(const char* pszName);

Sets a user-defined textual identification of the package.


Parameters
pszName

506

package name.

EasyBGA: BGA Inspection

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

nominal ball diameter.

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

column index of the selected ball (value between 0 and NumCols-1).


row index of the selected ball (value between 0 and NumRows-1).

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();

Returns the current array index.


void SetCurrentArray(UINT32 un32Index);

Sets the current array index.


Parameters
un32Index

index of the array (value between 0 and NumArrays-1).

EBGA::GetArray
EBGAArray* GetArray();

Returns a pointer to the current array of the current component.

507

C++ Reference Manual 6.7.1

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

physical width of the array in calibrated units


(Array Width = [Num Cols 1] * pitch X).
physical height of the array in calibrated units
(Array Height = [Num Rows 1] * pitch Y).
If not specified, same as Array Width.
logical width of the array.
logical height of the array. If not specified, same as logical width.
center coordinates of the array.
TRUE if balls of the arrays are staggered. Default value is FALSE.

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();

Returns the number of balls in the current array.

Array Placement
EBGA::GetArrayNum Cols/Rows
UINT32 GetArrayNumCols();

Returns the current array column count.


UINT32 GetArrayNumRows();

Returns the current array row count.


EBGA::SetArrayLogicalSize
void SetArrayLogicalSize(UINT32 un32NumCols= 10, UINT32 un32NumRows= 0, BOOL
bStaggered= FALSE);

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

EasyBGA: BGA Inspection

Parameters
un32NumCols
un32NumRows
bStaggered

current array column count.


current array row count. If not specified, same as Num Cols.
TRUE if balls of the arrays are staggered. Default value is FALSE.

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

horizontal size of the array.


vertical size of the array. If not specified, same as width.

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

horizontal pitch of the array.


vertical pitch of the array. If not specified, same as horizontal pitch.

509

C++ Reference Manual 6.7.1

EBGA::GetArrayCenter X/Y
FLOAT32 GetArrayCenterX();

Returns the current array center abscissa, in calibrated units.


FLOAT32 GetArrayCenterY();

Returns the current array center ordinate, in calibrated units.


EBGA::SetArrayCenter
void SetArrayCenter(FLOAT32 f32CenterX= 0, FLOAT32 f32CenterY= 0);

Sets the current array center coordinates, in calibrated units. By default, the array is centered on the
component package.
Parameters
f32CenterX
f32CenterY

abscissa of the center.


ordinate of the center.

Ball Presence Edition


EBGA::Get/Set Symmetry
enum BGA_SYMMETRY GetSymmetry();

Returns the current symmetry mode, as defined by enum BGA_SYMMETRY.


void SetSymmetry(enum BGA_SYMMETRY eSymmetry);

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

new symmetry mode, as defined by enum BGA_SYMMETRY.

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

EasyBGA: BGA Inspection

Parameters
n32OrgX
n32OrgY
n32EndX
n32EndY

top left corner abscissa of the bounding box


top left corner ordinate of the bounding box
bottom right corner abscissa of the bounding box
bottom right corner ordinate of the bounding box

Number of components
EBGA::GetNumComponents
UINT32 GetNumComponents();

Returns the number of components in the field of view.

Components regular placement


EBGA::SetNumComponents
void SetNumComponents(UINT32 un32NumCols, UINT32 un32NumRows);

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 a pointer to the current component.


EBGA::GetComponentPitch X/Y
FLOAT32 GetComponentPitchX();

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

C++ Reference Manual 6.7.1


FLOAT32 GetComponentPitchY();

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

horizontal pitch between two neighboring components, expressed in


calibrated units.
vertical pitch between two neighboring components, expressed in
calibrated units. If not specified, same as Pitch X.

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.

Components arbitrary placement


EBGA::SetNumComponents
void SetNumComponents(UINT32 un32Num);

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

index (value between 0 and NumComponents-1, inclusive)

EBGA::GetCurrentComponent
UNIT32 GetCurrentComponent();

Returns the index of the current component in the components list.

512

EasyBGA: BGA Inspection

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

component center abscissa.


component center ordinate.

Auto-calibration

EBGA::Get/Set AutoCalibrateBalls
BOOL GetAutoCalibrateBalls();

Returns the auto-calibration mode for the balls.


void SetAutoCalibrateBalls(BOOL bAutoCalibrate);

Sets the auto-calibration mode for the balls.


Parameters
bAutoCalibrate

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();

Returns the auto-calibration mode for the field of view.


void SetAutoCalibrateWorld(BOOL bAutoCalibrate);

Sets the auto-calibration mode for the field of view.

513

C++ Reference Manual 6.7.1

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

EBGABall Class Members

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);

Returns TRUE if the specified diagnostic is turned on.

514

EasyBGA: BGA Inspection

Parameters
eDiagnostic

2.2.2.2

diagnostic identifier as defined by enum BGA_DIAGNOSTICS.

Ball Measurement

EBGABall::GetMeasuredOffset X/Y
FLOAT32 GetMeasuredOffsetX();

Returns the horizontal offset of the current ball, in calibrated units.


FLOAT32 GetMeasuredOffsetY();

Returns the vertical offset of the current ball, 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::GetMeasuredDiameter
FLOAT32 GetMeasuredDiameter();

Returns the diameter of the current ball, 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.
Ball diameter calibration, on the other hand, is handled by object EBGA (see method Get/Set
AutoCalibrateBalls).
EBGABall::GetMeasuredPitch X/Y
FLOAT32 GetMeasuredPitchX();

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

C++ Reference Manual 6.7.1

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

EasyBGA: BGA Inspection

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

C++ Reference Manual 6.7.1

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

EasyBGA: BGA Inspection

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();

Returns a pointer to the EBGAComponent to which the ball belongs.


EBGABall::GetComponentIndex
UINT32 EBGABall::GetComponentIndex();

Returns the index of the EBGAComponent to which the ball belongs.


EBGABall::GetArray
EBGAArray* EBGABall::GetArray();

Returns a pointer to the EBGAArray to which the ball belongs.


EBGABall::GetArrayIndex
UINT32 EBGABall::GetArrayIndex();

Returns the index of the EBGAArray to which the ball belongs.

519

C++ Reference Manual 6.7.1

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

EBGAArray Class Members

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

Boolean indicating whether the ball placement is staggered (TRUE) or not


(FALSE, default value).

EasyBGA: BGA Inspection

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

Boolean indicating whether the row numbering is inverted (TRUE) or not


(FALSE, default value).

Remark
To display the array label, use EBGA::DrawArrayLabels.
521

C++ Reference Manual 6.7.1

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

Boolean indicating whether the column numbering is inverted (TRUE) or


not (FALSE, default value).

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

EasyBGA: BGA Inspection

2.4.2

EBGAComponent Class Members

2.4.2.1

Component model

EBGAComponent::GetNumBalls
UINT32 GetNumBalls();

Returns the number of balls on the device model.


EBGAComponent::SetCenter
void SetCenter(FLOAT32 f32CenterX, FLOAT32 f32CenterY);

Sets the center coordinates of the component, in calibrated units, with respect to a common origin.
Parameters
f32CenterX
f32CenterY

2.4.2.2

component center abscissa.


component center ordinate.

Diagnostics

EBGAComponent::GetNumBallsFound
UINT32 GetNumBallsFound();

Returns the number of balls found in the component.


EBGAComponent::GetNumMissingBalls
UINT32 GetNumMissingBalls();

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);

Returns TRUE if the specified diagnostic is turned on.


Parameters
eDiagnostic

diagnostic identifier as defined by enum BGA_DIAGNOSTICS.

523

C++ Reference Manual 6.7.1

2.4.2.3

Statistics

EBGAComponent::GetMinimumOffset
FLOAT32 GetMinimumOffset();

Returns the minimum ball offset for the component.


EBGAComponent::GetMaximumOffset
FLOAT32 GetMaximumOffset();

Returns the maximum ball offset for the component.


EBGAComponent::GetAverageOffset
FLOAT32 GetAverageOffset();

Returns the average ball offset for the component.


EBGAComponent::GetDeviationOffset
FLOAT32 GetDeviationOffset();

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

EasyBGA: BGA Inspection

EBGAComponent::GetMinimumDiameter
FLOAT32 GetMinimumDiameter();

Returns the minimum ball diameter for the component.


EBGAComponent::GetMaximumDiameter
FLOAT32 GetMaximumDiameter();

Returns the maximum ball diameter for the component.


EBGAComponent::GetAverageDiameter
FLOAT32 GetAverageDiameter();

Returns the average ball diameter for the component.


EBGAComponent::GetDeviationDiameter
FLOAT32 GetDeviationDiameter();

Returns the standard deviation of the ball diameters for the component.
EBGAComponent::GetMinimumCircularity
FLOAT32 GetMinimumCircularity();

Returns the minimum circularity value of the component balls.


EBGAComponent::GetMaximumCircularity
FLOAT32 GetMaximumCircularity();

Returns the maximum circularity value of the component balls.


EBGAComponent::GetAverageCircularity
FLOAT32 GetAverageCircularity();

Returns the average circularity value of the component balls.


EBGAComponent::GetDeviationCircularity
FLOAT32 GetDeviationCircularity();

Returns the standard deviation of the circularity value of the component balls.
EBGAComponent::GetMinimumDoughnutness
FLOAT32 GetMinimumDoughnutness();

Returns the minimum doughnutness value of the component balls.

525

C++ Reference Manual 6.7.1

EBGAComponent::GetMaximumDoughnutness
FLOAT32 GetMaximumDoughnutness();

Returns the maximum doughnutness value of the component balls.


EBGAComponent::GetAverageDoughnutness
FLOAT32 GetAverageDoughnutness();

Returns the average doughnutness value of the component balls.


EBGAComponent::GetDeviationDoughnutness
FLOAT32 GetDeviationDoughnutness();

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

EasyBGA: BGA Inspection

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

extraneous objects have been found far from a ball


site.
not all balls have been found.
extra balls have been found.
some ball is significantly offset.
some ball is too close to or far from one of its
neighbors.
some ball has a significant wrong diameter.
some ball is significantly far from being circular.
some ball is significantly too dark or too light.
some ball has significantly not uniform gray level
values.

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

Draws the nominal point location or model fitting gauge.


Draws the located point or the fitted model.

527

C++ Reference Manual 6.7.1

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

Basic measurement; this mode is now obsolete but is


kept for backward compatibility purpose. It corresponds
to the old FineBallMeasure parameter set to FALSE.
Refined measurement; useful when limited clutter is
present near balls. It corresponds to the old
FineBallMeasure parameter set to TRUE.
Robust measurement; this mode will be able to
correctly discriminate balls from their close
environment (clutter, pad) and to provide more
accurate measurement and diagnostics.

enum BGA_CIRCULARITY_ASSESSMENT

BGA_BASIC_CIRCULARITY_ASSESSMENT
BGA_FINE_CIRCULARITY_ASSESSMENT

528

Draws the sampled segments along the model.


Draws the sampled segment specified by
MeasureSample.
Draws the sampled points along the model.
Draws the sampled point specified by MeasureSample.
Draws the skipped sampled points in addition to the
non-skipped points.
Draws the invalid sampled points along the model.

Basic circularity measurement. It corresponds to the


old FineCircularity parameter set to FALSE.
Refined circularity measurement. It corresponds to the
old FineCircularity parameter set to TRUE. This mode
is only available when
BGA_FINE_MEASURE_ASSESSMENT is selected
(see EBGA::Get/Set MeasureAssessment).

EasyBGA: BGA Inspection

4.

SAMPLE PROGRAMS
The available sample programs dedicated to the EasyBGA library are the following:

BgaDeskew: realigns a BGA component before inspecting it.

BgaEditor: lets the user create or modify a BGA model file.

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

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

C++ Reference Manual 6.7.1

2.

EWORLDSHAPE CLASS MEMBERS

2.1

Calibration

EWorldShape::Calibrate
void EWorldShape::Calibrate(enum INS_CALIBRATION_MODES eCalibration);

Performs a calibration according to the specified combination of calibration modes.


Parameters
eCalibration

calibration mode as defined by a combination of values from enum


INS_CALIBRATION_MODES.

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

boolean indicating whether empirical calibration modes


(INS_CALIBRATION_QUADRATIC and INS_CALIBRATION_BILINEAR)
should be considered when determining the best calibration modes.

EWorldShape: Field of View Calibration

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();

Returns the current grid points maximum variation threshold.


void EWorldShape::SetGridPointsMaxVariationThreshold(FLOAT32 f32Value);

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

new grid points maximum variation threshold.

EWorldShape::Get/Set GridPointsMeanVariationThreshold
FLOAT32 EWorldShape::GetGridPointsMeanVariationThreshold();

Returns the current grid points mean variation threshold.


void EWorldShape::SetGridPointsMeanVariationThreshold(FLOAT32 f32Value);

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

new grid points mean variation threshold.

535

C++ Reference Manual 6.7.1

2.2

Grid calibration

EWorldShape::AutoCalibrateDotGrid
UINT32 EWorldShape::AutoCalibrateDotGrid(EROIBW8* pSrc, FLOAT32 f32RowPitch, FLOAT32
f32ColPitch, BOOL bTestEmpiricalModes = FALSE);

Performs an automatic calibration based on a dot grid image.


Returns the best calibration mode for the current dot grid.
Parameters
pSrc
f32Row/Col Pitch
bTestEmpiricalModes

pointer to the source image/ROI.


actual pitches of the grid, i.e. distances between vertical and horizontal
rows of the grid.
boolean indicating whether empirical calibration modes
(INS_CALIBRATION_QUADRATIC and INS_CALIBRATION_BILINEAR)
should be considered when determining the best calibration modes.
Default value is 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

Sensor point coordinates.

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

EWorldShape: Field of View Calibration

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();

Resets the landmark specification sequence.


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.
EWorldShape::AddLandmark
void EWorldShape::AddLandmark(EPoint SensorPoint, EPoint WorldPoint);

Adds a new pair of points coordinates (in Sensor and World spaces) to the set of landmarks used for
calibration.
Parameters
SensorPoint
WorldPoint

Sensor point coordinates.


Corresponding World point coordinates.

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

C++ Reference Manual 6.7.1

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

boolean indicating whether empirical calibration modes


(INS_CALIBRATION_QUADRATIC and INS_CALIBRATION_BILINEAR)
should be considered when determining the best calibration modes.
Default value is FALSE.

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

logical size of the field of view, i.e. image size, in pixels.


physical size of the field of view. By default (argument omitted), the pixels
are square.
position of the reference frame center in the image. By default (argument
omitted), the image center.
skew angle, i.e. angle between the horizontal axis and the image edge, in
the current angle unit. By default, the axis are in upright position.
rotation angles to bring the optical axis perpendicular to the image plane.
By default (argument omitted), no perspective effect is assumed.
relative importance of the perspective effect. By default, no perspective
effect is assumed, as if the lens was telecentric.
relative importance of the lens radial distortion. Positive for barrel,
negative for cushion. By default (argument omitted), no optical distortion is
assumed.

EWorldShape: Field of View Calibration

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

full image logical sizes, in pixels.

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.

Pixels having non square aspect ratio


Parameters
f32Width
f32Height

full image physical width, in length units.


full image physical height, in length units. If not specified, same as
physical width.

539

C++ Reference Manual 6.7.1

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.

Pixels having non square aspect ratio


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:: SetResolution
void EWorldShape::SetResolution(FLOAT32 f32XResolution, FLOAT32 f32YResolution= 0);

Sets the sensor resolution in pixels per unit in both directions. By default, the pixels are square.
Parameters
f32XResolution
f32YResolution

horizontal resolution in pixels per units


vertical resolution in pixels per units. If not specified, same as horizontal
resolution.

EWorldShape::Get X/Y Resolution


FLOAT32 EWorldShape::GetXResolution();

Returns the horizontal sensor resolution in pixels per unit.


FLOAT32 EWorldShape::GetYResolution();

Returns the vertical sensor resolution in pixels per unit.

540

EWorldShape: Field of View Calibration

EWorldShape::GetScale
FLOAT32 EWorldShape::GetScale();

Returns the horizontal sensor resolution in pixels per unit.


EWorldShape::GetRatio
FLOAT32 EWorldShape::GetRatio();

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

abscissa/ordinate of the origin point on the Sensor.

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

C++ Reference Manual 6.7.1

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

EWorldShape: Field of View Calibration

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

Calibration mode as defined by a combination of values from enum


INS_CALIBRATION_MODES.

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.

Tilt X Angle and Tilt Y Angle


Parameters
f32 X/Y Angle

Tilt X/Y angle.

EWorldShape::GetTilt X/Y Angle


FLOAT32 EWorldShape::GetTiltXAngle();
FLOAT32 EWorldShape::GetTiltYAngle();

543

C++ Reference Manual 6.7.1

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.

Tilt X Angle and Tilt Y Angle


EWorldShape::Get/Set DistortionStrength
FLOAT32 EWorldShape::GetDistortionStrength( );

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( );

Returns the radial distortion coefficient of the second order.


void EWorldShape::SetDistortion(FLOAT32 f32DistortionStrength, FLOAT32
f32DistortionStrength2 = 0);

Sets the radial distortion parameters.


Parameters
f32DistortionStrength
f32DistortionStrength2

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).

EWorldShape: Field of View Calibration

Positive Distortion and Negative Distortion


EWorldShape::Get/Set PerspectiveStrength
FLOAT32 EWorldShape::GetPerspectiveStrength( );

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

C++ Reference Manual 6.7.1

Weak Perspective and Strong Perspective


Parameters
f32TiltX/Y

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.

EWorldShape: Field of View Calibration

2.7

Unwarping

EWorldShape::SetupUnwarp
void EWorldShape::SetupUnwarp (EImageSubPixel64* pLookupTable, EROIBW8* pSrcImage,
BOOL bInterpolate);

Prepares a lookup table for fast image unwarping.


Parameters
pLookupTable
pSrcImage
bInterpolate

pointer to the lookup table.


pointer to the source image/ROI.
interpolation mode. Default value is FALSE.

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

pointer to the lookup table.


pointer to the source image/ROI.
pointer to the destination unwarped image.
interpolation mode. Default value is FALSE.

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);

Loads the calibration parameters and the possibly attached shapes.


Parameters
pszPathName
bDaughters

full path and filename of the file.


flag indicating whether the possibly attached shapes have to be loaded as
well, default value is FALSE.

547

C++ Reference Manual 6.7.1

EWorldShape::Save
void EWorldShape::Save(const char* pszPathName, BOOL bDaughters= FALSE);

Save the calibration parameters and the possibly attached shapes.


Parameters
pszPathName
bDaughters

2.9

full path and filename of the file.


flag indicating whether the possibly attached shapes have to be saved as
well, default value is FALSE.

Graphical interaction

EWorldShape::Draw
Void EWorldShape::Draw(HDC hDC, enum INS_DRAWING_MODES eDrawingModes =
INS_DRAW_NOMINAL, BOOL bDaughter = TRUE);

Draws the world coordinate axis.


Parameters
HDC
eDrawingModes
bDaughter

handle of the device context on which to draw.


indicates how the world coordinate axis must be displayed, as defined by
enum INS_DRAWING_MODES.
indicates whether the daughter shapes are to be displayed as well.

EWorldShape::DrawGrid
Void EWorldShape::DrawGrid(HDC hDC);

Draws the reconstructed grid to be used for grid calibration.


Parameters
HDC

handle of the device context on which to draw.

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);

Draws a regular grid of crosses in world coordinates.


Parameters
HDC
f32XMin
f32YMin
f32XMax
f32YMax
un32NumXIntervals
un32NumYIntervals
548

handle of the device context on which to draw.


abscissa of the leftmost crosses, in world coordinates.
ordinate of the leftmost crosses, in world coordinates.
abscissa of the rightmost crosses, in world coordinates.
ordinate of the rightmost crosses, in world coordinates.
number of intervals between crosses along the horizontal direction.
number of intervals between crosses along the vertical direction.

EWorldShape: Field of View Calibration

EWorldShape::SetZoom
void EWorldShape::SetZoom(FLOAT32 f32ZoomX= 1, FLOAT32 f32ZoomY= 0);

Sets the horizontal and vertical zooming factors for drawing operations.
Parameters
f32ZoomX
f32ZoomY

horizontal zooming factor. By default, true scale is used.


vertical zooming factor. If set to 0, the default value, the horizontal
zooming factor is used instead, so as to provide isotropic zooming.

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

horizontal panning factor. By default, no panning occurs.


vertical panning factor. By default, no panning occurs.

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();

Returns the current horizontal/vertical zooming factor for drawing operations.


EWorldShape::GetPan X/Y
FLOAT32 EWorldShape::GetPanX();
FLOAT32 EWorldShape::GetPanY();

Returns the current horizontal/vertical panning factor for drawing operations.

549

C++ Reference Manual 6.7.1

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.

EWorldShape: Field of View Calibration

4.

SAMPLE PROGRAM
The available sample program dedicated to EWorldShape is the following:

GgeGridCalibration: shows how an image of a regular grid of known dimensions can be


used to perform a calibration.

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

EasyMultiCam: Image Acquisition

EasyMultiCam: Image Acquisition

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

C++ Reference Manual 6.7.1

6.

EASYMULTICAM AND MULTICAM

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.

PICOLO for Standard Cameras


PICOLO Installation Guide
PICOLO Reference Manual

JUNIOR for Standard Cameras


JUNIOR Installation Guide
JUNIOR Reference Manual

DOMINO for Analog Cameras


DOMINO Installation Guide
DOMINO User's Guide
DOMINO Reference Manual

GRABLINK for Camera Link Cameras


GRABLINK Installation Guide
GRABLINK User's Guide
GRABLINK Reference Manual

QUICKPACK ColorScan for Color Line Scan Cameras


QUICKPACK ColorScan Installation Guide
QUICKPACK ColorScan User's Guide
QUICKPACK ColorScan Reference Manual

Camera and Cable Information


Camera Information
Cable Information

556

EasyMultiCam: Image Acquisition

7.

CLASSES AND CLASS MEMBERS

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);

MultiCam parameter identifier.


Parameter value.

557

C++ Reference Manual 6.7.1


void MultiCamObject::GetParam(MCPARAMID param, char *value, int maxLength);

Parameters
param
value
maxLength
void
void
void
void

MultiCam parameter identifier.


Caller-allocated character string. After the call, it holds the parameter
value.
Size of the caller-allocated character string.

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);

Caller-allocated character string holding the MultiCam parameter name.


Parameter value.

void MultiCamObject::GetParam(const char *param, char *value, int maxLength);

Parameters
param
value
maxLength

Caller-allocated character string holding the MultiCam parameter name.


Caller-allocated character string. After the call, it holds the parameter
value.
Size of the caller-allocated character string.

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);

MultiCam parameter identifier.


Parameter 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);

Caller-allocated character string holding the MultiCam parameter name.


Parameter value.

EasyMultiCam: Image Acquisition

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

C++ Reference Manual 6.7.1

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

EasyMultiCam: Image Acquisition

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

Reference to the Board object.


Identifier or name of the 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

Identifier of the signal.


User allocated SignalInfo object.

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

C++ Reference Manual 6.7.1

Possible signals are listed here: MultiCam Channel Signals.


template <class T> void RegisterCallback(T *owner, void (T::*callbackMethod)(Channel
&, SignalInfo &), MCSIGNAL signal);

Parameters
owner
callbackMethod
signal

Reference to the object that contains the callback method.


Address of the callback method.
Identifier of the signal.

void (T::*callbackMethod)(Channel &ch, SignalInfo &info)

Parameters
ch
info

The Channel object that caused the signal.


SignalInfo object holding signal information.

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

EasyMultiCam: Image Acquisition

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

Identifier of the 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

C++ Reference Manual 6.7.1

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.

CreateImage... creates a new EImage... object from an existing surface.

CreateSurface creates a new surface from an existing EImage... object.

UpdateImageConfig updates an existing EImage... object with surface data.


A Channel acquires images in a group of Surface objects. EasyMultiCam provides a protection
mechanism to ensure that no new acquisition occurs in a surface during image processing. This
mechanism is automatic: during the 'surface processing' callback, the surface is protected and no new
acquisition will occur in this surface for the duration of the callback method.
In addition, the Reserve and Free methods allow controlling manually the surface protection.
The Surface object is in the Euresys::MultiCam namespace.
EasyMultiCam functions are in the Euresys::eVision::EasyMultiCam namespace.
Declare using
#include "EasyMultiCam.h"

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

EasyMultiCam: Image Acquisition

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

User allocated character string holding the board identifier.

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

User allocated character string holding the board name.

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

C++ Reference Manual 6.7.1


Board * BoardList::GetBoardByDriverIndex(int driverIndex);

Parameters
driverIndex

Index of the board in the board list.

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

Number representing the PCI position.

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

Index of the board in the board list.

SignalInfo
SignalInfo Overview

The SignalInfo object conveys information about a MultiCam signal.


Possible signals are listed here: MultiCam Channel Signals.
The SignalInfo object is in the Euresys::MultiCam namespace.
Declare using
#include "EasyMultiCam.h"

566

EasyMultiCam: Image Acquisition

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

C++ Reference Manual 6.7.1

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.

CreateImage... creates a new EImage... object from an existing surface.

CreateSurface creates a new surface from an existing EImage... object.

UpdateImageConfig updates an existing EImage... object with surface data.

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

EasyMultiCam: Image Acquisition


void
void
void
void
void
void

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

AVI (Audio-Video Interleaved)


A Microsoft technology for displaying full-motion video in a window. An AVI file interleaves waveform audio
and video data and has a .AVI filename extension.

Binary Black & White Color System


One bit of information per pixel. 0 stands for black (background). 1 stands for white (foreground).

CCIR YIQ Color System


Defined as a standard for the broadcast industry by the "Commission Consultative Internationale des
Radiocommunications" (recommendation 601). Similar to the YUV system. Specifies a luminance and two
chrominance components (Inphase and Quadrature). These parameters are related by a linear transform
to the RGB coordinates.
The luminance carries the black and white information. The I and Q chrominance carry the chromatic
information. The are often down-sampled without loss of visual quality. They are dephased by 33 with
respect to the YUV U and V components.

CCIR YUV Color System


Defined as a standard for the broadcast industry by the "Commission Consultative Internationale des
Radiocommunications" (recommendation 601). Similar to the YIQ system. Specifies a luminance and two
chrominance components. These parameters are related by a linear transform to the RGB coordinates.
The luminance carries the black and white information. The U and V chrominance carry the chromatic
information. The are often down-sampled without loss of visual quality (YUV 4:4:4 to YUV 4:2:2). They are
proportional to the Cb and Cr components (B-Y and R-Y respectively).

CIE L*a*b* Color System


Similar to the L*u*v* system. Specifies a luminance and two chrominance components. These parameters
are related by a non-linear transform to the CIE XYZ coordinates, so that they represent the colors in a
uniform way: two colors separated by the same distance anywhere in the gamut have the same visual
contrast.

CIE L*u*v* Color System


Similar to the L*a*b* system. Specifies a luminance and two chrominance components. These parameters
are related by a non-linear transform to the CIE XYZ coordinates, so that they represent the colors in a
uniform way: two colors separated by the same distance anywhere in the gamut have the same visual
contrast.

CIE LCH Color System


Derived from the L*a*b* system. Specifies the colors as a combination of Luminance (achromatic
perception, the L of L*a*b*), Chroma (degree of purity), and Hue (position along a colored sequence). The
Chroma and Hue correspond to the a*b* coordinates expressed in polar form.

CIE XYZ Color System


Standard colorimetric system defined by the "Commission Internationale de lEclairage" in 1931. Specifies
an additive mixture of three color primaries called X, Y and Z. The spectral composition of these primaries
is tabulated by the standard. Since negative intensities are involved, the primaries cannot be physically
implemented. Anyway, the XYZ system is very useful because of its absolute device independence and its
ability to cover the whole gamut of the visible spectrum.
Reduced xyz coordinates (X, Y and Z over their sum) are sometimes used.

573

C++ Reference Manual 6.7.1

Continuous Tone Black & White Color System


EBW8: usually, one byte of information per pixel. 0 stands for black (background). 255 stands for white
(foreground).

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')

Microsoft Run Length Encoding

EFOURCC_RLE

mmioFOURCC('M','R','L','E')

Alternatively, the FOURCC code can be passed as a four characters string.

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

ISH Color System


Often called HSI. Based on the RGB system. Very similar to LSH and VSH. Specifies the colors as a
combination of Intensity (achromatic perception, average of the RGB components), Saturation (degree of
purity) and Hue (position along the sequence red/yellow/green/cyan/blue/magenta).

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.

LSH Color System


Often called HLS. Based on the RGB system. Very similar to ISH and VSH. Specifies the colors as a
combination of Lightness (achromatic perception, half sum of the minimum and maximum of the RGB
components), Saturation (degree of purity) and Hue (position along the sequence
red/yellow/green/cyan/blue/magenta).

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.

RGB Color System


Usually, three bytes of information per pixel (EC24). Specifies an additive mixture of Red, Green and Blue
components. See enum E_RGB_STANDARD.

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

C++ Reference Manual 6.7.1

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

m_f32X, m_f32Y, m_f32Z;

m_f32R, m_f32G, m_f32B;

m_f32Y, m_f32U, m_f32V;

m_f32Y, m_f32I, m_f32Q;

m_f32L, m_f32S, m_f32H;

m_f32I, m_f32S, m_f32H;

m_f32Y, m_f32S, m_f32H;

m_f32V, m_f32S, m_f32H;

m_f32L, m_f32A, m_f32B;

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;

VSH Color System


Often called HSV. Based on the RGB system. Very similar to ISH and LSH. Specifies the colors as a
combination of Value (achromatic perception, maximum of the RGB components), Saturation (degree of
purity) and Hue (position along the sequence red/yellow/green/cyan/blue/magenta).

YSH Color System


Derived from the YUV system. Specifies the colors as a combination of Luminance (achromatic
perception, the Y of YUV), Saturation (degree of purity), and Hue (position along a colored sequence).
The Saturation and Hue correspond to the UV coordinates expressed in polar form.

Zooming and Panning


Zooming allows you to enlarge or shrink an image or drawing (the scale factor being respectively smaller
or larger than unity). Two separate positive scale factors named ZoomX and ZoomY can be specified.
When they are unequal, anisotropic zooming results (circles become ellipses). Setting ZoomY to 0 always
has the same effect as setting ZoomY=ZoomX. The origin point (0,0) remains fixed.
Panning allows you to translate an image or drawing. Two translation components named PanX and PanY
can be specified. They are counted as positive leftwards and downwards respectively.
Remarks
The panning factors are applied first, before zooming. The zooming/panning transform corresponds to
equations:
X = ZoomX x (X + PanX)
Y = ZoomY x (Y + PanY)

577

Appendix

Appendix

1.

EVISION ERROR REPORTING

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

C++ Reference Manual 6.7.1

2.

ERROR CODES BY VALUES

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

101 Too few characters found - Contact Technical Support


E_INFO_TOO_FEW_CHARACTERS_FOUND

102 Too many characters found - Contact Technical Support


E_INFO_TOO_MANY_CHARACTERS_FOUND

103 Word not found - Contact Technical Support


E_INFO_WORD_NOT_FOUND

104 End of image sequence


E_INFO_END_OF_IMAGE_SEQUENCE

105 User dialog failed


E_INFO_USER_DIALOG_FAILED

106 Image limits reached


E_INFO_IMAGE_LIMITS_REACHED

107 Invalid ASCII padding - Contact Technical Support


E_INFO_INVALID_ASCII_PADDING

100 Unknown error code: 100


E_ERROR_FIRST_INFO_CODE

1000 Not a valid descriptor - Contact Technical Support


E_ERROR_NOT_A_VALID_DESCRIPTOR

1002 Initialization error - Contact Technical Support


E_ERROR_INITIALIZATION_ERROR

1003 Invalid operation - See Reference Manual


E_ERROR_INVALID_OPERATION

1004 Invalid depth (bits per pixel) - Check type compatibility


E_ERROR_INVALID_BITS_PER_PIXEL

1005 Invalid data type - Check type compatibility


E_ERROR_INVALID_DATA_TYPE

1006 Invalid data size - Check type compatibility


E_ERROR_INVALID_DATA_SIZE

1007 Parameters out of range - See Reference Manual


E_ERROR_PARAMETERS_OUT_OF_RANGE

1008 Constant value too large - See Reference Manual


E_ERROR_CONSTANT_VALUE_TOO_LARGE

1009 Invalid mode - See Reference Manual


E_ERROR_INVALID_MODE

1010 End smaller than start - Adjust indices


E_ERROR_END_SMALLER_THAN_START

1011 Parameter 1 out of range - See Reference Manual


E_ERROR_PARAMETER_1_OUT_OF_RANGE

1012 Parameter 2 out of range - See Reference Manual

582

Appendix
E_ERROR_PARAMETER_2_OUT_OF_RANGE

1013 Parameter 3 out of range - See Reference Manual


E_ERROR_PARAMETER_3_OUT_OF_RANGE

1014 Parameter 4 out of range - See Reference Manual


E_ERROR_PARAMETER_4_OUT_OF_RANGE

1015 Parameter 5 out of range - See Reference Manual


E_ERROR_PARAMETER_5_OUT_OF_RANGE

1016 Parameter 6 out of range - See Reference Manual


E_ERROR_PARAMETER_6_OUT_OF_RANGE

1017 Parameter 7 out of range - See Reference Manual


E_ERROR_PARAMETER_7_OUT_OF_RANGE

1018 Parameter 8 out of range - See Reference Manual


E_ERROR_PARAMETER_8_OUT_OF_RANGE

1019 Parameter 9 out of range - See Reference Manual


E_ERROR_PARAMETER_9_OUT_OF_RANGE

1020 Parameter 10 out of range - See Reference Manual


E_ERROR_PARAMETER_10_OUT_OF_RANGE

1021 Windows error - Contact Technical Support


E_ERROR_WINDOWS_ERROR

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

1030 GRADIENT32 image expected - Check image type or file contents


E_ERROR_GRADIENT32_IMAGE_EXPECTED

1031 Template call needs specialization - Please contact Technical Support


E_ERROR_TEMPLATE_CALL_NEEDS_SPECIALIZATION

1032 Cannot create Mutex


E_ERROR_CANNOT_CREATE_MUTEX

1033 Cannot lock Mutex


E_ERROR_CANNOT_LOCK_MUTEX

1034 Cannot unlock Mutex


E_ERROR_CANNOT_UNLOCK_MUTEX

1035 Cannot delete Mutex


E_ERROR_CANNOT_DELETE_MUTEX

1036 Timeout reached


583

C++ Reference Manual 6.7.1


E_ERROR_TIMEOUT_REACHED

1050 Singular matrix - Check transform parameters


E_ERROR_SINGULAR_MATRIX

1051 Division by zero - Check parameters


E_ERROR_DIVISION_BY_ZERO

1052 This property is read-only and may not be accessed


E_ERROR_READONLY_PROPERTY

1053 This property is undefined and may not be accessed


E_ERROR_UNDEFINED_PROPERTY

1100 File access problems - Check file pathname and device state
E_ERROR_FILE_ACCESS_PROBLEMS

1101 File not found - Check file pathname


E_ERROR_FILE_NOT_FOUND

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

1105 Bad file format - Check file source or contents


E_ERROR_BAD_FILE_FORMAT

1106 File could not be closed - Check free disk space, troubleshoot disk device
E_ERROR_FILE_COULD_NOT_BE_CLOSED

1107 Obsolete file format - Upgrade to newer release


E_ERROR_OBSOLETE_FILE_FORMAT

1108 Unsupported file format version - Upgrade to newer release


E_ERROR_UNSUPPORTED_FILE_FORMAT_VERSION

1109 Missing or unsupported file extension - Check file name/format match


E_ERROR_MISSING_OR_UNSUPPORTED_FILE_EXTENSION

1110 File is read-only - Set to read-write or save under another name


E_ERROR_FILE_IS_READ_ONLY

1111 The archive does not contain the correct object type - Check your archiving routines please
E_ERROR_UNSUPPORTED_OBJECT_TYPE_IN_ARCHIVE

1112 An unexpected error occurred during archive access


E_ERROR_UNKNOWN_ARCHIVE_ERROR

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

1115 Attempting to overwrite an existing file while not allowed to do so


E_ERROR_FILE_EXISTS

1116 Attempting to use a serializer that is not correctly opened


E_ERROR_SERIALIZER_NOT_OPEN

1150 Missing or invalid AVI stream - File must contain video data
E_ERROR_MISSING_OR_INVALID_AVI_STREAM

1151 Unsupported AVI stream type - Contact Technical Support


E_ERROR_UNSUPPORTED_AVI_STREAM_TYPE

584

Appendix

1152 AVI compressor not found - Check available codecs


E_ERROR_AVI_COMPRESSOR_NOT_FOUND

1153 AVI compressor does not support this image format - Check codec documentation
E_ERROR_AVI_COMPRESSOR_DOES_NOT_SUPPORT_THIS_IMAGE_FORMAT

1200 Unable to load into an ROI - Unsupported feature


E_ERROR_UNABLE_TO_LOAD_INTO_AN_ROI

1201 Unable to save from an ROI - Unsupported feature


E_ERROR_UNABLE_TO_SAVE_FROM_AN_ROI

1202 Unsupported TIFF format - Convert TIFF file


E_ERROR_UNSUPPORTED_TIFF_FORMAT

1203 Unsupported BMP format - Convert BMP file


E_ERROR_UNSUPPORTED_BMP_FORMAT

1204 Disk image too wide for block - Contact Technical Support
E_ERROR_DISK_IMAGE_TOO_WIDE_FOR_BLOCK

1205 Too many bits per pixel - Check type compatibility


E_ERROR_TOO_MANY_BITS_PER_PIXEL

1206 Unsupported Visilog format - Obsolete feature


E_ERROR_UNSUPPORTED_VISILOG_FORMAT

1207 Unsupported JPEG format - Convert JPEG file


E_ERROR_UNSUPPORTED_JPEG_FORMAT

1208 Bilevel image expected - Use BW1


E_ERROR_BILEVEL_IMAGE_EXPECTED

1209 Gray level image expected - Use BW8


E_ERROR_GRAY_LEVEL_IMAGE_EXPECTED

1210 Color image expected - Use C24


E_ERROR_COLOR_IMAGE_EXPECTED

1212 Bilevel format expected - Convert file to black & white


E_ERROR_BILEVEL_FORMAT_EXPECTED

1213 Gray level format expected - Convert file to gray shades


E_ERROR_GRAY_LEVEL_FORMAT_EXPECTED

1214 Color format expected - Convert file to true color


E_ERROR_COLOR_FORMAT_EXPECTED

1215 Cannot read JPEG file - Troubleshoot disk device


E_ERROR_CANNOT_READ_JPEG_FILE

1216 Cannot write JPEG file - Troubleshoot disk device


E_ERROR_CANNOT_WRITE_JPEG_FILE

1301 Unable to allocate temporary memory - Fix memory leaks or release memory
E_ERROR_UNABLE_TO_ALLOCATE_TEMPORARY_MEMORY

1302 Insufficient memory allocation - Contact Technical Support


E_ERROR_INSUFFICIENT_ALLOC_MEM

1303 Unable to allocate memory - Fix memory leaks or release memory


E_ERROR_UNABLE_TO_ALLOCATE_MEMORY

1304 Unable to reallocate memory - Fix memory leaks or release memory


E_ERROR_UNABLE_TO_REALLOC_MEMORY

1350 Shared memory segment info error


E_ERROR_XSHMSEGINFO

1351 Unable to attach Shared Memory segment to display


E_ERROR_XSHMATTACH

585

C++ Reference Manual 6.7.1

1352 Unable to create Shared Memory XImage


E_ERROR_XSHMXIMAGE

1353 Unable to create XImage


E_ERROR_XIMAGE

1400 Unable to access image memory Load or size image


E_ERROR_UNABLE_TO_ACCESS_IMAGE_MEMORY

1401 ROI too large - Fit ROI to image


E_ERROR_ROI_TOO_LARGE

1402 Not a valid image - Check image contents


E_ERROR_NOT_A_VALID_IMAGE

1403 Images not of the same size - Adjust image size(s)


E_ERROR_IMAGES_NOT_SAME_SIZE

1404 Images not of the same depth (bits per pixel) - Choose compatible types
E_ERROR_IMAGES_NOT_SAME_BITS_PER_PIXEL

1405 Origin image too small - Use a larger image


E_ERROR_SOURCE_IMAGE_TOO_SMALL

1406 Unable to modify ROI - Contact Technical Support


E_ERROR_UNABLE_TO_MODIFY_ROI

1407 Unable to modify parent image origin - Contact Technical Support


E_ERROR_UNABLE_TO_MODIFY_PARENT_IMAGE_ORG

1408 Unable to modify parent image size - Contact Technical Support


E_ERROR_UNABLE_TO_MODIFY_PARENT_IMAGE_SIZE

1409 Pixels must have finite size - Use nonzero parameters


E_ERROR_PIXELS_MUST_HAVE_FINITE_SIZE

1410 Pixels must have positive size


E_ERROR_PIXELS_MUST_HAVE_POSITIVE_SIZE

1411 Constant is null - Use nonzero value


E_ERROR_CONSTANT_IS_NULL

1412 Null pixel encountered - Avoid division by zero


E_ERROR_PIXEL_NULL_ENCOUNTERED

1413 Images may not overlap - Use distinct images


E_ERROR_IMAGES_MAY_NOT_OVERLAP

1414 ROI out of parent limits - Resize to fit in image


E_ERROR_ROI_OUT_OF_PARENT_LIMITS

1415 ROI already has a parent - Detach ROI first


E_ERROR_ROI_ALREADY_HAS_A_PARENT

1416 ROI has no parent image - Attach to an image


E_ERROR_ROI_HAS_NO_PARENT_IMAGE

1417 Cannot apply to an image - Apply to a ROI instead


E_ERROR_CANNOT_APPLY_TO_AN_IMAGE

1418 Unsupported image type - Check type compatibility


E_ERROR_UNSUPPORTED_IMAGE_TYPE

1419 Invalid image type - Check type compatibility


E_ERROR_INVALID_IMAGE_TYPE

1420 Unsupported X server depth - Contact Technical Support


E_ERROR_UNSUPPORTED_XSERVER_DEPTH

586

Appendix

1421 The hierarchy of ROI has been corrupted (inconsistent parent/daughters relationship) - Contact
Technical Support
E_ERROR_INCONSISTENT_ROI_HIERARCHY

1422 Origin image too big - Use a smaller image


E_ERROR_SOURCE_IMAGE_TOO_BIG

1450 Unsupported image sequence format - See Reference Manual


E_ERROR_UNSUPPORTED_IMAGE_SEQUENCE_FORMAT

1451 Unsupported image sequence file format - See Reference Manual


E_ERROR_UNSUPPORTED_IMAGE_SEQUENCE_FILE_FORMAT

1500 Pixel outside perimeter - Check pixel value


E_ERROR_PIXEL_OUTSIDE_PERIMETER

1501 Pixel inside perimeter - Check pixel value


E_ERROR_PIXEL_INSIDE_PERIMETER

1502 Isolated pixel - Check pixel value


E_ERROR_ISOLATED_PIXEL

1504 Maximum pixels in contour reached - Contact Technical Support


E_ERROR_MAX_PIXEL_IN_CONTOUR_REACHED

1505 Not a valid contour - Initialize using a contouring function


E_ERROR_NOT_A_VALID_CONTOUR

1601 Unable to access vector memory - Check proper vector initialization


E_ERROR_UNABLE_TO_ACCESS_VECTOR_MEMORY

1602 Not a valid vector descriptor - Contact Technical Support


E_ERROR_NOT_A_VALID_VECTOR_DESCRIPTOR

1603 Vector type is not histogram - Contact Technical Support


E_ERROR_VECTOR_TYPE_IS_NOT_HIST

1604 Not enough groups in vector - Contact Technical Support


E_ERROR_NOT_ENOUGH_GROUPS_IN_VECTOR

1605 Invalid vector data size - Contact Technical Support


E_ERROR_INVALID_VECTOR_DATA_SIZE

1606 Invalid vector data type - Contact Technical Support


E_ERROR_INVALID_VECTOR_DATA_TYPE

1607 Invalid vector type - Contact Technical Support


E_ERROR_INVALID_VECTOR_TYPE

1608 Result too big to fit in vector - Contact Technical Support


E_ERROR_RESULT_TOO_BIG_TO_FIT_IN_VECTOR

1609 Group out of range - Adjust group index


E_ERROR_GROUP_OUT_OF_RANGE

1610 Invalid vector use - Contact Technical Support


E_ERROR_INVALID_VECTOR_USE

1611 Invalid vector group length - Contact Technical Support


E_ERROR_INVALID_VECTOR_GROUP_LENGTH

1612 Invalid vector number of groups - Contact Technical Support


E_ERROR_INVALID_VECTOR_NUMBER_OF_GROUPS

1613 Invalid number of vector elements - Check proper vector initialization


E_ERROR_INVALID_NUMBER_OF_VECTOR_ELEMENTS

1614 Unsupported vector type - Contact Technical Support


E_ERROR_UNSUPPORTED_VECTOR_TYPE

1615 Vectors not of the same size - Adjust vector size(s)


587

C++ Reference Manual 6.7.1


E_ERROR_VECTORS_NOT_SAME_SIZE

1700 Unable to access kernel memory - Check proper kernel initialization


E_ERROR_UNABLE_TO_ACCESS_KERNEL_MEMORY

1701 Not a valid kernel descriptor - Contact Technical Support


E_ERROR_NOT_A_VALID_KERNEL_DESCRIPTOR

1702 Invalid kernel - Contact Technical Support


E_ERROR_INVALID_KERNEL

1703 Invalid kernel size - Check proper kernel initialization


E_ERROR_KERNEL_INVALID_SIZE

1704 Kernel not allocated - Check proper kernel initialization


E_ERROR_KERNEL_NOT_ALLOCATED

1800 List already initialized - Check initialization


E_ERROR_LIST_ALREADY_INITIALIZED

1801 List not initialized - Check initialization


E_ERROR_LIST_NOT_INITIALIZED

1802 Bad list position - Restart list traversal


E_ERROR_BAD_LIST_POSITION

1803 List is empty


E_ERROR_LIST_IS_EMPTY

1804 Top of list - Do not traverse backwards


E_ERROR_TOP_OF_LIST

1805 Bottom of list - Do not traverse backwards


E_ERROR_BOT_OF_LIST

1806 List error - Contact Technical Support


E_ERROR_LIST_ERROR

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

1909 Unknown error code: 1909


E_ERROR_EASY_HCR_LICENSE_MISSING

1910 The license for EasyMatch is not granted - Launch license manager
E_ERROR_EASY_MATCH_LICENSE_MISSING

1911 Unknown error code: 1911


588

Appendix
E_ERROR_EASY_GRANULA_LICENSE_MISSING

1912 Unknown error code: 1912


E_ERROR_EASY_OPV_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

1921 This feature is not available


E_ERROR_FEATURE_NOT_AVAILABLE

1950 Eurecard board missing - Launch license manager


E_ERROR_EURECARD_MISSING

1951 Eurecard Domino missing - Launch license manager


E_ERROR_EURECARD_DOMINO_MISSING

1952 Eurecard Picolo missing - Launch license manager


E_ERROR_EURECARD_PICOLO_MISSING

1953 Eurecard Multi missing - Launch license manager


E_ERROR_EURECARD_MULTI_MISSING

1954 Unknown error code: 1954


E_ERROR_EURECARD_SIRCAM_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

2001 Could not grant any license - Launch license manager


E_ERROR_COULD_NOT_GRANT_THE_LICENSES

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

2003 Error(s) in license file - Edit it


589

C++ Reference Manual 6.7.1


E_ERROR_BAD_CONTENTS

2004 Error(s) in license file - Could not be logged !


E_ERROR_BAD_CONTENTS_COULD_NOT_BE_LOGGED

2005 Wrong checksum in license file - Edit it


E_ERROR_WRONG_CHECKSUM

2006 Bad Serial Number format - Use 'dddddddd' or 'xxxx:xxxx:xxxx:xxxx'


E_ERROR_BAD_SERIAL_NO

2007 Unknown Part Name


E_ERROR_BAD_PART_NAME

2008 Bad Part Number format - Use 'dddd-d'


E_ERROR_BAD_PART_NO

2009 Part Name and Number mismatch


E_ERROR_PART_MISMATCH

2010 Bad Expires Date - Format is '-' or 'DD/MM/YY'


E_ERROR_BAD_EXPIRES

2011 Bad Access Key format - Use 'D-xxxx:xxxx:xxxx:xxxx'


E_ERROR_BAD_ACCESS_KEY

2012 Bad Checksum format - Use 'xxxx:xxxx:xxxx:xxxx:xxxx'


E_ERROR_BAD_CHECKSUM

2013 Bad date - Format is 'DD/MM/YY'


E_ERROR_BAD_DATE

2014 Bad hour - Format is 'HH:MM:SS'


E_ERROR_BAD_HOUR

2015 No license file (LICENSE.KEY) found - Install one if your are using a memoryless dongle
E_ERROR_LICENSE_FILE_NOT_FOUND

2020 License Device access problem - Contact Technical Support


E_ERROR_MEDIUM_INACCESSIBLE

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

2023 Illegal operation - Contact Technical Support


E_ERROR_ILLEGAL_OPERATION

2024 Information not accessible - Contact Technical Support


E_ERROR_INFORMATION_NOT_ACCESSIBLE

2025 Information not present - Contact Technical Support


E_ERROR_INFORMATION_NOT_PRESENT

2026 Hardware for Host Signature has changed - Restore the PC in its initial state or contact Technical
Support
E_ERROR_IDENTIFICATION_ALTERED

2100 Could not find any dongle - Launch license manager


E_ERROR_COULD_NOT_FIND_THE_DALSEMI_KEYS

2101 Dallas Semiconductor driver not found - Install it if you are using a Dallas Semiconductor dongle
E_ERROR_DALSEMI_DRIVER_NOT_FOUND

2102 Dongle access problem (<keyopen> failed) - Contact Technical Support


E_ERROR_DALSEMI_KEYOPEN_FAILED

2103 Dongle access problem (<setup> failed) - Contact Technical Support


E_ERROR_DALSEMI_SETUP_FAILED

590

Appendix

2104 Dongle access problem (<gndtest> failed) - Contact Technical Support


E_ERROR_DALSEMI_GNDTEST_FAILED

2105 Dongle access problem (<access> failed - Contact Technical Support


E_ERROR_DALSEMI_ACCESS_FAILED

2106 Too many hardware keys are connected


E_ERROR_TOO_MANY_KEYS

2107 This is not a suitable dongle type (DS1427 Time button required)
E_ERROR_DALSEMI_NOT_A_TIME_BUTTON

2108 Not a valid time value


E_ERROR_DALSEMI_BAD_BUTTON_TIME

2109 The button in this dongle is write protected


E_ERROR_DALSEMI_WRITE_PROTECTED

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

2121 Domino board access problem - Contact Technical Support


E_ERROR_DOMINO_ACCESS_FAILED

2122 Domino board has unknown type - Contact Technical Support


E_ERROR_DOMINO_UNKNOWN_BOARD

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

2131 Picolo board access problem - Contact Technical Support


E_ERROR_PICOLO_ACCESS_FAILED

2132 Picolo board has unknown type - Contact Technical Support


E_ERROR_PICOLO_UNKNOWN_BOARD

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

2134 Multi board access problem - Contact Technical Support


E_ERROR_MULTI_ACCESS_FAILED

2135 Multi board has unknown type - Contact Technical Support


E_ERROR_MULTI_UNKNOWN_BOARD

2136 Sentinel dongle driver internal error - Contact Technical Support


E_ERROR_SENTINEL_INTERNAL_ERROR

2137 Sentinel driver not found - Install it if you are using a Sentinel dongle
E_ERROR_SENTINEL_DRIVER_NOT_FOUND

2138 Sentinel dongle access problem - Contact Technical Support


E_ERROR_SENTINEL_ACCESS_FAILED

2139 Unknown Sentinel Developer ID - Edit Registry


E_ERROR_UNKNOWN_SENTINEL_DEVELOPER_ID

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

2142 SirCam board access problem - Contact Technical Support

591

C++ Reference Manual 6.7.1


E_ERROR_SIRCAM_ACCESS_FAILED

2143 SirCam board has unknown type - Contact Technical Support


E_ERROR_SIRCAM_UNKNOWN_BOARD

2200 Warp images too small - Increase image size


E_ERROR_WARP_IMAGES_TOO_SMALL

2500 Scanner error


E_ERROR_SCANNER_ERROR

2600 Unknown error code: 2600


E_ERROR_UNSUPPORTED_IMAGE_SIZE

3000 Unable to access coded image memory - Check proper initialization


E_ERROR_UNABLE_TO_ACCESS_CODED_IMAGE_MEMORY

3001 Feature dependency error - Contact Technical Support


E_ERROR_FEATURE_DEPENDENCY_ERROR

3002 Object too small for feature - Remove small objects


E_ERROR_OBJECT_TOO_SMALL_FOR_FEATURE

3003 Unknown feature - Check parameters


E_ERROR_UNKNOWN_FEATURE

3004 Invalid selection argument - Check parameters


E_ERROR_INVALID_SELECTION_ARGUMENT

3005 Sort list too long - Contact Technical Support


E_ERROR_SORT_LIST_TOO_LONG

3006 Not a valid operation code - Contact Technical Support


E_ERROR_NOT_A_VALID_OPERATION_CODE

3008 Too many objects detected - Increase MaxObjects


E_ERROR_TOO_MANY_OBJECTS_DETECTED

3009 Too many runs detected - Contact Technical Support


E_ERROR_TOO_MANY_RUNS_DETECTED

3010 Time-out reached - Process simpler images


E_ERROR_TIME_OUT_REACHED

3011 Too many runs - Process simpler images


E_ERROR_TOO_MANY_RUNS

3012 Invalid feature - Check parameters


E_ERROR_INVALID_FEATURE

3013 Feature not calculated - Call AnalyseObjects method


E_ERROR_FEATURE_NOT_CALCULATED

3014 Bad object number - Check parameters


E_ERROR_BAD_OBJECT_NUMBER

3015 No object selected - Blob list is empty


E_ERROR_NO_OBJECT_SELECTED

3016 Low threshold higher than high threshold - Adjust thresholds


E_ERROR_LOW_THRESHOLD_HIGHER_THAN_HIGH_THRESHOLD

3017 Invalid threshold mode - Use appropriate threshold setting method


E_ERROR_INVALID_THRESHOLD_MODE

4001 Measure object must not be a point - Use line or circle measure probe
E_ERROR_MEASURE_OBJ_MUST_NOT_BE_POINT

5000 Broken object


592

Appendix
E_ERROR_BROKEN_OBJECT

5001 Superfluous object


E_ERROR_SUPERFLUOUS_OBJECT

5002 Missing object


E_ERROR_MISSING_OBJECT

5003 Object under threshold


E_ERROR_OBJECT_UNDER_THRESHOLD

5004 Object over threshold


E_ERROR_OBJECT_OVER_THRESHOLD

6000 No pattern learnt - Load from file or train pattern


E_ERROR_NO_PATTERN_LEARNT

6001 Pattern too large - Use a smaller one


E_ERROR_PATTERN_TOO_LARGE

6002 Pattern too small - Use a larger one


E_ERROR_PATTERN_TOO_SMALL

6003 Unsupported scaling mode - See Reference Manual


E_ERROR_UNSUPPORTED_SCALING_MODE

6004 Not an EasyMatch file - Check file source


E_ERROR_NOT_AN_EASY_MATCH_FILE

6005 Unsupported EasyMatch file version - Upgrade to a newer release


E_ERROR_UNSUPPORTED_EASY_MATCH_FILE_VERSION

6006 No image learnt - Call LearnImage( ) first, please


E_ERROR_NO_IMAGE_LEARNT

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

6501 Not an EasyFind file - Check file source


E_ERROR_NOT_AN_EASY_FIND_FILE

6502 Unsupported EasyFind file version - Upgrade to a newer release


E_ERROR_UNSUPPORTED_EASY_FIND_FILE_VERSION

6503 Pattern is too close to image border - Leave a margin around the pattern
E_ERROR_PATTERN_TOO_CLOSE_TO_IMAGE_BORDER

7000 No patterns loaded - Load font file or train


E_ERROR_NO_PATTERNS_LOADED

7001 No patterns in these classes - Check pattern and text class assignments
E_ERROR_NO_PATTERNS_IN_THESE_CLASSES

7004 Character too small - Enlarge to font size


E_ERROR_CHARACTER_TOO_SMALL

8001 No such N-gram - Contact Technical Support


E_ERROR_NO_SUCH_NGRAM

8002 Index is full - Contact Technical Support


E_ERROR_INDEX_FULL

8003 The word list is full - Contact Technical Support


E_ERROR_WORD_LIST_FULL

8004 Invalid field type - Contact Technical Support


E_ERROR_INVALID_FIELD_TYPE

593

C++ Reference Manual 6.7.1

8005 No classifier for a TEXT or NUMBER field - Contact Technical Support


E_ERROR_NO_CLASSIFIER_FOR_TEXT_OR_NUMBER_FIELD

8006 Incompatible field types - Contact Technical Support


E_ERROR_INCOMPATIBLE_FIELD_TYPES

9000 Mismatching color system - Check transform compatibility


E_ERROR_MISMATCHING_COLOR_SYSTEM

9001 Color lookup must be initialized - Use initialization method


E_ERROR_COLOR_LOOKUP_MUST_BE_INITIALIZED

9002 Unsupported color transform - Contact Technical Support


E_ERROR_UNSUPPORTED_COLOR_TRANSFORM

10001 Invalid ASCII character - Contact Technical Support


E_ERROR_INVALID_ASCII_CHARACTER

10002 Invalid C40 character - Contact Technical Support


E_ERROR_INVALID_C40_CHARACTER

10003 Invalid TEXT character - Contact Technical Support


E_ERROR_INVALID_TEXT_CHARACTER

10004 Invalid ANSI X12 character - Contact Technical Support


E_ERROR_INVALID_X12_CHARACTER

10005 Invalid EDIFACT character - Contact Technical Support


E_ERROR_INVALID_EDIFACT_CHARACTER

10006 Invalid Base 256 character - Contact Technical Support


E_ERROR_INVALID_BASE256_CHARACTER

10008 Unknown symbol size - Check size initialization


E_ERROR_UNKNOWN_SYMBOL_SIZE

10009 Unknown ECC family (ECC 000/050/080/100/140/200 only) - Contact Technical Support
E_ERROR_UNKNOWN_ECC_FAMILY

10010 Not enough corners for auto-detection - Point at four corners


E_ERROR_NOT_ENOUGH_CORNERS

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

10015 Not an EasyMatrixCode file - Check file source


E_ERROR_NOT_AN_EASY_MATRIX_CODE_FILE

10016 Unsupported EasyMatrixCode file version - Upgrade to a newer release


E_ERROR_UNSUPPORTED_EASY_MATRIX_CODE_FILE_VERSION

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

10020 Could not determine symbol size - Increase image resolution


594

Appendix
E_ERROR_COULD_NOT_DETERMINE_SYMBOL_SIZE

10021 Could not decode symbol - Try to improve image quality


E_ERROR_COULD_NOT_DECODE_SYMBOL

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

10503 Unrecognized signature - Check enabled symbologies


E_ERROR_UNRECOGNIZED_SIGNATURE

10504 Invalid number of bars - Improve bar/space contrast


E_ERROR_INVALID_NUMBER_OF_BARS

10505 Extra edges found - Improve bar/space contrast or uniformity


E_ERROR_EXTRA_EDGES_FOUND

10506 Incoherent bar/space thickness sequence - Check enabled symbologies


E_ERROR_INCOHERENT_BAR_SPACE_THICKNESS

10507 Invalid checksum character - Check enabled symbologies


E_ERROR_INVALID_CHECK_CHARACTER

10508 Symbology not enabled - Invoke method 'SetSymbologies'


E_ERROR_SYMBOLOGY_NOT_ENABLED

10509 No edges found - Adjust location or improve bar/space contrast


E_ERROR_NO_EDGES_FOUND

11001 Not an EasyOCV file - Check file source


E_ERROR_NOT_AN_EASY_OCV_FILE

11002 Unsupported EasyOCV file version - Upgrade eVision


E_ERROR_UNSUPPORTED_EASY_OCV_FILE_VERSION

11003 Not enough sample images - Use AddToStatistics


E_ERROR_NOT_ENOUGH_SAMPLE_IMAGES

11004 Not an EChecker file - Check file source


E_ERROR_NOT_AN_ECHECKER_FILE

11005 Unsupported EChecker file version - Upgrade eVision


E_ERROR_UNSUPPORTED_ECHECKER_FILE_VERSION

11006 Text location out of image - Adjust location ranges


E_ERROR_TEXT_LOCATION_OUT_OF_IMAGE

11007 Not enough samples learnt - Use UpdateStatistics


E_ERROR_NOT_ENOUGH_SAMPLES_LEARNT

11008 Invalid normalization mode - Check SetNormalize call


E_ERROR_INVALID_NORMALIZATION_MODE

11009 Image not registered - Use method Register before Learn


E_ERROR_IMAGE_NOT_REGISTERED

11010 Invalid learning sequence - Use AVERAGE followed by ABS_DEVIATION, or RMS_DEVIATION,


then READY
E_ERROR_INVALID_LEARNING_SEQUENCE

12001 Shape already has a mother - Detach first


E_ERROR_SHAPE_ALREADY_HAS_A_MOTHER

12002 Mother already has this daughter - Detach daughter first


E_ERROR_MOTHER_ALREADY_HAS_THIS_DAUGHTER

12003 Mother already has daughters - Detach daughters first


E_ERROR_MOTHER_ALREADY_HAS_DAUGHTERS

595

C++ Reference Manual 6.7.1

12004 Shape already has this daughter - Detach daughter first


E_ERROR_SHAPE_ALREADY_HAS_THIS_DAUGHTER

12005 Shape already has daughters - Detach daughters first


E_ERROR_SHAPE_ALREADY_HAS_DAUGHTERS

12006 Singular transform


E_ERROR_SINGULAR_TRANSFORM

12007 No valid point found


E_ERROR_NO_VALID_POINT_FOUND

12008 Not in list attachment mode - Detach daughters first


E_ERROR_NOT_IN_LIST_ATTACHMENT_MODE

12009 Not in indexed attachment mode - Detach daughters and call SetIndexed first
E_ERROR_NOT_IN_INDEXED_ATTACHMENT_MODE

12010 Unsupported shape version - Upgrade eVision


E_ERROR_UNSUPPORTED_SHAPE_VERSION

12011 Raw calibration mode - Cannot be used for this operation


E_ERROR_RAW_CALIBRATION_MODE

12012 User calibration mode - Cannot be used for this operation


E_ERROR_USER_CALIBRATION_MODE

12013 Incompatible calibration modes - Check calibration mode categories


E_ERROR_INCOMPATIBLE_CALIBRATION_MODES

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

12016 Unsupported model file version - Upgrade eVision


E_ERROR_UNSUPPORTED_MODEL_FILE_VERSION

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

13001 No component in the BGA model - Add one


E_ERROR_NO_COMPONENT

13002 No such component in the BGA model - Check current index/indices


E_ERROR_NO_SUCH_COMPONENT

13003 Cannot edit multiple components - Revert to single component


E_ERROR_CANNOT_EDIT_MULTIPLE_COMPONENTS

13004 Component has no array - Add one


E_ERROR_NO_ARRAY

13005 No such array on component - Check current index/indices


E_ERROR_NO_SUCH_ARRAY

13006 No ball on array - Add one


E_ERROR_NO_BALL

13007 No such ball on array - Check current index/indices


E_ERROR_NO_SUCH_BALL

13008 World calibration failed - Eliminate inspection diagnostics


E_ERROR_WORLD_CALIBRATION_FAILED

13009 Balls calibration failed - Eliminate inspection diagnostics


E_ERROR_BALLS_CALIBRATION_FAILED

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

C++ Reference Manual 6.7.1

14003 No Board corresponding to BoardName parameter - Check board name spelling


E_ERROR_NO_BOARD_CORRESPONDING_TO_BOARDNAME

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

14006 No Board corresponding to PciPosition parameter - Check board location


E_ERROR_NO_BOARD_CORRESPONDING_TO_PCIPOSITION

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

14011 In order to create a new channel - all channels must be stopped


E_ERROR_CHANNEL_CREATION_FAILED_WHEN_OTHER_ACTIVE

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

14014 Please contact technical support - NULL_EMCCHANNEL_POINTER


E_ERROR_NULL_EMCCHANNEL_POINTER

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

14016 EMCOpen( ) failure - Check board presence and/or driver installation


E_ERROR_EMCOPEN_FAILURE

14017 Cannot apply to an EMCImage - Use an EImage/ROI object instead


E_ERROR_CANNOT_APPLY_TO_AN_EMCIMAGE

14018 Feature not implemented - Contact Technical Support


E_ERROR_NOT_IMPLEMENTED

14019 Cannot register Signal handler - Contact Technical Support


E_ERROR_REGISTER_CONFIGURATION_SIGNAL_CALLBACK_FAILURE

14020 Cannot register Error handler - Contact Technical Support


E_ERROR_REGISTER_CONFIGURATION_ERROR_CALLBACK_FAILURE

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

14029 EasyMultiCam image not assigned - Call some AssignSource overload

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

14100 Unknown error code: 14100


E_ERROR_MULTICAM_0

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

14103 The communication with the hardware failed


E_ERROR_MULTICAM_IO_ERROR

14104 Please contact technical support - INTERNAL_ERROR


E_ERROR_MULTICAM_INTERNAL_ERROR

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

14107 The requested operation is not supported by the MultiCam system


E_ERROR_MULTICAM_NOT_SUPPORTED

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

14109 The specified index is not in the bounds of the parameter


E_ERROR_MULTICAM_OUT_OF_BOUND

14110 A MultiCam object could not be found - Check its handle


E_ERROR_MULTICAM_INSTANCE_NOT_FOUND

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

14113 The specified value is not allowed for the parameter


E_ERROR_MULTICAM_INVALID_VALUE

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

14116 No event is currently available - This is not an error condition


E_ERROR_MULTICAM_NO_EVENT

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

C++ Reference Manual 6.7.1

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

14200 Unknown error code: 14200


E_ERROR_MULTICAM_PICOLO_0

14201 Device not found - contact Technical Support


E_ERROR_MULTICAM_PICOLO_DEVICE_NOT_FOUND

14202 Invalid parameter - contact Technical Support


E_ERROR_MULTICAM_PICOLO_INVALID_PARAMETER

14203 Timeout - contact Technical Support


E_ERROR_MULTICAM_PICOLO_TIMEOUT

14204 Invalid handle - contact Technical Support


E_ERROR_MULTICAM_PICOLO_INVALID_HANDLE

14205 Surface error - contact Technical Support


E_ERROR_MULTICAM_PICOLO_SURFACE_ERROR

14206 Channel error - contact Technical Support


E_ERROR_MULTICAM_PICOLO_CHANNEL_ERROR

14207 System error - contact Technical Support


E_ERROR_MULTICAM_PICOLO_SYSTEM_ERROR

14208 Unsuccessful - contact Technical Support


E_ERROR_MULTICAM_PICOLO_UNSUCCESSFUL

14209 No data - contact Technical Support


E_ERROR_MULTICAM_PICOLO_NO_DATA

14210 Invalid parameter value - contact Technical Support


E_ERROR_MULTICAM_PICOLO_INVALID_PARAMETER_VALUE

14300 Not implemented - contact Technical Support


E_ERROR_MULTICAM_PICOLO_NOT_IMPLEMENTED

15000 Unknown error code: 15000


E_ERROR_IJPEG_BASE_ERROR

15001 Unknown error code: 15001


E_ERROR_IJPEG_EXCEPTION_DETECTED

15002 Unknown error code: 15002


E_ERROR_IJPEG_INVALID_ENCODER

15003 Unknown error code: 15003


E_ERROR_IJPEG_UNSUPPORTED_SUBSAMPLING

15004 Unknown error code: 15004


E_ERROR_IJPEG_UNSUPPORTED_BYTES_PER_PIXEL

15005 Unknown error code: 15005


E_ERROR_IJPEG_MEMORY_ERROR

15006 Unknown error code: 15006


E_ERROR_IJPEG_BAD_HUFFMAN_TABLE

15007 Unknown error code: 15007


E_ERROR_IJPEG_BAD_QUANT_TABLE

15008 Unknown error code: 15008


E_ERROR_IJPEG_INVALID_JPEG_PROPERTIES

600

Appendix

15009 Unknown error code: 15009


E_ERROR_IJPEG_ERR_FILECLOSE

15010 Unknown error code: 15010


E_ERROR_IJPEG_INVALID_FILENAME

15011 Unknown error code: 15011


E_ERROR_IJPEG_ERROR_EOF

15012 Unknown error code: 15012


E_ERROR_IJPEG_PROG_NOT_SUPPORTED

15013 Unknown error code: 15013


E_ERROR_IJPEG_ERR_NOT_JPEG

15014 Unknown error code: 15014


E_ERROR_IJPEG_ERR_COMP

15015 Unknown error code: 15015


E_ERROR_IJPEG_ERR_SOF

15016 Unknown error code: 15016


E_ERROR_IJPEG_ERR_DNL

15017 Unknown error code: 15017


E_ERROR_IJPEG_ERR_NO_HUF

15018 Unknown error code: 15018


E_ERROR_IJPEG_ERR_NO_QUAN

15019 Unknown error code: 15019


E_ERROR_IJPEG_ERR_NO_FRAME

15020 Unknown error code: 15020


E_ERROR_IJPEG_ERR_MULT_FRAME

15021 Unknown error code: 15021


E_ERROR_IJPEG_ERR_DATA

15022 Unknown error code: 15022


E_ERROR_IJPEG_ERR_NO_IMAGE

15023 Unknown error code: 15023


E_ERROR_IJPEG_FILE_ERROR

15024 Unknown error code: 15024


E_ERROR_IJPEG_INTERNAL_ERROR

15025 Unknown error code: 15025


E_ERROR_IJPEG_BAD_RST_MARKER

15026 Unknown error code: 15026


E_ERROR_IJPEG_THUMBNAIL_DIB_TOO_SMALL

15027 Unknown error code: 15027


E_ERROR_IJPEG_THUMBNAIL_DIB_WRONG_COLOR

15028 Unknown error code: 15028


E_ERROR_IJPEG_BUFFER_TOO_SMALL

15029 Unknown error code: 15029


E_ERROR_IJPEG_UNSUPPORTED_FRAME

15030 Unknown error code: 15030


E_ERROR_IJPEG_ERR_COM_BUFFER

15099 Unknown error code: 15099


E_ERROR_IJPEG_RESERVED

15100 Unknown error code: 15100


E_ERROR_IJPEG_UNKNOWN

601

C++ Reference Manual 6.7.1

15101 Unknown error code: 15101


E_ERROR_IJPEG_SOI_MARKER_NOT_FOUND

15102 Unknown error code: 15102


E_ERROR_IJPEG_EOI_MARKER_NOT_FOUND

15103 Unknown error code: 15103


E_ERROR_IJPEG_CORRUPTED_JPEG_BUFFER

15104 Unknown error code: 15104


E_ERROR_IJPEG_EMPTY_JPEG_BUFFER

15105 Unknown error code: 15105


E_ERROR_IJPEG_LAST_ERROR

32765 Cannot trace errors because of a system failure - Contact Technical Support
E_ERROR_CANNOT_TRACE_ERRORS

32766 Feature not yet implemented - Contact Technical Support


E_ERROR_FEATURE_NOT_YET_IMPLEMENTED

32767 Internal error - Contact Technical Support


E_ERROR_INTERNAL_ERROR

602

Appendix

3.

MATRIX CODES SIZES AND DATA CAPACITY


ECC 000
Data Capacity

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

C++ Reference Manual 6.7.1

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

C++ Reference Manual 6.7.1

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

C++ Reference Manual 6.7.1

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

C++ Reference Manual 6.7.1

4.

NORMALIZED PRINT QUALITY INDICATORS

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

AN = abs(XAVG - YAVG) / ((XAVG + YAVG)/2)


where abs() yields the absolute value. If a symbology has more than two major axes, then AN is computed
for those two average spacings which differ the most. Axial Nonuniformity is then graded as:
A (4.0) if AN < 0.06
B (3.0) if AN < 0.08
C (2.0) if AN < 0.10
D (1.0) if AN < 0.12
F (0.0) if AN > 0.12
Axial Nonuniforrnity tests for uneven scaling of the symbol which would hinder readability at some nonnormal viewing angles more than others.
N.2.5 Unused Error Correction
The correction capacity of Reed-Solomon decoding is expressed in the equation:
e + 2t <= d - p
where:
e is the number of erasures,
t is the number of errors,
d is the number of error correction codewords,
p is the number of codewords reserved for error detection.
Values for d and p are defined by symbology specification (often depending on symbol size), while e and t
are determined during the successful reference decode. The amount of Unused Error Correction is
computed as UEC = 1.0 - (e+2t)/(d-p).
In symbols with more than one (e.g., interleaved) Reed-Solomon block, UEC shall be calculated for each
block independently, then the lowest value graded as:
A (4.0) if UEC > 0.62
B (3.0) if UEC > 0.50
C (2.0) if UEC > 0.37
D (1.0) if UEC > 0.25
F (0.0) if UEC < 0.25
The Unused Error Correction parameter tests the extent to which regional or spot damage in the symbol
has eroded the reading safety margin that error correction provides.

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

UEC >= 0.62

B (3.0)

SC >= 55%

-0.70<=D'<=0.70

AN <= 0.08

UEC >= 0.50

C (2.0)

SC >= 40%

-0.85<=D'<=0.85

AN <= 0.10

UEC >= 0.37

D (1.0)

SC >= 20%

-1.00<=D'<=1.00

AN <= 0.12

UEC >= 0.25

SC < 20%

D' < -1 or D' > 1

AN > 0.12

UEC < 0.25

F (0.0)

Fails

Table N1: Summary of 2D Matrix Bar Code Print Quality Parameters

N.3 Overall Symbol Grade


The overall symbol grade is the lowest of the parameter grades achieved above. Table N1 summarizes
the test parameters and grade levels.

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

AngleBias (PatternFinder) .......................... 358


AngleStep, Get (EMatch)............................ 382
AngleTolerance........................................... 358
AngleTolerance (PatternFinder) ................. 358
ANTICLOCKWISE_ROTATION ................. 185
Area
ImgArea .......................................................... 160
ImgAreaDoubleThreshold ............................... 160

Area ............................................................ 160


Area ............................................................ 160
ARITH_LOGIC_OPERATIONS .................. 182
Arithmetic .................................................... 124
Attach.................................................... 24, 266
Attach (EChecker)....................................... 440
AutoCalibrate .............................................. 534
AutoCalibrateLandmarks ............................ 538
Average
EMovingAverage............................................. 109
ImgLocalAverage ............................................ 164
ImgPixelAverage ............................................. 164

Average....................................................... 109
Average....................................................... 109
Average....................................................... 164
Average....................................................... 164
Average, Get (EChecker) ........................... 441
AverageSamples, GetNum (EChecker)...... 446

613

C++ Reference Manual 6.7.1

AxialNonUniformity (MatrixCode) ................471


AxialNonUniformityGrade (MatrixCode) ......471

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

BRC_SYMBOLOGIES enum...................... 461


BuildHoles (ECodedImage) ........................ 241
BuildLabeledObjects (ECodedImage) ........ 228
BuildLabeledRuns (ECodedImage) ............ 244
BuildObjects (ECodedImage) ..................... 228
BuildObjects (EOCR).................................. 340
BuildRuns (ECodedImage) ......................... 244

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

Chroma ....................................................... 573


Class ................................................... 224, 225
Class members (EMatchPosition) .............. 387
Class members (Vector<>)........................... 65
ClearBatchStatistics.................................... 503
ClearImage (EMatch).................................. 374
ClearStatistics ............................................. 423
CLOCKWISE_ROTATION.......................... 185
Close
ImgCloseBox...................................................141
ImgCloseDisk .................................................. 142

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

ClrVSHToRGB .................................... 200, 201


ClrXYZToLAB ..................................... 200, 201
ClrXYZToLUV ..................................... 200, 201
ClrXYZToRGB .................................... 200, 201
ClrYIQToRGB ..................................... 200, 201
ClrYSHToRGB .................................... 200, 201
ClrYUVToRGB .................................... 200, 201
CoarseStage (PatternFinder)...................... 359
CodedImage ............................................... 224
ColorLookup................................................ 193
CompareAspectRatio, Get/Set (EOCR) ..... 335
ComputeDefaultTolerances ........................ 418
ComputeGrading (MatrixCodeReader)....... 475
ConfidenceRatio, Get (EOCR).................... 344
Configuration............................................... 559
CONNEXITY ............................................... 183
Connexity, Get/Set (ECodedImage) ........... 226
Constructor (EBarCode) ............................. 452
Constructor (EChecker) .............................. 440
Constructor (EcodedImage)........................ 224
Constructor (EMatch).................................. 372
Constructor (EOCR) ................................... 333
Constructor (MatrixCode) ........................... 472
Continuous tone.......................................... 574
Contour ....................................................... 157
CONTOUR_MODE..................................... 183
CONTOUR_THRESHOLD ......................... 183
Contrast
Type ............................................................ 365
Type, enum .................................................481

Contrast (MatrixCode) ................................ 470


Contrast (SearchParamsType) ................... 474
ContrastGrade (MatrixCode) ...................... 470
ContrastMode ............................................. 358
ContrastMode (PatternFinder) .................... 358
ContrastMode, Get/Set (EMatch) ............... 376
ContrastType (MatrixCode) ........................ 469
ConversionFactorTo ..................................... 66
ConvertFromRGB ....................................... 197
ConvertToRGB ........................................... 196
Convolution
ImgConvolGaussian ........................................ 137
ImgConvolGradient ......................................... 133
ImgConvolGradientX....................................... 133
ImgConvolGradientY....................................... 133
ImgConvolHighpass1 ...................................... 129

615

C++ Reference Manual 6.7.1


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 (Imgaes)................... 137, 177

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

C++ Reference Manual 6.7.1

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

EBarCode GetDecodedSymbology ............ 453


EBarCode GetNumDecodedSymbologies.. 453
EBarCode GetNumEnabledSymbologies... 453
EBarCode GetPanX/Y ................................ 460
EBarCode GetRelativeReadingSizeX/Y ..... 458
EBarCode GetRelativeReadingX/Y ............ 458
EBarCode GetZoomX/Y ............................. 460
EBarCode HitTest....................................... 459
EBarCode Overview ................................... 452
EBarCode Read.......................................... 453
EBarCode SetPan ...................................... 460
EBarCode SetReadingCenter..................... 458
EBarCode SetReadingSize ........................ 458
EBarCode SetZoom.................................... 460
EBGA .................................................. 486, 487
EBGA DisableBehaviorFilter....................... 506
EBGA EnableBehaviorFilter ....................... 505
EBGA Get/SetPackCloseBlobs .................. 492
EBGA GetRegularPlacement ..................... 512
EBGA Introduction ...................................... 485
EBGAArray Overview ................................. 520
EBGABall .................................................... 514
EBGAComponent ....................................... 522
EBW1............................................................ 12
EBW16.......................................................... 12
EBW16Vector ................................................. 7
EBW32.......................................................... 12
EBW32Vector ................................................. 7
EBW8............................................................ 12
EBW8PathVector ............................................ 7
EBW8Vector ................................................... 7
EBWHistogramVector..................................... 7
EC15 ............................................................. 12
EC16 ............................................................. 12
EC24 ..................................................... 12, 575
EC24A........................................................... 12
EC24PathVector ............................................. 7
EC24Vector..................................................... 7
eCharsSelectionMode ................................ 417
EChecker AddPathName............................ 443
EChecker Attach......................................... 440
EChecker BatchLearn................................. 444
EChecker Construction............................... 440
EChecker Drag ........................................... 445
EChecker Draw........................................... 444
619

C++ Reference Manual 6.7.1

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

ECodedImage FeatureMaximum................ 229


ECodedImage FeatureMinimum................. 229
ECodedImage FeatureVariance ................. 230
ECodedImage Get/Set BlackClass............. 224
ECodedImage Get/Set Connexity............... 226
ECodedImage Get/Set DrawDiagonals ...... 234
ECodedImage Get/Set HighColorThreshold225
ECodedImage Get/Set HighImage ............. 225
ECodedImage Get/Set HighThreshold ....... 225
ECodedImage Get/Set LimitAngle.............. 231
ECodedImage Get/Set LowColorThreshold 226
ECodedImage Get/Set LowImage .............. 226
ECodedImage Get/Set LowThreshold........ 226
ECodedImage Get/Set MaxObjects............ 229
ECodedImage Get/Set NeutralClass .......... 224
ECodedImage Get/Set Threshold............... 227
ECodedImage Get/Set WhiteClass ............ 225
ECodedImage GetCurrentObjData............. 237
ECodedImage GetCurrentObjPtr................ 238
ECodedImage GetCurrentRunData............ 245
ECodedImage GetCurrentRunPtr............... 246
ECodedImage GetFeatArrayPtr.................. 250
ECodedImage GetFeatDataPtr................... 251
ECodedImage GetFeatDataSize ................ 251
ECodedImage GetFeatDataType ............... 251
ECodedImage GetFeatNum ....................... 251
ECodedImage GetFeatPtrByNum .............. 252
ECodedImage GetFeatSize........................ 252
ECodedImage GetFirstHole........................ 242
ECodedImage GetFirstObjData.................. 237
ECodedImage GetFirstObjPtr..................... 238
ECodedImage GetFirstRunData................. 245
ECodedImage GetFirstRunPtr.................... 246
ECodedImage GetHoleParentObject ......... 242
ECodedImage GetLastObjData .................. 238
ECodedImage GetLastObjPtr ..................... 238
ECodedImage GetLastRunData ................. 245
ECodedImage GetLastRunPtr .................... 246
ECodedImage GetNextHole ....................... 242
ECodedImage GetNextObjData ................. 238
ECodedImage GetNextObjPtr .................... 239
ECodedImage GetNextRunData ................ 246
ECodedImage GetNextRunPtr ................... 247
ECodedImage GetNumFeatures ................ 252
ECodedImage GetNumHoleRuns............... 248

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

ECodedImage UnselectObject ................... 232


EColor ......................................................... 576
EColorLookup ............................................. 193
EColorVector................................................... 7
EFailure......................................................... 87
EFeatureData.............................................. 258
EFrameShape
Set............................................................... 316

EFrameShape..................................... 315, 316


EFrameShape Constructor ......................... 316
EFrameShape overview ............................. 315
EFromRadians .............................................. 91
EGenericROI............................................... 574
EGetAngleUnit .............................................. 91
EGetError...................................................... 86
EGetErrorText............................................... 86
EGetRecursiveCopyBehavior ....................... 86
EGetTraceMode............................................ 87
EGetVersion.................................................. 93
EImage/ROI...
CopyTo..........................................................15
Operator= ......................................................16

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

ELineGauge ................................................ 287


ELineGauge Constructor ............................ 288
EListItem ..................................................... 259
ELSH........................................................... 576
ELUV........................................................... 576
EMatch ClearImage .................................... 374
EMatch Constructor .................................... 372

621

C++ Reference Manual 6.7.1

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

EmptyPathNames (EChecker).................... 443


EnableBehaviorFilter .................................. 505
EnabledSymbologies, GetNum (EBarCode)453
enum ARITH_LOGIC_OPERATIONS ........ 182
enum BGA_DIAGNOSTICS ....................... 527
enum BGA_QUALITY_INDICATORS......... 527
enum BGA_SYMMETRY............................ 527
enum BRC_SYMBOLOGIES...................... 461
enum CONNEXITY ..................................... 183
enum CONTOUR_MODE........................... 183
enum CONTOUR_THRESHOLD ............... 183
enum Contrast
Type ............................................................ 481

enum DATA_SIZE ........................................ 94


enum DATA_TYPE ....................................... 94
enum E_ANGLE_UNITS .............................. 94
enum E_COLOR_QUANTIZATION............ 216
enum E_COLOR_SYSTEM........................ 215
enum E_CORRELATION_MODE............... 388
enum E_FRAME_POSITION........................ 95
enum E_HANDLES ...................................... 95
enum E_IMAGE_TYPES .............................. 97
enum E_MEASUREMENT_UNITS............... 94
enum E_RGB_STANDARD........................ 215
enum E_SELECTION_MODE ...................... 95
enum E_STATE ............................................ 97
enum E_TRACE_MODE .............................. 95
enum Family
Type ............................................................ 482

enum Flipping
Type ............................................................ 482

enum GGE_PLOT_ITEMS ......................... 321


enum GGE_TRANSITION_CHOICE .......... 320
enum GGE_TRANSITION_TYPE............... 320
enum Handles
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

EOCR Constructor...................................... 333


EOCR DrawChar ........................................ 349
EOCR DrawChars ...................................... 349
EOCR Dump ............................................... 348
EOCR EmptyChars..................................... 339
EOCR FindAllChars.................................... 340
EOCR Get/Set CharSpacing ...................... 333
EOCR Get/Set CompareAspectRatio ......... 335
EOCR Get/Set CutLargeChars................... 336
EOCR Get/Set MatchingMode.................... 338
EOCR Get/Set MaxCharHeight .................. 333
EOCR Get/Set MaxCharWidth ................... 334
EOCR Get/Set MinCharHeight ................... 334
EOCR Get/Set MinCharWidth .................... 334
EOCR Get/Set NoiseArea .......................... 335
EOCR Get/Set RelativeSpacing ................. 336
EOCR Get/Set RemoveBorder ................... 337
EOCR Get/Set RemoveNarrowOrFlat ........ 335
EOCR Get/Set SegmentationMode ............ 336
EOCR Get/Set ShiftingMode ...................... 339
EOCR Get/Set ShiftXTolerance.................. 338
EOCR Get/Set ShiftYTolerance.................. 339
EOCR Get/Set TextColor............................ 337
EOCR Get/Set Threshold ........................... 337
EOCR GetConfidenceRatio ........................ 344
EOCR GetFirstCharCode ........................... 344
EOCR GetFirstCharDistance...................... 344
EOCR GetNumChars ................................. 342
EOCR GetNumPatterns.............................. 347
EOCR GetPatternBitmap............................ 347
EOCR GetPatternClass .............................. 347
EOCR GetPatternCode .............................. 347
EOCR GetPatternHeight............................. 348
EOCR GetPatternWidth.............................. 348
EOCR GetSecondCharCode ...................... 344
EOCR GetSecondCharDistance................. 344
EOCR GetTrueThreshold ........................... 338
EOCR HitChars........................................... 346
EOCR LearnPattern.................................... 346
EOCR LearnPatterns.................................. 346
EOCR Load................................................. 348
EOCR MatchChar ....................................... 340
EOCR NewFont .......................................... 348
EOCR Overview.......................................... 333
EOCR ReadText ......................................... 340
623

C++ Reference Manual 6.7.1

EOCR Recognize ........................................341


EOCR RemovePattern ................................347
EOCR Save .................................................348
EOCV...........................................................401
EOCV Get/SetWhiteOnBlack ......................419
EOCVChar...................................................426
EOCVText....................................................429
EOk................................................................87
EOpenImageDC ............................................89
EPathVector ....................................................7
EPeaksVector..................................................7
EPointGauge ...............................................284
EPointGauge Constructor............................285
Equalize .......................................................156
ERectangleGauge constructor ....................301
ERectangleGauge Get/Set KnownAngle.....304
ERectantgleGauge ......................................299
ERender3D....................................................90
ERenderColorHistogram ...............................90
EResize .........................................................84
ERGB...........................................................576
Erode
ImgErodeBox.................................................. 143
ImgErodeDisk ................................................. 144

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

EWedgeGauge ........................................... 306


EWedgeGauge Construtor ......................... 307
EWorldShape Draw .................................... 548
EWorldShape DrawCrossGrid .................... 548
EWorldShape DrawGrid ............................. 548
EWorldShape EmptyLandmarks................. 537
EWorldShape GetPan X/Y.......................... 549
EWorldShape GetZoom X/Y....................... 549
EWorldShape Overview.............................. 533
EWorldShape SetPan................................. 549
EWorldShape SetZoom .............................. 549
Exception .................................................... 567
Extension, Set (EMatch) ............................. 383
EXYZ........................................................... 576
EYIQ ........................................................... 576
EYSH .......................................................... 576
EYUV .......................................................... 576

F
Family
Type, enum .................................................482

Family (MatrixCode) ................................... 469


Family (SearchParamsType) ...................... 474
FeatArrayPtr, Get (ECodedImage) ............. 250
FeatDataPtr, Get (ECodedImage) .............. 251
FeatDataSize, Get (ECodedImage)............ 251
FeatDataType, Get (ECodedImage)........... 251
FeatInfo, Set (ECodedImage)..................... 252
FeatNum, Get (ECodedImage)................... 251
FeatPtrByNum, Get (ECodedImage) .......... 252
FeatSize, Get (ECodedImage) ................... 252
FeatureAverage (ECodedImage)................ 230
FeatureMaximum (ECodedImage) ............. 229
FeatureMinimum (ECodedImage) .............. 229
Features

Index
ObjContourArea.............................................. 254
ObjContourGravityCenter ............................... 254
ObjContourInertia ........................................... 254

Features.............................. 229, 230, 233, 234


Features.......................................................254
Features.......................................................254
Features.......................................................254
FeatureVariance (ECodedImage) ...............230
FilteringMode...............................................375
FilteringMode, Get/Set (EMatch).................375
FinalReduction, Get/Set (EMatch)...............377
Find..............................................................360
Find (PatternFinder) ....................................360
FindAllChars (EOCR) ..................................340
FindExtension..............................................358
FineStage (PatternFinder) ...........................360
FirstCharCode, Get (EOCR)........................344
FirstCharDistance, Get (EOCR) ..................344
FirstHole, Get (ECodedImage)....................242
FirstObjData, Get (ECodedImage) ..............237
FirstObjPtr, Get (ECodedImage) .................238
FirstRunData, Get (ECodedImage) .............245
FirstRunPtr, Get (ECodedImage) ................246
FirstRunPtr, Set (ECodedImage) ................246
Flipping
Type, enum................................................. 482

Flipping (MatrixCode) ..................................469


Flipping (SearchParamsType).....................474
FLOAT32 .......................................................12
FLOAT64 .......................................................12
ForcedThreshold .........................................356
FoundPattern
Angle .......................................................... 363
Center......................................................... 363
Scale........................................................... 363
Score .......................................................... 363
Draw ........................................................... 364
Draw ........................................................... 364

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

C++ Reference Manual 6.7.1

Get/Set KnownModule (EBarCode) ............456


Get/Set Labeled...........................................267
Get/Set Length ............................................289
Get/Set LimitAngle (ECodedImage) ............231
Get/Set MatchingMode (EOCR)..................338
Get/Set MaxAngle (EMatch)........................380
Get/Set MaxCharHeight (EOCR) ................333
Get/Set MaxCharWidth (EOCR)..................334
Get/Set MaxInitialPositions (EMatch)..........378
Get/Set MaxPositions (EMatch) ..................377
Get/Set MaxScale (EMatch) ........................380
Get/Set MaxScaleX (EMatch) .....................381
Get/Set MaxScaleY (EMatch) .....................382
Get/Set MinAmplitude..................................270
Get/Set MinAngle (EMatch).........................379
Get/Set MinArea ..........................................271
Get/Set MinCharHeight (EOCR) .................334
Get/Set MinCharWidth (EOCR)...................334
Get/Set MinReducedArea (EMatch)............374
Get/Set MinScale (EMatch) .........................380
Get/Set MinScaleX (EMatch).......................381
Get/Set MinScaleY (EMatch).......................381
Get/Set MinScore (EMatch).........................378
Get/Set Module (EBarCode)........................456
Get/Set NoiseArea (EOCR).........................335
Get/Set Normalize (EChecker)....................441
Get/Set NumFilteringPasses .......................274
Get/Set OptionalDraw..................................268
Get/Set PerspectiveStrength .......................545
Get/Set PixelDimensions (EMatch) .............379
Get/Set QuickDraw......................................268
Get/Set Radius ............................................295
Get/Set ReadingAngle (EBarCode).............459
Get/Set RectangularSamplingArea (E... Gauge)
.................................................................271
Get/Set RelativeSpacing (EOCR) ...............336
Get/Set RelativeTolerance (EChecker) .......443
Get/Set RemoveBorder (EOCR) .................337
Get/Set RemoveNarrowOrFlat (EOCR) ......335
Get/Set Resizable........................................319
Get/Set Rotatable ........................................319
Get/Set SamplingStep .................................273
Get/Set SegmentationMode (EOCR) ..........336
Get/Set ShiftingMode (EOCR) ....................339
Get/Set ShiftXTolerance..............................338

626

Get/Set ShiftXTolerance (EOCR) ............... 338


Get/Set ShiftYTolerance ............................. 339
Get/Set ShiftYTolerance (EOCR) ............... 339
Get/Set Smoothing ..................................... 272
Get/Set StandardSymbologies (EBarCode) 455
Get/Set TextColor (EOCR) ......................... 337
Get/Set Thickness ...................................... 271
Get/Set ThicknessRatio (EBarCode) .......... 457
Get/Set Threshold....................................... 270
Get/Set Threshold (EOCR)......................... 337
Get/Set Tolerance....................................... 298
Get/Set TransitionChoice............................ 269
Get/Set TransitionIndex .............................. 269
Get/Set TransitionType............................... 269
Get/Set VerifyChecksum (EBarCode) ........ 457
GetAccurateTextsLocationScore ................ 422
GetAdditionalSymbologies (EBarCode) ..... 455
GetAmplitude .............................................. 312
GetAngle ..................................................... 542
GetAngleStep (EMatch).............................. 382
GetApex ...................................................... 297
GetApexAngle............................................. 311
GetArcLength.............................................. 295
GetArray...................................................... 507
GetArrayCenterX ........................................ 509
GetArrayCenterY ........................................ 509
GetArrayNumBalls ...................................... 508
GetArrayNumCols....................................... 508
GetArrayNumRows..................................... 508
GetArrayPitchX ........................................... 509
GetArrayPitchY ........................................... 509
GetArraySizeX ............................................ 509
GetArraySizeY ............................................ 509
GetAuthor...................................................... 28
GetAutoCalibrateBalls ................................ 513
GetAutoCalibrateWorld............................... 513
GetAverage (EChecker) ............................. 441
GetAverageCircularity................. 500, 518, 525
GetAverageDiameter .................. 500, 517, 525
GetAverageDistance................................... 279
GetAverageDoughnutness ......... 501, 518, 526
GetAverageOffset ....................... 498, 516, 524
GetAveragePitch......................... 499, 517, 524
GetBall ........................................................ 507
GetBallCircularityTolerance ........................ 488

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

C++ Reference Manual 6.7.1

GetFirstObjPtr (ECodedImage) ...................238


GetFirstRunData (ECodedImage) ...............245
GetFirstRunPtr (ECodedImage) ..................246
GetFirstSubROI .............................................25
GetFlipImage .................................................74
GetFull .........................................................297
GetGain .......................................................105
GetGenericImagePtr......................................27
GetGridpointsMaxVariation .........................535
GetGridPointsMaxVariationThreshold.........535
GetGridPointsMeanVariation.......................535
GetGridPointsMeanVariationThreshold.......535
GetHeight.................................................23, 69
GetHighColorThreshold (ECodedImage) ....225
GetHighImage (ECodedImage)...................225
GetHighThreshold (ECodedImage).............225
GetHitHandle ...............................................281
GetHitHandle (EChecker)............................444
GetHitRoi (EChecker)..................................444
GetHitShape ................................................281
GetHoleParentObject (ECodedImage)........242
GetImage .......................................................73
GetImages .....................................................73
GetImageType...............................................69
GetIndexBits ................................................194
GetInitialMinScore (EMatch)........................378
GetInnerFilteringThreshold (ECircleGauge)298
GetInnerFilteringThreshold (ERectangleGauge)
.................................................................305
GetInnerRoiDiameter...................................492
GetInterpolate (EMatch) ..............................376
GetInterpolation ...........................................194
GetKernelData.............................................104
GetKeyFrameRate.........................................75
GetKnownLocation (EBarCode) ..................456
GetKnownModule (EBarCode)....................456
GetLastObjData (ECodedImage) ................238
GetLastObjPtr (ECodedImage) ...................238
GetLastRunData (ECodedImage) ...............245
GetLastRunPtr (ECodedImage) ..................246
GetLightGray (EChecker) ............................442
GetLimitAngle ..............................................231
GetLowColorThreshold (ECodedImage) .....226
GetLowImage (ECodedImage)....................226
GetLowThreshold (ECodedImage)..............226

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

GetMinScaleY (EMatch) ..............................381


GetMinScore (EMatch) ................................378
GetModule (EBarCode) ...............................456
GetMother....................................................318
GetName .......................................................66
GetNeutralClass (ECodedImage)................224
GetNextHole (ECodedImage) .....................242
GetNextObjData (ECodedImage)................238
GetNextObjPtr (ECodedImage)...................239
GetNextROI ...................................................26
GetNextRunData (ECodedImage)...............246
GetNextRunPtr (ECodedImage)..................247
GetNextSiblingROI ........................................25
GetNoiseArea (EOCR) ................................335
GetNormalize (EChecker) ...........................441
GetNormalizeLocationScore .......................421
GetNumArrays.............................................507
GetNumAverageSamples (EChecker) ........446
GetNumBalls .......................................504, 523
GetNumBallsFound .............................497, 523
GetNumBatchSamples ................................516
GetNumChars (EOCR)................................342
GetNumClutter.............................................497
GetNumComponents...................................511
GetNumDaughters.......................................318
GetNumDecodedSymbologies (EBarCode) 453
GetNumDeviationSamples (EChecker).......446
GetNumElements ..........................................64
GetNumEnabledSymbologies (EBarCode) .453
GetNumExtraBalls .......................................497
GetNumFeatures (ECodedImage) ..............252
GetNumHoleRuns (ECodedImage).............248
GetNumHoles (ECodedImage) ...................241
GetNumMeasuredPoints .............................287
GetNumMissingBalls ...........................497, 523
GetNumObjectRuns (ECodedImage)..........248
GetNumObjects (ECodedImage) ................239
GetNumPatterns (EOCR) ............................347
GetNumPositions (EMatch) .........................383
GetNumRate..................................................74
GetNumReductions (EMatch)......................377
GetNumRuns (ECodedImage) ....................248
GetNumSamples .........................................279
GetNumSelectedObjects (ECodedImage) ..231
GetNumSkipRanges....................................276

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

C++ Reference Manual 6.7.1

GetReadingAngle (EBarCode) ....................459


GetRectangularSamplingArea (E... Gauge) 271
GetRectifier..................................................106
GetRelativeReadingSizeX/Y (EBarCode) ...458
GetRelativeReadingX/Y (EBarCode) ..........458
GetRelativeSpacing (EOCR) .......................336
GetRelativeTolerance (EChecker) ..............443
GetRemoveBorder (EOCR).........................337
GetRemoveNarrowOrFlat (EOCR)..............335
GetResampleChars .....................................421
GetResolution................................................32
GetRowPitch..................................................28
GetRunData (ECodedImage) ......................247
GetRunDataPtr (ECodedImage) .................247
GetRunPtr (ECodedImage) .........................249
GetRunPtrByCoordinates (ECodedImage) .249
GetScale ......................................................541
GetScaleStep (EMatch)...............................382
GetScaleX/YStep (EMatch) .........................382
GetSecondCharCode (EOCR) ....................344
GetSecondCharDistance (EOCR)...............344
GetSegmentationMode (EOCR)..................336
GetSensor Widht/Height..............................539
GetShapeNamed.........................................267
GetShiftingMode (EOCR) ............................339
GetShiftXTolerance (EOCR) .......................338
GetShiftYTolerance (EOCR) .......................339
GetSignalInfo...............................................561
GetSingulatedComponents .........................491
GetSize ........................................................108
GetSize X/Y .................................................317
GetSizeX......................................................106
GetSizeY......................................................106
GetSkipRange .............................................276
GetSrcImage ...............................................109
GetSrcImage (EChecker) ............................440
GetStandardSymbologies (EBarCode) .......455
GetState.........................................................70
GetStatisticsCount.......................................423
GetSymmetry...............................................510
GetTemplateImage......................................407
GetTextCharParameters .............................415
GetTextCharPoint........................................406
GetTextColor (EOCR) .................................337
GetTextParameters .............................412, 413
630

GetTextPoint ............................................... 405


GetThicknessRatio (EBarCode) ................. 457
GetThreshold (ECodedImage).................... 227
GetThreshold (EOCR) ................................ 337
GetTilt X/Y Angle ........................................ 543
GetTitle ......................................................... 30
GetTolerance .............................................. 286
GetToleranceAngle..................................... 286
GetToleranceX/Y (EChecker) ..................... 440
GetTopParent ............................................... 25
GetTotalHeight.............................................. 24
GetTotalOrgX................................................ 23
GetTotalOrgY................................................ 24
GetTotalWidth ............................................... 24
GetTrueThreshold (ECodedImage) ............ 227
GetTrueThreshold (EOCR)......................... 338
GetType ................................................ 30, 284
GetUnit.................................................. 67, 487
GetUsedQualityIndicators........................... 420
GetValid ...................................................... 278
GetValue ....................................................... 67
GetVerifyChecksum (EBarCode)................ 457
GetVersion (EMatch) .................................. 386
GetWhiteClass (ECodedImage) ................. 225
GetWhiteOnBlack ....................................... 490
GetWidth ................................................. 23, 69
GetYOriginOffset (ECodedImage ) ............. 253
GetZoomX/Y (EBarCode) ........................... 460
GetZoomX/Y (EChecker)............................ 445
GetZoomX/Y (EWorldShape) ..................... 549
Gradient
ImgConvolGradient ......................................... 133
ImgConvolGradientX....................................... 133
ImgConvolGradientY....................................... 133
ImgMorphoGradientBox .................................. 146
ImgMorphoGradientDisk ................................. 147

Gradient ...................................................... 133


Gradient ...................................................... 133
Gradient ...................................................... 133
Gradient ...................................................... 146
Gradient ...................................................... 147
GravityCenter.............................................. 162
Gray ............................................................ 574
Gray scale................................................... 574
Green
RGB Color System.......................................... 575

Index

Green...........................................................575

H
Handles
Type, enum................................................. 482

HighColorThreshold, Get/Set (ECodedImage)


.................................................................225
HighImage, Get/Set (ECodedImage) ..........225
Highpass
ImgConvolHighpass1 ..................................... 129
ImgConvolHighpass2 ..................................... 129

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

C++ Reference Manual 6.7.1

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

ImgConvolUniform ...................................... 137


ImgConvolUniform ...................................... 177
ImgCopy...................................................... 127
ImgCount .................................................... 163
ImgCumulateHistogram .............................. 155

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

Inphase ....................................................... 573


INS_ACTUAL.............................................. 550
INS_NOMINAL............................................ 550
INS_SHAPE_BEHAVIOR ........................... 324
Inspect ........................................ 422, 447, 487
INT16 ............................................................ 12
INT32 ............................................................ 12
INT8 .............................................................. 12
Intensity
ISH Color System............................................ 574

Intensity....................................................... 574
Interpolate (PatternFinder).......................... 359
Interpolate, Get/Set (EMatch) ..................... 376
Introduction (Easy).......................................... 5
Introduction (EasyBarCode) ....................... 451

633

C++ Reference Manual 6.7.1

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

LearnPattern (EMatch) ............................... 373


LearnPattern (EOCR) ................................. 346
LearnPatterns (EOCR) ............................... 346
Learnt, IsPattern (EMatch).......................... 373
LightBalance ............................................... 357
LightGray, Get (EChecker) ......................... 442
Lightness
LSH Color System........................................... 575

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

LogicalSize (MatrixCode) ............................469


LogicalSize (SearchParamsType)...............474
LogicalSizeHeight (MatrixCode)..................469
LogicalSizeWidth (MatrixCode) ...................469
LookUpTable ...............................................115
LowColorThreshold, Get/Set (ECodedImage)226
LowImage, Get/Set (ECodedImage) ...........226
Lowpass
ImgConvolLowpass1 ...................................... 131
ImgConvolLowpass2 ...................................... 132
ImgConvolLowpass3 ...................................... 132

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

m_f32BackgroundSumDeviation ........ 428, 432


m_f32BackgroundSumTolerance ....... 427, 431
m_f32CenterX (EMatchPosition) ................ 387
m_f32CenterY (EMatchPosition) ................ 387
m_f32Correlation ................................ 427, 431
m_f32CorrelationAverage................... 428, 432
m_f32CorrelationDeviation ................. 428, 432
m_f32CorrelationTolerance ................ 427, 431
m_f32ForegroundAreaAverage .......... 428, 432
m_f32ForegroundAreaDeviation......... 428, 432
m_f32ForegroundSumAverage .......... 428, 432
m_f32ForegroundSumDeviation......... 428, 432
m_f32ForegroundSumTolerance........ 427, 431
m_f32LocationScoreAverage ............. 428, 432
m_f32LocationScoreDeviation............ 428, 432
m_f32LocationScoreTolerance................... 426
m_f32SampleBackgroundSum ........... 427, 431
m_f32SampleForegroundSum............ 427, 431
m_f32SampleLocationScore....................... 426
m_f32Scale (EMatchPosition) .................... 387
m_f32ScaleX............................................... 430
m_f32ScaleXAverage ................................. 432
m_f32ScaleXBias........................................ 430
m_f32ScaleXDeviation ............................... 432
m_f32ScaleXTolerance .............................. 430
m_f32ScaleY............................................... 430
m_f32ScaleYAverage ................................. 432
m_f32ScaleYBias........................................ 430
m_f32ScaleYDeviation ............................... 432
m_f32ScaleYTolerance .............................. 430
m_f32Score (EMatchPosition) .................... 387
m_f32Shear ................................................ 430
m_f32ShearAverage................................... 432
m_f32ShearBias ......................................... 430
m_f32ShearDeviation ................................. 432
m_f32ShearTolerance ................................ 430
m_f32ShiftX ........................................ 427, 430
m_f32ShiftXAverage........................... 428, 432
m_f32ShiftXBias ................................. 427, 430
m_f32ShiftXDeviation ......................... 428, 432
m_f32ShiftXTolerance ........................ 427, 430
m_f32ShiftY ........................................ 427, 430
m_f32ShiftYAverage........................... 428, 432
m_f32ShiftYBias ................................. 427, 430
m_f32ShiftYDeviation ......................... 428, 432
635

C++ Reference Manual 6.7.1

m_f32ShiftYTolerance .........................427, 430


m_f32Skew..................................................430
m_f32SkewAverage ....................................432
m_f32SkewBias...........................................430
m_f32SkewDeviation...................................432
m_f32SkewTolerance..................................430
m_f32TemplateBackgroundSum.........427, 431
m_f32TemplateForegroundSum .........427, 431
m_f32TemplateLocationScore ....................426
m_FreeChars...............................................409
m_Objects ...................................................408
m_TemplateImage.......................................407
m_Texts .......................................................410
m_un32BackgroundAreaTolerance.....427, 431
m_un32Diagnostics .............................427, 431
m_un32ForegroundAreaTolerance .....427, 431
m_un32MarginWidth ...........................427, 431
m_un32NumContourPoints .........................426
m_un32SampleBackgroundArea ........427, 431
m_un32SampleForegroundArea .........427, 431
m_un32ScaleXCount...................................430
m_un32ScaleYCount...................................430
m_un32ShearCount ....................................430
m_un32ShiftXStride.............................427, 430
m_un32ShiftYStride.............................427, 430
m_un32SkewCount .....................................430
m_un32TemplateBackgroundArea......427, 431
m_un32TemplateForegroundArea ......427, 431
Match (EMatch) ...........................................374
MATCH_0 ....................................................447
MATCH_1 ....................................................447
MatchChar (EOCR) .....................................340
MatchFrames...............................................180
MatchingMode, Get/Set (EOCR).................338
Matrix codes sizes and data capacity..........602
MatrixCode Angle ........................................468
MatrixCode AxialNonUniformity ..................471
MatrixCode AxialNonUniformityGrade ........471
MatrixCode Center ......................................468
MatrixCode Constructor...............................472
MatrixCode Contrast....................................470
MatrixCode ContrastGrade..........................470
MatrixCode ContrastType............................469
MatrixCode Corners[4] ................................468
MatrixCode DecodedString .........................468
636

MatrixCode Draw ........................................ 473


MatrixCode DrawErrors .............................. 473
MatrixCode Family ...................................... 469
MatrixCode Flipping.................................... 469
MatrixCode IsFound ................................... 469
MatrixCode Load......................................... 478
MatrixCode LocationThreshold................... 469
MatrixCode LogicalSize .............................. 469
MatrixCode LogicalSizeHeight.................... 469
MatrixCode LogicalSizeWidth..................... 469
MatrixCode MeasuredPrintGrowth ............. 470
MatrixCode NumErrors ............................... 469
MatrixCode Operator= ................................ 473
MatrixCode OverallGrade ........................... 472
MatrixCode Overview ................................. 467
MatrixCode PrintGrowth ............................. 470
MatrixCode PrintGrowthGrade ................... 471
MatrixCode ReadingThreshold ................... 469
MatrixCode Save ........................................ 479
MatrixCode UnusedErrorCorrection ........... 472
MatrixCode UnusedErrorCorrectionGrade . 472
MatrixCodeReader ComputeGrading ......... 475
MatrixCodeReader Learn ........................... 477
MatrixCodeReader LearnMask................... 475
MatrixCodeReader LearnMore ................... 477
MatrixCodeReader MaximumPrintGrowth.. 476
MatrixCodeReader MinimumPrintGrowth... 476
MatrixCodeReader NominalPrintGrowth .... 476
MatrixCodeReader Overview...................... 475
MatrixCodeReader Read ............................ 477
MatrixCodeReader Reset ........................... 477
MatrixCodeReader SearchParams............. 475
MatrixCodeReader TimeOut....................... 476
MaxAngle, Get/Set (EMatch) ...................... 380
MaxCharHeight, Get/Set (EOCR)............... 333
MaxCharWidth, Get/Set (EOCR) ................ 334
MaxFeaturePoints (PatternFinder) ............. 360
MaximumPrintGrowth (MatrixCodeReader) 476
MaxInitialPositions, Get/Set (EMatch) ........ 378
MaxInstances.............................................. 359
MaxInstances (PatternFinder) .................... 359
MaxObjects, Get/Set (ECodedImage) ........ 229
MaxPositions, Get/Set (EMatch)................. 377
MaxScale, Get/Set (EMatch) ...................... 380
MaxScaleX, Get/Set (EMatch).................... 381

Index

MaxScaleY, Get/Set (EMatch) ....................382


MCH_CONTRAST_ANY .............................388
MCH_CONTRAST_INVERSE.....................388
MCH_CONTRAST_MODE, enum...............388
MCH_CONTRAST_NORMAL .....................388
MCH_CONTRAST_UNKNOWN..................388
MCH_FILTERING_MODE, enum................388
Measure.......................................................272
MeasuredPrintGrowth (MatrixCode)............470
MeasureSample ..........................................272
Median .........................................................147
MinAngle, Get/Set (EMatch)........................379
MinCharHeight, Get/Set (EOCR) ................334
MinCharWidth, Get/Set (EOCR)..................334
MinFeaturePoints (PatternFinder) ...............360
MinimumPrintGrowth (MatrixCodeReader) .476
MinReducedArea, Get/Set (EMatch)...........374
MinScale, Get/Set (EMatch) ........................380
MinScaleX, Get/Set (EMatch) .....................381
MinScaleY, Get/Set (EMatch) .....................381
MinScore......................................................359
MinScore (PatternFinder) ............................359
MinScore, Get/Set (EMatch)........................378
Mirror
ImgHorizontalMirror ........................................ 151
ImgVerticalMirror ............................................ 151

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

Morphology ................................................. 140


Morphology ................................................. 141
Morphology ................................................. 142
Morphology ................................................. 142
Morphology ................................................. 143
Morphology ................................................. 143
Morphology ................................................. 144
Morphology ................................................. 144
Morphology ................................................. 145
Morphology ................................................. 145
Morphology ................................................. 146
Morphology ................................................. 146
Morphology ................................................. 147
Morphology ................................................. 147
Morphology ................................................. 148
Morphology ................................................. 148
Morphology ................................................. 149
MovingAverage ........................................... 107
MultiCam..................................................... 556
MultiCamObject .......................................... 557

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

C++ Reference Manual 6.7.1

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

Drawn Features (ECodedImage) .................... 237


enum OBJECT_FEATURES ........................... 255

OBJ_LIMIT_CENTER_Y ............................ 237


OBJ_LIMIT_CENTER_Y ............................ 255
OBJ_LIMIT_HEIGHT
Drawn Features (ECodedImage) .................... 237

OBJ_LIMIT_HEIGHT .................................. 237


OBJ_LIMIT_WIDTH ............................ 237, 255
OBJ_LIMIT22_CENTER_X
Drawn Features (ECodedImage) .................... 237

OBJ_LIMIT22_CENTER_X ........................ 237


OBJ_LIMIT22_CENTER_X ........................ 255
OBJ_LIMIT22_CENTER_Y
Drawn Features (ECodedImage) .................... 237
enum OBJECT_FEATURES ........................... 255

OBJ_LIMIT22_CENTER_Y ........................ 237


OBJ_LIMIT22_CENTER_Y ........................ 255
OBJ_LIMIT22_HEIGHT
Drawn Features (ECodedImage) .................... 237
enum OBJECT_FEATURES ........................... 255

OBJ_LIMIT22_HEIGHT .............................. 237


OBJ_LIMIT22_HEIGHT .............................. 255
OBJ_LIMIT22_WIDTH
enum OBJECT_FEATURES ........................... 255

OBJ_LIMIT22_WIDTH................................ 237
OBJ_LIMIT22_WIDTH................................ 255
OBJ_LIMIT45_CENTER_X
Drawn Features (ECodedImage) .................... 237

OBJ_LIMIT45_CENTER_X ........................ 237


OBJ_LIMIT45_CENTER_Y
Drawn Features (ECodedImage) .................... 237
enum OBJECT_FEATURES ........................... 255

OBJ_LIMIT45_CENTER_Y ........................ 237


OBJ_LIMIT45_HEIGHT
Drawn Features (ECodedImage) .................... 237
enum OBJECT_FEATURES ........................... 255

OBJ_LIMIT45_HEIGHT .............................. 237


OBJ_LIMIT68_............................................ 255
OBJ_LIMIT68_CENTER_X
Drawn Features (ECodedImage) .................... 237
enum OBJECT_FEATURES ........................... 255

OBJ_LIMIT68_CENTER_X ........................ 237


OBJ_LIMIT68_CENTER_Y
Drawn Features (ECodedImage) .................... 237
enum OBJECT_FEATURES ........................... 255

OBJ_LIMIT68_CENTER_Y ........................ 237


OBJ_LIMIT68_HEIGHT
Drawn Features (ECodedImage) .................... 237

OBJ_LIMIT68_HEIGHT .............................. 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

OCR_CLASS_14 ........................................ 350


OCR_CLASS_15 ........................................ 350
OCR_CLASS_16 ........................................ 350
OCR_CLASS_17 ........................................ 350
OCR_CLASS_18 ........................................ 350
OCR_CLASS_19 ........................................ 350
OCR_CLASS_2 .......................................... 350
OCR_CLASS_20 ........................................ 350
OCR_CLASS_21 ........................................ 350
OCR_CLASS_22 ........................................ 350
OCR_CLASS_23 ........................................ 350
OCR_CLASS_24 ........................................ 350
OCR_CLASS_25 ........................................ 350
OCR_CLASS_26 ........................................ 350
OCR_CLASS_27 ........................................ 350
OCR_CLASS_28 ........................................ 350
OCR_CLASS_29 ........................................ 350
OCR_CLASS_3 .......................................... 350
OCR_CLASS_30 ........................................ 350
OCR_CLASS_31 ........................................ 350
OCR_CLASS_4 .......................................... 350
OCR_CLASS_5 .......................................... 350
OCR_CLASS_6 .......................................... 350
OCR_CLASS_7 .......................................... 350
OCR_CLASS_8 .......................................... 350
OCR_CLASS_9 .......................................... 350
OCR_DARK_ON_LIGHT............................ 350
OCR_DIGIT ................................................ 350
OCR_KEEP_OBJECTS.............................. 351
OCR_LIGHT_ON_DARK............................ 350
OCR_LOWERCASE................................... 350
OCR_MATCH_NORMALIZED ................... 351
OCR_MATCH_RMS ................................... 351
OCR_MATCHING_MODES, enum ............ 351
OCR_REPASTE_OBJECTS ...................... 351
OCR_SHIFT_CHARS................................. 351
OCR_SHIFT_TEXT .................................... 351
OCR_SHIFTING_MODES, enum............... 351
OCR_SPECIAL........................................... 350
OCR_UPPERCASE.................................... 350
OCR_WHITE_ON_BLACK ......................... 350
OCRClasses, enum .................................... 350
OCRColor, enum ........................................ 350
OCRSegmentationMode, enum.................. 351
OCV ............................................................ 401
639

C++ Reference Manual 6.7.1

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

Open ........................................................... 140


Open ........................................................... 140
Operator[].............................................. 64, 566
Operator=.............................................. 16, 265
Operator= (EMatch) .................................... 373
Operator= (MatrixCode).............................. 473
OptionalDraw .............................................. 268
ORC_MATCH_STANDARD ....................... 351
OverallGrade (MatrixCode)......................... 472
Overlay........................................................ 128
Overview (EBarCode)................................. 452
Overview (EChecker).................................. 440
Overview (ECodedImage) .......................... 224
Overview (EMatch) ..................................... 372
Overview (EOCR) ....................................... 333
Overview (eVision).......................................... 1
Overview (FoundPattern)............................ 363
Overview (MatrixCode) ............................... 467
Overview (MatrixCodeReader) ................... 475
Overview (PatternFinder)............................ 356
Overview (SearchParamsType).................. 474
Overview (Vector<>)..................................... 64

P
Pan, Set (EBarCode) .................................. 460
Pan, Set (EChecker)................................... 445
PanX/Y, Get (EBarCode)............................ 460
PanX/Y, Get (EChecker)............................. 445
Pattern
Type ............................................................ 365

PatternBitmap, Get (EOCR) ....................... 347


PatternClass, Get (EOCR).......................... 347
PatternCode, Get (EOCR) .......................... 347
PatternFinder
ForcedThreshold ......................................... 356
LightBalance ............................................... 357
PatternType.................................................357
Pivot ............................................................ 357
ThinStructureMode...................................... 357
TransitionThickness .................................... 357
AngleBias ....................................................358
AngleTolerance ........................................... 358
ContrastMode.............................................. 358
FindExtension ............................................. 358
MaxInstances .............................................. 359

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

Prepare ....................................................... 561


PreviousObjData, Get (ECodedImage) ...... 238
PreviousObjPtr, Get (ECodedImage) ......... 238
PreviousRunData, Get (ECodedImage) ..... 245
PreviousRunPtr, Get (ECodedImage) ........ 247
Prewitt
ImgConvolPrewitt ............................................ 135
ImgConvolPrewittX.......................................... 134
ImgConvolPrewittY.......................................... 134

Prewitt ......................................................... 134


Prewitt ......................................................... 134
Prewitt ......................................................... 135
PrintGrowth (MatrixCode) ........................... 470
PrintGrowthGrade (MatrixCode) ................. 471
Process ....................................................... 272

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

Red ............................................................. 575


Reductions, GetNum (EMatch)................... 377
Register....................................................... 149
Register (EChecker) ................................... 442
RegisterCallback......................................... 561
RelativeReadingSizeX/Y, Get (EBarCode). 458
RelativeReadingX/Y, Get (EBarCode)........ 458
RelativeSpacing, Get/Set (EOCR).............. 336
641

C++ Reference Manual 6.7.1

RelativeTolerance, Get/Set (EChecker) ......443


RemoveAllFeats (ECodedImage)................252
RemoveAllObjects (ECodedImage) ............240
RemoveAllRuns (ECodedImage) ................249
RemoveAllSkipRanges................................276
RemoveArray...............................................508
RemoveBorder, Get/Set (EOCR) ................337
RemoveHoles (ECodedImage) ...................244
RemoveNarrowOrFlat, Get/Set (EOCR) .....335
RemoveObject (ECodedImage) ..................240
RemovePattern (EOCR)..............................347
RemoveRun (ECodedImage) ......................249
RemoveSkipRange......................................276
Render
ERender3D....................................................... 90
ERenderColorHistogram................................... 90

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

SearchParamsType Flipping .......................474


SearchParamsType LogicalSize .................474
SearchParamsType Overview.....................474
SecondCharCode, Get (EOCR) ..................344
SecondCharDistance, Get (EOCR).............344
Seek...............................................................71
SegmentationMode, Get/Set (EOCR) .........336
SELECT_BY_POSITION.............................257
SELECT_OPTIONS ....................................257
SelectAllObjects (ECodedImage)................231
SelectHoles (ECodedImage) .......................243
SelectObject (ECodedImage)......................232
SelectObjectsUsingFeature.........................233
SelectObjectsUsingPosition ........................233
SelectSampleTexts......................................417
SelectSampleTextsChars ............................417
SelectTemplateChars ..................................409
SelectTemplateObjects ...............................408
SelectTemplateTexts...................................411
SensorToWorld............................................546
Set ...............................................................316
Set DraggingMode.......................................283
SetAccurateTextsLocationScore .................422
SetActive......................................................562
SetAdditionalSymbologies (EBarCode).......455
SetAngle ......................................................317
SetArrayCenter............................................510
SetArrayLogicalSize ....................................508
SetArrayPhysicalSize ..................................509
SetArrayPitches...........................................509
SetAuthor.......................................................28
SetAutoCalibrateBalls..................................513
SetAutoCalibrateWorld ................................513
SetBallCircularityTolerance .........................488
SetBallDiameter...........................................507
SetBallDiameterTolerance...........................487
SetBallDoughnutnessTolerance..................489
SetBallOffsetTolerance................................488
SetBallPitchTolerance .................................488
SetBlackClass (ECodedImage)...................224
SetBlobThreshold ........................................490
SetCenter.............................................316, 523
SetCharSpacing (EOCR).............................333
SetCodecFourcc............................................74
SetColorSystem.............................................30

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

C++ Reference Manual 6.7.1

SetInnerFilteringThreshold (ECircleGauge) 298


SetInnerFilteringThreshold (ERectangleGauge)
.................................................................305
SetInnerRoiDiameter ...................................492
SetInterpolate (EMatch)...............................376
SetInterpolation ...........................................194
SetKeyFrameRate .........................................75
SetKnownLocation (EBarCode) ..................456
SetKnownModule (EBarCode) ....................456
SetLastRunPtr (ECodedImage)...................246
SetLimitAngle ..............................................231
SetLowColorThreshold (ECodedImage) .....226
SetLowImage (ECodedImage) ....................226
SetLowThreshold (ECodedImage) ..............226
SetMagnitude ................................................66
SetMatchingMode (EOCR)..........................338
SetMaxAngle (EMatch)................................380
SetMaxBlobArea..........................................490
SetMaxCharHeight (EOCR) ........................333
SetMaxCharWidth (EOCR)..........................334
SetMaxInitialPositions (EMatch)..................378
SetMaxMissingBalls ....................................491
SetMaxObjects (ECodedImage)..................229
SetMaxPositions (EMatch) ..........................377
SetMaxScale (EMatch)................................380
SetMaxScaleX (EMatch) .............................381
SetMaxScaleY (EMatch) .............................382
SetMinAngle (EMatch).................................379
SetMinBlobArea...........................................491
SetMinCharHeight (EOCR) .........................334
SetMinCharWidth (EOCR)...........................334
SetMinNumFitSamples................................275
SetMinReducedArea (EMatch)....................374
SetMinScale (EMatch).................................380
SetMinScaleX (EMatch) ..............................381
SetMinScaleY (EMatch) ..............................381
SetMinScore (EMatch) ................................378
SetModule (EBarCode) ...............................456
SetName........................................................66
SetNeutralClass (ECodedImage) ................224
SetNoiseArea (EOCR).................................335
SetNormalize (EChecker)............................441
SetNormalizeLocationScore ........................421
SetNumComponents ...................................512
SetNumElements...........................................64

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

StandardDeviation ...................................... 164


StandardDeviation ...................................... 165
StandardSymbologies, Get/Set (EBarCode)455
StartLoading.................................................. 72
StartSaving ................................................... 70
Statistics
ImgArea .......................................................... 160
ImgAreaDoubleThreshold ............................... 160
ImgBinaryMoments ......................................... 160
ImgCount.........................................................163
ImgGravityCenter ............................................ 162
ImgLocalAverage ............................................ 164
ImgLocalDeviation........................................... 165
ImgPixelAverage ............................................. 164
ImgPixelCount................................................. 163
ImgPixelMax....................................................166
ImgPixelMin..................................................... 166
ImgPixelStat ....................................................167
ImgPixelStdDev............................................... 164
ImgPixelVariance ............................................ 165

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

StdDev ........................................................ 164


StdDev ........................................................ 165
Surf ............................................................. 567
Surface................................................ 563, 564

645

C++ Reference Manual 6.7.1

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

Warp ........................................................... 152


Warp ........................................................... 152
WeightedMoment.......................................... 62
White........................................................... 573
WhiteBalance.............................................. 198
WhiteClass, Get/Set (ECodedImage) ......... 225
WhiteTopHat
ImgWhiteTopHatBox ....................................... 144

Index
ImgWhiteTopHatDisk...................................... 145

WhiteTopHat................................................144
WhiteTopHat................................................145
WorldToSensor............................................546

Y 573
Y 573
Y 573
YOriginOffset, Get (ECodedImage) ............ 253

X
X

Z
Z

CIE XYZ Color System ................................... 573

X 573

Y
Y
CCIR YIQ Color System ................................. 573
CCIR YUV Color System ................................ 573
CIE XYZ 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 Pte. Ltd.

500 Park Boulevard


suite 525, Itasca
Illinois 60143, USA

627A Aljunied Road #08-09


BizTech Centre
Singapore 389842

Euresys s.a. Japan


Representative Office

Euresys s.a.
Corporate Headquarters

Toll free: 1-866-EURESYS


Phone: +1 630-250-2300
Fax: +1 630-250-2301

Phone: +65 6748 0085


Fax: +65 6841 2137

AIOS Hiroo Building 8F


Hiroo 1-11-2, Shibuya-ku
Tokyo 150-0012

14, Avenue du Pr-Aily


B-4031 Angleur
Belgium

Phone: +81 3 5447 1256


Fax: +81 3 5447 0529

Phone: +32 4 367 72 88


Fax: +32 4 367 74 66

eVision 6.7.1, C++ Reference Manual, January 2006

Man_C++_6_7_1_Jan06_Cor0

Potrebbero piacerti anche