-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDynamsoftBarcodeReader.h
More file actions
1659 lines (1377 loc) · 47.5 KB
/
Copy pathDynamsoftBarcodeReader.h
File metadata and controls
1659 lines (1377 loc) · 47.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#pragma once
#if !defined(_WIN32) && !defined(_WIN64)
#define DBR_API __attribute__((visibility("default")))
#if !defined(__APPLE__)
typedef signed char BOOL;
#endif
typedef void* HANDLE;
#include <stddef.h>
#else //windows
#if defined(DBR_EXPORTS)
#define DBR_API __declspec(dllexport)
#else
#define DBR_API __declspec(dllimport)
#endif
#include <windows.h>
#endif
#include "DynamsoftCore.h"
#define DBR_VERSION "11.6.30.8649"
/**Enumeration section*/
/**
* @enum BarcodeFormat
*
* Describes the supported barcode formats.
*/
enum BarcodeFormat : unsigned long long
{
/**No barcode format in BarcodeFormat*/
BF_NULL = 0x00,
/**All supported formats in BarcodeFormat*/
BF_ALL = 0xFFFFFFFEFFFFFFFF,
/**Use the default barcode format settings*/
BF_DEFAULT = 0xFE3BFFFF,
/**Combined value of BF_CODABAR, BF_CODE_128, BF_CODE_39, BF_CODE_39_Extended, BF_CODE_93, BF_EAN_13, BF_EAN_8, INDUSTRIAL_25, BF_ITF, BF_UPC_A, BF_UPC_E, BF_MSI_CODE, BF_CODE_11; */
BF_ONED = 0x003007FF,
/**Combined value of BF_GS1_DATABAR_OMNIDIRECTIONAL, BF_GS1_DATABAR_TRUNCATED, BF_GS1_DATABAR_STACKED, BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL, BF_GS1_DATABAR_EXPANDED, BF_GS1_DATABAR_EXPANDED_STACKED, BF_GS1_DATABAR_LIMITED*/
BF_GS1_DATABAR = 0x0003F800,
/**Code 39 */
BF_CODE_39 = 0x1,
/**Code 128 */
BF_CODE_128 = 0x2,
/**Code 93 */
BF_CODE_93 = 0x4,
/**Codabar */
BF_CODABAR = 0x8,
/**Interleaved 2 of 5 */
BF_ITF = 0x10,
/**EAN-13 */
BF_EAN_13 = 0x20,
/**EAN-8 */
BF_EAN_8 = 0x40,
/**UPC-A */
BF_UPC_A = 0x80,
/**UPC-E */
BF_UPC_E = 0x100,
/**Industrial 2 of 5 */
BF_INDUSTRIAL_25 = 0x200,
/**CODE39 Extended */
BF_CODE_39_EXTENDED = 0x400,
/**GS1 Databar Omnidirectional*/
BF_GS1_DATABAR_OMNIDIRECTIONAL = 0x800,
/**GS1 Databar Truncated*/
BF_GS1_DATABAR_TRUNCATED = 0x1000,
/**GS1 Databar Stacked*/
BF_GS1_DATABAR_STACKED = 0x2000,
/**GS1 Databar Stacked Omnidirectional*/
BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL = 0x4000,
/**GS1 Databar Expanded*/
BF_GS1_DATABAR_EXPANDED = 0x8000,
/**GS1 Databar Expanded Stacked*/
BF_GS1_DATABAR_EXPANDED_STACKED = 0x10000,
/**GS1 Databar Limited*/
BF_GS1_DATABAR_LIMITED = 0x20000,
/**Patch code*/
BF_PATCHCODE = 0x00040000,
/**Code 32*/
BF_CODE_32 = 0x1000000,
/**PDF417 */
BF_PDF417 = 0x02000000,
/**QRCode */
BF_QR_CODE = 0x04000000,
/**DataMatrix */
BF_DATAMATRIX = 0x08000000,
/**AZTEC */
BF_AZTEC = 0x10000000,
/**MAXICODE */
BF_MAXICODE = 0x20000000,
/**Micro QR Code*/
BF_MICRO_QR = 0x40000000,
/**Micro PDF417*/
BF_MICRO_PDF417 = 0x00080000,
/**GS1 Composite Code*/
BF_GS1_COMPOSITE = 0x80000000,
/**MSI Code*/
BF_MSI_CODE = 0x100000,
/*Code 11*/
BF_CODE_11 = 0x200000,
/*Decode barcode with 2 digital addons*/
BF_TWO_DIGIT_ADD_ON = 0x400000,
/*Decode barcode with 5 digital addons*/
BF_FIVE_DIGIT_ADD_ON = 0x800000,
/*Matrix 25*/
BF_MATRIX_25 = 0x1000000000,
/**
* Telepen barcode format.
* Designed primarily for library and membership systems, it can encode
* the full ASCII character set, offering a high-density barcode solution.
*/
BF_TELEPEN = 0x2000000000,
/**
* Telepen Numeric barcode format.
* A variation of the Telepen format optimized for encoding numeric data only.
*/
BF_TELEPEN_NUMERIC = 0x4000000000,
/**Combined value of BF_USPSINTELLIGENTMAIL, BF_POSTNET, BF_PLANET, BF_AUSTRALIANPOST, BF_RM4SCC, BF_KIX.*/
BF_POSTALCODE = 0x3F0000000000000,
/**Nonstandard barcode */
BF_NONSTANDARD_BARCODE = 0x100000000,
/**USPS Intelligent Mail.*/
BF_USPSINTELLIGENTMAIL = 0x10000000000000,
/**Postnet.*/
BF_POSTNET = 0x20000000000000,
/**Planet.*/
BF_PLANET = 0x40000000000000,
/**Australian Post.*/
BF_AUSTRALIANPOST = 0x80000000000000,
/**Royal Mail 4-State Customer Barcode.*/
BF_RM4SCC = 0x100000000000000,
/**KIX.*/
BF_KIX = 0x200000000000000,
/**DotCode.*/
BF_DOTCODE = 0x200000000,
/**_PHARMACODE_ONE_TRACK.*/
BF_PHARMACODE_ONE_TRACK = 0x400000000,
/**PHARMACODE_TWO_TRACK.*/
BF_PHARMACODE_TWO_TRACK = 0x800000000,
/**PHARMACODE.*/
BF_PHARMACODE = 0xC00000000
};
/**
* @enum LocalizationMode
*
* Describes the localization mode.
*/
typedef enum LocalizationMode
{
/**Not supported yet. */
LM_AUTO = 0x01,
/**Localizes barcodes by searching for connected blocks. This algorithm usually gives best result and it is recommended to set ConnectedBlocks to the highest priority. */
LM_CONNECTED_BLOCKS = 0x02,
/**Localizes barcodes by groups of contiguous black-white regions. This is optimized for QRCode and DataMatrix. */
LM_STATISTICS = 0x04,
/**Localizes barcodes by searching for groups of lines. This is optimized for 1D and PDF417 barcodes. */
LM_LINES = 0x08,
/**Localizes barcodes quickly. This mode is recommended in interactive scenario. Check @ref LM for available argument settings.*/
LM_SCAN_DIRECTLY = 0x10,
/**Localizes barcodes by groups of marks.This is optimized for DPM codes. */
LM_STATISTICS_MARKS = 0x20,
/**Localizes barcodes by groups of connected blocks and lines.This is optimized for postal codes. */
LM_STATISTICS_POSTAL_CODE = 0x40,
/**Localizes barcodes from the centre of the image. Check @ref LM for available argument settings. */
LM_CENTRE = 0x80,
/**Localizes 1D barcodes fast. Check @ref LM for available argument settings. */
LM_ONED_FAST_SCAN = 0x100,
/** Localizes barcodes by utilizing a neural network model. */
LM_NEURAL_NETWORK = 0X200,
/**Reserved setting for localization mode.*/
#if defined(_WIN32) || defined(_WIN64)
LM_REV = 0x80000000,
/**Placeholder value with no functional meaning.*/
LM_END = 0xFFFFFFFF,
#else
LM_REV = -2147483648,
/**Placeholder value with no functional meaning.*/
LM_END = -1,
#endif
/**Skips localization. */
LM_SKIP = 0x00
}LocalizationMode;
/**
* @enum DeblurMode
*
* Describes the deblur mode.
*/
typedef enum DeblurMode
{
/**Performs deblur process using the direct binarization algorithm.*/
DM_DIRECT_BINARIZATION = 0x01,
/**Performs deblur process using the threshold binarization algorithm.*/
DM_THRESHOLD_BINARIZATION = 0x02,
/**Performs deblur process using the gray equalization algorithm.*/
DM_GRAY_EQUALIZATION = 0x04,
/**Performs deblur process using the smoothing algorithm.*/
DM_SMOOTHING = 0x08,
/**Performs deblur process using the morphing algorithm.*/
DM_MORPHING = 0x10,
/**Performs deblur process using the deep analysis algorithm.*/
DM_DEEP_ANALYSIS = 0x20,
/**Performs deblur process using the sharpening algorithm.*/
DM_SHARPENING = 0x40,
/**Performs deblur process based on the binary image from the localization process.*/
DM_BASED_ON_LOC_BIN = 0x80,
/**Performs deblur process using the sharpening and smoothing algorithm.*/
DM_SHARPENING_SMOOTHING = 0x100,
// add in v11.0.10
/**Performs deblur process by utilizing a neural network model. */
DM_NEURAL_NETWORK = 0x200,
/**Reserved setting for deblur mode.*/
#if defined(_WIN32) || defined(_WIN64)
DM_REV = 0x80000000,
/**Placeholder value with no functional meaning.*/
DM_END = 0xFFFFFFFF,
#else
DM_REV = -2147483648,
DM_END = -1,
#endif
/**Skips the deblur process.*/
DM_SKIP = 0x00
}DeblurMode;
/**
* @enum QRCodeErrorCorrectionLevel
*
* Describes the QR Code error correction level.
*/
typedef enum QRCodeErrorCorrectionLevel
{
/**Error Correction Level H (high) */
QRECL_ERROR_CORRECTION_H,
/**Error Correction Level L (low) */
QRECL_ERROR_CORRECTION_L,
/**Error Correction Level M (medium-low) */
QRECL_ERROR_CORRECTION_M,
/**Error Correction Level Q (medium-high) */
QRECL_ERROR_CORRECTION_Q
}QRCodeErrorCorrectionLevel;
/**
* @enum ExtendedBarcodeResultType
*
* Describes the type of the extended barcode result.
*/
typedef enum ExtendedBarcodeResultType
{
/**Specifies the standard text. This means the barcode value. */
EBRT_STANDARD_RESULT,
/**Specifies all the candidate text. This means all the standard text results decoded from the barcode. */
EBRT_CANDIDATE_RESULT,
/**Specifies the partial text. This means part of the text result decoded from the barcode. */
EBRT_PARTIAL_RESULT
}ExtendedBarcodeResultType;
/**Structures section*/
#pragma pack(push)
#pragma pack(4)
/**
* The SimplifiedBarcodeReaderSettings struct contains settings for barcode decoding. It is a sub-parameter of SimplifiedCaptureVisionSettings.
*/
typedef struct tagSimplifiedBarcodeReaderSettings
{
/**Input a combined value of enumeration BarcodeFormat to specify the targeting barcode formats.*/
unsigned long long barcodeFormatIds;
/**
* Set the expected barcode count. The default value is 0.
* Set expectedBarcodesCount to 0 if the barcode count is unknown. The library will try to find at least 1 barcode.
* Set expectedBarcodesCount to 1 to reach the highest speed for processing single barcode.
* Set expectedBarcodesCount to "n" if there will be "n" barcodes to process from an image.
* Set expectedBarcodesCount to the highest expected value if there exists multiple barcode but the exact count is not confirmed.
*/
int expectedBarcodesCount;
/**Set the grayscale transformation modes with an array of enumeration GrayscaleTransformationMode.*/
GrayscaleTransformationMode grayscaleTransformationModes[8];
/**Set the grayscale enhancement modes with an array of enumeration GrayscaleEnhancementMode.*/
GrayscaleEnhancementMode grayscaleEnhancementModes[8];
/**Set the location modes with an array of enumeration LocalizationMode.*/
LocalizationMode localizationModes[8];
/**Set the deblur modes with an array of enumeration DeblurMode.*/
DeblurMode deblurModes[10];
/**Set the minimum result confidence to filter out the low confidence results. The default value is 30.*/
int minResultConfidence;
/**Set the minimum barcode text length to filter out the unqualified results.*/
int minBarcodeTextLength;
/**Set the RegEx pattern of the barcode text to filter out the unqualified results.*/
char barcodeTextRegExPattern[256];
/**Set the maximum available threads count in one barcode decoding task.*/
int maxThreadsInOneTask;
/**Set the threshold for image shrinking. If the shorter edge size exceeds the specified threshold value,
* the library will calculate the resized height and width of the image and and perform shrinking.
*/
int scaleDownThreshold;
/**Reserved for future use.*/
char reserved[508];
}SimplifiedBarcodeReaderSettings;
#pragma pack(pop)
#ifdef __cplusplus
using namespace dynamsoft::basic_structures;
using namespace dynamsoft::intermediate_results;
namespace dynamsoft
{
namespace dbr
{
#pragma pack(push)
#pragma pack(4)
/**
* The `CBarcodeDetails` class represents the details of a barcode. It is an abstract base class.
*
*/
class DBR_API CBarcodeDetails
{
public:
/**
* Destructor
*/
virtual ~CBarcodeDetails() {};
};
/**
* The `COneDCodeDetails` class represents detailed information about a one-dimensional barcode. It inherits from the `CBarcodeDetails` class.
*/
class DBR_API COneDCodeDetails :public CBarcodeDetails
{
public:
/**
* Constructor for the COneDCodeDetails class.
*/
COneDCodeDetails();
COneDCodeDetails(const COneDCodeDetails& other);
COneDCodeDetails& operator=(const COneDCodeDetails& other);
/**
* Destructor for the COneDCodeDetails class.
*/
~COneDCodeDetails();
/*The start chars in a byte array */
unsigned char* startCharsBytes;
/*The length of the start chars byte array*/
int startCharsBytesLength;
/*The stop chars in a byte array*/
unsigned char* stopCharsBytes;
/*The length of the stop chars byte array*/
int stopCharsBytesLength;
/*The check digit chars in a byte array*/
unsigned char* checkDigitBytes;
/*The length of the check digit chars byte array*/
int checkDigitBytesLength;
/*The position of the start pattern relative to the barcode location.
Index 0 : X coordinate of the start position in percentage value;
Index 1 : X coordinate of the end position in percentage value.*/
float startPatternRange[2];
/*The position of the middle pattern relative to the barcode location.
Index 0 : X coordinate of the start position in percentage value;
Index 1 : X coordinate of the end position in percentage value.*/
float middlePatternRange[2];
/*The position of the end pattern relative to the barcode location.
Index 0 : X coordinate of the start position in percentage value;
Index 1 : X coordinate of the end position in percentage value.*/
float endPatternRange[2];
/*Reserved memory for the struct.The length of this array indicates
the size of the memory reserved for this struct.*/
char reserved[8];
private:
void CopyMembers(const COneDCodeDetails& other);
};
/**
* The `CQRCodeDetails` class represents the details of a QR Code barcode. It is derived from the `CBarcodeDetails` class and contains various attributes related to the QR Code barcode.
*
*/
class DBR_API CQRCodeDetails : public CBarcodeDetails
{
public:
CQRCodeDetails(int _rows = -1, int _columns = -1, QRCodeErrorCorrectionLevel _level = QRECL_ERROR_CORRECTION_H,
int _version = -1, int _model = -1, int _mode = -1, int _page = -1, int _totalPage = -1, int _parityData = -1);
CQRCodeDetails& operator=(const CQRCodeDetails& other);
/**
* Destructor for the CQRCodeDetails class.
*/
~CQRCodeDetails();
/*The row count of the barcode*/
int rows;
/*The column count of the barcode*/
int columns;
/*The error correction level of the barcode*/
QRCodeErrorCorrectionLevel errorCorrectionLevel;
/*The version of the QR Code*/
int version;
/*Number of the models*/
int model;
/*Identify the first data encoding mode*/
int mode;
/*Identify the position of the particular symbol*/
int page;
/*Identify the total number of symbols to be concatenated in the Structured Append format*/
int totalPage;
/*The Parity Data shall be an 8 bit byte following the Symbol Sequence Indicator.
The parity data is a value obtained by XORing byte by byte the ASCII/JIS values of
all the original input data before division into symbol blocks.*/
unsigned char parityData;
int dataMaskPattern;
unsigned char* codewords;
int codewordsCount;
};
/**
* The `CPDF417Details` class represents a barcode in PDF417 format. It inherits from the `CBarcodeDetails` class and contains information about the row count, column count, and error correction level of the barcode.
*
*/
class DBR_API CPDF417Details :public CBarcodeDetails
{
public:
CPDF417Details(int _rows = -1, int _columns = -1, int _level = -1,
int _hasLeftRowIndicator = -1, int _hasRightRowIndicator = -1);
CPDF417Details& operator=(const CPDF417Details& other);
/**
* Destructor for the CPDF417Details class.
*/
~CPDF417Details();
/*The row count of the barcode*/
int rows;
/*The column count of the barcode*/
int columns;
/*The error correction level of the barcode*/
int errorCorrectionLevel;
/*Whether the left row indicator of the PDF417 code exists*/
int hasLeftRowIndicator;
/*Whether the right row indicator of the PDF417 code exists*/
int hasRightRowIndicator;
unsigned int * codewords;
int codewordsCount;
};
/**
* The `CDataMatrixDetails` class represents the details of a DataMatrix barcode. It is derived from the `CBarcodeDetails` class and contains various attributes related to the DataMatrix barcode.
*
*/
class DBR_API CDataMatrixDetails : public CBarcodeDetails
{
public:
CDataMatrixDetails(int _rows = -1, int _columns = -1, int _dataRegionRows = -1,
int _dataRegionColumns = -1, int _dataRegionNumber = -1);
/*The row count of the barcode*/
int rows;
/*The column count of the barcode*/
int columns;
/*The data region row count of the barcode*/
int dataRegionRows;
/*The data region column count of the barcode*/
int dataRegionColumns;
/*The data region count*/
int dataRegionNumber;
};
/**
* The `CAztecDetails` class represents a barcode in Aztec format. It inherits from the `CBarcodeDetails` class and contains information about the row count, column count, and layer number of the barcode.
*
*/
class DBR_API CAztecDetails :public CBarcodeDetails
{
public:
CAztecDetails(int _rows = -1, int _columns = -1, int _layerNumber = -1);
/*The row count of the barcode*/
int rows;
/*The column count of the barcode*/
int columns;
/*A negative number (-1, -2, -3, -4) specifies a compact Aztec code.
*A positive number (1, 2, .. 32) specifies a normal(full-rang) Aztec code */
int layerNumber;
};
/**
* Represents the Extended Channel Interpretation (ECI) information within a barcode.
*
* Each ECI segment specifies the character encoding used for a portion of the decoded bytes.
* The charset names follow the IANA character set registry (e.g. "UTF-8", "ISO-8859-1").
*/
class DBR_API CECISegment
{
public:
/**
* ECI assignment number as defined by ISO/IEC 15424.
*/
int eciValue;
/**
* Charset encoding name defined by IANA (e.g. "UTF-8", "ISO-8859-1").
*/
const char* charsetEncoding;
/**
* Start index of this ECI segment in the decoded barcode bytes.
*/
int startIndex;
/**
* Length (in bytes) of this segment within the decoded barcode bytes.
*/
int length;
};
namespace intermediate_results
{
/**
* The `CLocalizedBarcodeElement` class represents a localized barcode element detected in an image. It is inherited from `CRegionObjectElement` class.
*/
class DBR_API CLocalizedBarcodeElement : public CRegionObjectElement
{
protected:
/**
* Destructor
*/
virtual ~CLocalizedBarcodeElement() {};
public:
/**
* Gets the format of the barcode.
*
* @return Returns the format of the barcode.
*
*/
virtual unsigned long long GetPossibleFormats() const = 0;
/**
* Gets the string representation of the barcode format.
*
* @return Returns the string representation of the barcode format.
*
*/
virtual const char* GetPossibleFormatsString() const = 0;
/**
* Gets the orientation angle of the barcode.
*
* @return Returns the orientation angle of the barcode.
*
*/
virtual int GetAngle() const = 0;
/**
* Gets the module size of the barcode.
*
* @return Returns the module size of the barcode.
*
*/
virtual int GetModuleSize() const = 0;
/**
* Gets the confidence score of the barcode recognition result.
*
* @return Returns the confidence score of the barcode recognition result.
*
*/
virtual int GetConfidence() const = 0;
/**
* Sets the possible formats of the barcode.
*
* @param [in] possibleFormats The possible formats of the barcode.
*
*/
virtual void SetPossibleFormats(unsigned long long possibleFormats) = 0;
/**
* Sets the location of the localized barcode element.
*
* @param location The location of the localized barcode element.
* @return Returns 0 if success, otherwise an error code.
*/
virtual int SetLocation(const CQuadrilateral& location) = 0;
virtual void MarkAsDecoded() = 0;
virtual bool IsDecoded() const = 0;
};
class DBR_API CExtendedBarcodeResult;
/**
* The `CDecodedBarcodeElement` class represents a decoded barcode element.
* It is inherited from `CRegionObjectElement` class and provides additional functionality for retrieving information about the decoded barcode.
*/
class DBR_API CDecodedBarcodeElement : public CRegionObjectElement
{
protected:
/**
* Destructor
*/
virtual ~CDecodedBarcodeElement() {};
public:
/**
* Gets the format of the barcode.
*
* @return Returns the format of the barcode.
*
*/
virtual BarcodeFormat GetFormat() const = 0;
/**
* Gets the string representation of the barcode format.
*
* @return Returns the string representation of the barcode format.
*
*/
virtual const char* GetFormatString() const = 0;
/**
* Gets the text of the decoded barcode.
*
* @return Returns a pointer to the text of the decoded barcode.
*
*/
virtual const char* GetText() const = 0;
/**
* Gets the raw bytes of the decoded barcode.
*
* @return Returns a pointer to the raw bytes of the decoded barcode.
*
*/
virtual unsigned char* GetBytes() const = 0;
/**
* Gets the length of the raw bytes of the decoded barcode.
*
* @return Returns the length of the raw bytes of the decoded barcode.
*
*/
virtual int GetBytesLength() const = 0;
/**
* Gets the details of the decoded barcode.
*
* @return Returns a pointer to the details of the decoded barcode.
*
*/
virtual const CBarcodeDetails* GetDetails()const = 0;
/**
* Determines whether the decoded barcode is a DPM(Direct Part Marking) code.
*
* @return Returns true if the decoded barcode is a DPM code, false otherwise.
*
*/
virtual bool IsDPM() const = 0;
/**
* Determines whether the decoded barcode is mirrored.
*
* @return Returns true if the decoded barcode is mirrored, false otherwise.
*
*/
virtual bool IsMirrored() const = 0;
/**
* Gets the orientation angle of the barcode.
*
* @return Returns the orientation angle of the barcode.
*
*/
virtual int GetAngle() const = 0;
/**
* Gets the module size of the barcode.
*
* @return Returns the module size of the barcode.
*
*/
virtual int GetModuleSize() const = 0;
/**
* Gets the confidence score of the barcode recognition result.
*
* @return Returns the confidence score of the barcode recognition result.
*
*/
virtual int GetConfidence() const = 0;
/**
* Gets the number of extended barcode results for the decoded barcode.
*
* @return Returns the number of extended barcode results for the decoded barcode.
*
*/
virtual int GetExtendedBarcodeResultsCount() const = 0;
/**
* Gets the extended barcode result at the specified index for the decoded barcode.
*
* @param [in] index The index of the extended barcode result to retrive.
*
* @return Returns a pointer to the extended barcode result at the specified index for the decoded barcode.
*
*/
virtual const CExtendedBarcodeResult* GetExtendedBarcodeResult(int index) const = 0;
/**
* Sets the format of the barcode.
*
* @param [in] format The format of the barcode.
*
*/
virtual void SetFormat(BarcodeFormat format) = 0;
/**
* Sets the text of the barcode.
*
* @param text The text of the barcode.
*/
virtual void SetText(const char* text) = 0;
/**
* Sets the raw bytes of the decoded barcode.
*
* @param [in] bytes The raw bytes of the decoded barcode.
* @param [in] bytesLength The length of the raw bytes of the decoded barcode.
*
*/
virtual void SetBytes(unsigned char* bytes, int bytesLength) = 0;
/**
* Sets the confidence of the decoded barcode.
*
* @param confidence The confidence of the decoded barcode.
*
*/
virtual void SetConfidence(int confidence) = 0;
/**
* Sets the location of the decoded barcode element.
*
* @param location The location of the decoded barcode element.
* @return Returns 0 if success, otherwise an error code.
*/
virtual int SetLocation(const CQuadrilateral& location) = 0;
/**
* Gets the number of ECI segments in the barcode.
*
* @return The count of ECI segments. Returns 0 if no ECI information is present.
*/
virtual int GetECISegmentsCount() const = 0;
/**
* Gets the ECI segment at the specified index.
*
* @param index The zero-based index of the ECI segment to retrieve.
* @return A pointer to the CECISegment object, or NULL if the index is out of range.
*/
virtual const CECISegment* GetECISegment(int index) const = 0;
};
/**
* The `CExtendedBarcodeResult` class represents an extended barcode result in a decoded barcode element. It contains information such as the type of extended barcode, deformation, clarity, and a sampling image of the barcode.
*
*/
class DBR_API CExtendedBarcodeResult : public CDecodedBarcodeElement
{
protected:
/**
* Destructor
*/
virtual ~CExtendedBarcodeResult() {};
public:
/**
* Gets the type of extended barcode result.
*
* @return Returns the type of the extended barcode result.
*
*/
virtual ExtendedBarcodeResultType GetExtendedBarcodeResultType() const = 0;
/**
* Gets the deformation of the barcode.
*
* @return Returns the deformation of the barcode.
*
*/
virtual int GetDeformation() const = 0;
/**
* Gets the clarity of the barcode.
*
* @return Returns the clarity of the barcode.
*
*/
virtual int GetClarity() const = 0;
/**
* Gets the sampling image of the barcode.
*
* @return Returns a pointer to the sampling image of the barcode.
*
*/
virtual const CImageData* GetSamplingImage() const = 0;
};
/**
* Represents a candidate zone for barcode detection.
*
*/
class DBR_API CCandidateBarcodeZone
{
private:
CQuadrilateral location;
unsigned long long barcodeFormats;
public:
/**
* Default Constructor
*/
CCandidateBarcodeZone();
/**
* Constructor
*
* @param [in] location The location of the candidate barcode.
* @param [in] possibleFormats The posssible formats of the candidate barcode.
*
*/
CCandidateBarcodeZone(const CQuadrilateral& location, unsigned long long possibleFormats);
/**
* Gets the location of the candidate barcode.
*
* @return Returns the location of the candidate barcode.
*
*/
CQuadrilateral GetLocation() const;
/**
* Sets the location of the candidate barcode.
*
* @param [in] loc The location of the candidate barcode.
*
*/
void SetLocation(const CQuadrilateral& loc);
/**
* Gets the posssible formats of the candidate barcode.
*
* @return Returns the posssible formats of the candidate barcode.
*
*/
unsigned long long GetPossibleFormats() const;
/**
* Sets the posssible formats of the candidate barcode.
*
* @param [in] formats The posssible formats of the candidate barcode.
*
*/