aspose.barcode 24.1.0 → 24.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  const fs = require("fs");
2
2
  const java = require('java');
3
3
  const joint = require("./Joint");
4
+ const {Rectangle} = require("./Joint");
4
5
 
5
6
  /**
6
7
  * BarCodeReader encapsulates an image which may contain one or several barcodes, it then can perform ReadBarCodes operation to detect barcodes.
@@ -43,14 +44,13 @@ class BarCodeReader extends joint.BaseJavaClass
43
44
  {
44
45
  if (!Array.isArray(rectangles))
45
46
  {
46
- rectangles = [rectangles.toString()];
47
+ rectangles = [rectangles];
47
48
  }
48
- else
49
+ for (let i = 0; i < rectangles.length; i++)
49
50
  {
50
- for (let i = 0; i < rectangles.length; i++)
51
- {
52
- rectangles[i] = rectangles[i].toString();
53
- }
51
+ if(!(rectangles[i] instanceof Rectangle))
52
+ throw new Error("Invalid arguments");
53
+ rectangles[i] = rectangles[i].toString();
54
54
  }
55
55
  }
56
56
  if (decodeTypes === undefined || decodeTypes == null)
@@ -1127,269 +1127,6 @@ class Code128ExtendedParameters extends joint.BaseJavaClass
1127
1127
  }
1128
1128
  }
1129
1129
 
1130
- /**
1131
- * Barcode detector settings.
1132
- */
1133
- class BarcodeSvmDetectorSettings extends joint.BaseJavaClass
1134
- {
1135
- static get javaClassName()
1136
- {
1137
- return "com.aspose.mw.barcode.recognition.MwBarcodeSvmDetectorSettings";
1138
- }
1139
-
1140
- constructor(aType)
1141
- {
1142
- let java_class_link = new java.import(BarcodeSvmDetectorSettings.javaClassName);
1143
- let javaClass = new java_class_link(BarcodeSvmDetectorSettings.NormalQuality);
1144
- switch (aType)
1145
- {
1146
- case BarcodeSvmDetectorSettings.HighPerformance:
1147
- javaClass = new java_class_link(BarcodeSvmDetectorSettings.HighPerformance);
1148
- break;
1149
- case BarcodeSvmDetectorSettings.HighQuality:
1150
- javaClass = new java_class_link(BarcodeSvmDetectorSettings.HighQuality);
1151
- break;
1152
- case BarcodeSvmDetectorSettings.MaxQuality:
1153
- javaClass = new java_class_link(BarcodeSvmDetectorSettings.MaxQuality);
1154
- break;
1155
- }
1156
- super(javaClass);
1157
- }
1158
-
1159
- static construct(javaClass)
1160
- {
1161
- let barcodeSvmDetectorSettings = new BarcodeSvmDetectorSettings(BarcodeSvmDetectorSettings.NormalQuality);
1162
- barcodeSvmDetectorSettings.setJavaClass(javaClass);
1163
- return barcodeSvmDetectorSettings;
1164
- }
1165
-
1166
- /**
1167
- * High performance detection preset.<br>
1168
- *
1169
- * Default for {@code QualitySettings.PresetType.HighPerformance}
1170
- */
1171
- static get HighPerformance()
1172
- {
1173
- return 0;
1174
- }
1175
-
1176
- /**
1177
- * Normal quality detection preset.
1178
- *
1179
- * Default for {@code QualitySettings.PresetType.NormalQuality}
1180
- */
1181
- static get NormalQuality()
1182
- {
1183
- return 1;
1184
- }
1185
-
1186
- /**
1187
- * High quality detection preset.
1188
- *
1189
- * Default for {@code QualitySettings.PresetType.HighQualityDetection} and {@code QualitySettings.PresetType.HighQuality}
1190
- */
1191
- static get HighQuality()
1192
- {
1193
- return 2;
1194
- }
1195
-
1196
- /**
1197
- * Max quality detection preset.
1198
- *
1199
- * Default for {@code QualitySettings.PresetType.MaxQualityDetection} and {@code QualitySettings.PresetType.MaxBarCodes}
1200
- */
1201
- static get MaxQuality()
1202
- {
1203
- return 3;
1204
- }
1205
-
1206
- scanWindowSizes;
1207
-
1208
- init()
1209
- {
1210
- this.scanWindowSizes = BarcodeSvmDetectorSettings.convertScanWindowSizes(this.getJavaClass().getScanWindowSizesSync());
1211
- }
1212
-
1213
- static convertScanWindowSizes(javaScanWindowSizes)
1214
- {
1215
- let scanWindowSizes = [];
1216
- for (let i = 0; i < javaScanWindowSizes.size(); i++)
1217
- {
1218
- scanWindowSizes[i] = javaScanWindowSizes.get(i);
1219
- }
1220
- return scanWindowSizes;
1221
- }
1222
-
1223
- /**
1224
- * Scan window sizes in pixels.<br>
1225
- *
1226
- * Allowed sizes are 10, 15, 20, 25, 30.<br>
1227
- * Scanning with small window size takes more time and provides more accuracy but may fail in detecting very big barcodes.<br>
1228
- * Combining of several window sizes can improve detection quality.
1229
- */
1230
- getScanWindowSizes()
1231
- {
1232
- return this.scanWindowSizes;
1233
- }
1234
-
1235
- /**
1236
- * Scan window sizes in pixels.<br>
1237
- *
1238
- * Allowed sizes are 10, 15, 20, 25, 30.<br>
1239
- * Scanning with small window size takes more time and provides more accuracy but may fail in detecting very big barcodes.<br>
1240
- * Combining of several window sizes can improve detection quality.
1241
- */
1242
- setScanWindowSizes(value)
1243
- {
1244
- this.scanWindowSizes = value;
1245
- var ArrayList = java.import('java.util.ArrayList');
1246
- var valueList = new ArrayList();
1247
- value.forEach(function (item, i, value)
1248
- {
1249
- valueList.addSync(item);
1250
- });
1251
- this.getJavaClass().setScanWindowSizesSync(valueList);
1252
- }
1253
-
1254
- /**
1255
- * Similarity coefficient depends on how homogeneous barcodes are.<br>
1256
- *
1257
- * Use high value for for clear barcodes.<br>
1258
- * Use low values to detect barcodes that ara partly damaged or not lighten evenly.<br>
1259
- * Similarity coefficient must be between [0.5, 0.9]
1260
- */
1261
- getSimilarityCoef()
1262
- {
1263
- return this.getJavaClass().getSimilarityCoefSync();
1264
- }
1265
-
1266
- /**
1267
- * Similarity coefficient depends on how homogeneous barcodes are.<br>
1268
- *
1269
- * Use high value for for clear barcodes.<br>
1270
- * Use low values to detect barcodes that ara partly damaged or not lighten evenly.<br>
1271
- * Similarity coefficient must be between [0.5, 0.9]
1272
- */
1273
- setSimilarityCoef(value)
1274
- {
1275
- this.getJavaClass().setSimilarityCoefSync(value);
1276
- }
1277
-
1278
- /**
1279
- * Sets threshold for detected regions that may contain barcodes.<br>
1280
- *
1281
- * Value 0.7 means that bottom 70% of possible regions are filtered out and not processed further.<br>
1282
- * Region likelihood threshold must be between [0.05, 0.9]<br>
1283
- * Use high values for clear images with few barcodes.<br>
1284
- * Use low values for images with many barcodes or for noisy images.<br>
1285
- * Low value may lead to a bigger recognition time.<br>
1286
- */
1287
- getRegionLikelihoodThresholdPercent()
1288
- {
1289
- return this.getJavaClass().getRegionLikelihoodThresholdPercentSync();
1290
- }
1291
-
1292
- /**
1293
- * Sets threshold for detected regions that may contain barcodes.<br>
1294
- *
1295
- * Value 0.7 means that bottom 70% of possible regions are filtered out and not processed further.<br>
1296
- * Region likelihood threshold must be between [0.05, 0.9]<br>
1297
- * Use high values for clear images with few barcodes.<br>
1298
- * Use low values for images with many barcodes or for noisy images.<br>
1299
- * Low value may lead to a bigger recognition time.
1300
- */
1301
- setRegionLikelihoodThresholdPercent(value)
1302
- {
1303
- this.getJavaClass().setRegionLikelihoodThresholdPercentSync(value);
1304
- }
1305
-
1306
- /**
1307
- * Allows detector to skip search for diagonal barcodes.<br>
1308
- *
1309
- * Setting it to false will increase detection time but allow to find diagonal barcodes that can be missed otherwise.<br>
1310
- * Enabling of diagonal search leads to a bigger detection time.
1311
- */
1312
- getSkipDiagonalSearch()
1313
- {
1314
- return this.getJavaClass().getSkipDiagonalSearchSync();
1315
- }
1316
-
1317
- /**
1318
- * Allows detector to skip search for diagonal barcodes.<br>
1319
- *
1320
- * Setting it to false will increase detection time but allow to find diagonal barcodes that can be missed otherwise.<br>
1321
- * Enabling of diagonal search leads to a bigger detection time.
1322
- */
1323
- setSkipDiagonalSearch(value)
1324
- {
1325
- this.getJavaClass().setSkipDiagonalSearchSync(value);
1326
- }
1327
-
1328
- /**
1329
- * Window size for median smoothing.<br>
1330
- *
1331
- * Typical values are 3 or 4. 0 means no median smoothing.<br>
1332
- * Default value is 0.<br>
1333
- * Median filter window size must be between [0, 10]
1334
- */
1335
- getMedianFilterWindowSize()
1336
- {
1337
- return this.getJavaClass().getMedianFilterWindowSizeSync();
1338
- }
1339
-
1340
- /**
1341
- * Window size for median smoothing.<br>
1342
- *
1343
- * Typical values are 3 or 4. 0 means no median smoothing.<br>
1344
- * Default value is 0.<br>
1345
- * Median filter window size must be between [0, 10]
1346
- */
1347
- setMedianFilterWindowSize(value)
1348
- {
1349
- this.getJavaClass().setMedianFilterWindowSizeSync(value);
1350
- }
1351
-
1352
- /**
1353
- * High performance detection preset.<br>
1354
- *
1355
- * Default for QualitySettings.PresetType.HighPerformance
1356
- */
1357
- static getHighPerformance()
1358
- {
1359
- return new BarcodeSvmDetectorSettings(QualitySettings.HighPerformance);
1360
- }
1361
-
1362
- /**
1363
- * Normal quality detection preset.<br>
1364
- *
1365
- * Default for QualitySettings.PresetType.NormalQuality
1366
- */
1367
- static getNormalQuality()
1368
- {
1369
- return new BarcodeSvmDetectorSettings(QualitySettings.NormalQuality);
1370
- }
1371
-
1372
- /**
1373
- * High quality detection preset.<br>
1374
- *
1375
- * Default for QualitySettings.PresetType.HighQualityDetection and QualitySettings.PresetType.HighQuality
1376
- */
1377
- static getHighQuality()
1378
- {
1379
- return new BarcodeSvmDetectorSettings(QualitySettings.HighQuality);
1380
- }
1381
-
1382
- /**
1383
- * Max quality detection preset.<br>
1384
- *
1385
- * Default for QualitySettings.PresetType.MaxQualityDetection and QualitySettings.PresetType.MaxBarCodes
1386
- */
1387
- static getMaxQuality()
1388
- {
1389
- return new BarcodeSvmDetectorSettings(QualitySettings.MaxQuality);
1390
- }
1391
- }
1392
-
1393
1130
  /**
1394
1131
  * Stores recognized barcode data like SingleDecodeType type, {@code string} codetext,<br>
1395
1132
  * BarCodeRegionParameters region and other parameters
@@ -1860,8 +1597,6 @@ class QualitySettings extends joint.BaseJavaClass
1860
1597
  return "com.aspose.mw.barcode.recognition.MwQualitySettings";
1861
1598
  }
1862
1599
 
1863
- detectorSettings;
1864
-
1865
1600
  constructor(qualitySettings)
1866
1601
  {
1867
1602
  super(QualitySettings.initQualitySettings(qualitySettings));
@@ -1888,7 +1623,6 @@ class QualitySettings extends joint.BaseJavaClass
1888
1623
 
1889
1624
  init()
1890
1625
  {
1891
- this.detectorSettings = BarcodeSvmDetectorSettings.construct(this.getJavaClass().getDetectorSettingsSync());
1892
1626
  }
1893
1627
 
1894
1628
  /**
@@ -1958,426 +1692,149 @@ class QualitySettings extends joint.BaseJavaClass
1958
1692
  }
1959
1693
 
1960
1694
  /**
1961
- * MaxBarCodes recognition quality preset. This preset is developed to recognize all possible barcodes, even incorrect barcodes.
1962
- *
1963
- * @example
1964
- * let reader = new BarCodeReader("test.png");
1965
- * reader.setQualitySettings(QualitySettings.getMaxBarCodes());
1966
- */
1967
- static getMaxBarCodes()
1968
- {
1969
- let JavaQualitySettings = java.import(QualitySettings.javaClassName);
1970
- return new QualitySettings(JavaQualitySettings.getMaxBarCodesSync());
1971
- }
1972
-
1973
-
1974
- /**
1975
- * Allows engine to recognize inverse color image as additional scan. Mode can be used when barcode is white on black background.
1976
- */
1977
- getAllowInvertImage()
1978
- {
1979
- return this.getJavaClass().getAllowInvertImageSync();
1980
- }
1981
-
1982
- /**
1983
- * Allows engine to recognize inverse color image as additional scan. Mode can be used when barcode is white on black background.
1984
- */
1985
- setAllowInvertImage(value)
1986
- {
1987
- this.getJavaClass().setAllowInvertImageSync(value);
1988
- }
1989
-
1990
- /**
1991
- * Allows engine to recognize barcodes which has incorrect checksumm or incorrect values.<br>
1992
- * Mode can be used to recognize damaged barcodes with incorrect text.
1993
- */
1994
- getAllowIncorrectBarcodes()
1995
- {
1996
- return this.getJavaClass().getAllowIncorrectBarcodesSync();
1997
- }
1998
-
1999
- /**
2000
- * Allows engine to recognize barcodes which has incorrect checksumm or incorrect values.<br>
2001
- * Mode can be used to recognize damaged barcodes with incorrect text.
2002
- */
2003
- setAllowIncorrectBarcodes(value)
2004
- {
2005
- this.getJavaClass().setAllowIncorrectBarcodesSync(value);
2006
- }
2007
-
2008
- /**
2009
- * Allows engine to recognize tiny barcodes on large images. Ignored if <see cref="AllowIncorrectBarcodes"/> is set to True. Default value: False.
2010
- * @return If True, allows engine to recognize tiny barcodes on large images.
2011
- */
2012
- getReadTinyBarcodes()
2013
- {
2014
- return this.getJavaClass().getReadTinyBarcodesSync();
2015
- }
2016
-
2017
- /**
2018
- * Allows engine to recognize tiny barcodes on large images. Ignored if <see cref="AllowIncorrectBarcodes"/> is set to True. Default value: False.
2019
- * @param value If True, allows engine to recognize tiny barcodes on large images.
2020
- */
2021
- setReadTinyBarcodes(value)
2022
- {
2023
- this.getJavaClass().setReadTinyBarcodesSync(value);
2024
- }
2025
-
2026
- /**
2027
- * Allows engine to recognize 1D barcodes with checksum by checking more recognition variants. Default value: False.
2028
- * @return If True, allows engine to recognize 1D barcodes with checksum.
2029
- */
2030
- getCheckMore1DVariants()
2031
- {
2032
- return this.getJavaClass().getCheckMore1DVariantsSync();
2033
- }
2034
-
2035
- /**
2036
- * Allows engine to recognize 1D barcodes with checksum by checking more recognition variants. Default value: False.
2037
- * @param value If True, allows engine to recognize 1D barcodes with checksum.
2038
- */
2039
- setCheckMore1DVariants(value)
2040
- {
2041
- this.getJavaClass().setCheckMore1DVariantsSync(value);
2042
- }
2043
-
2044
- /**
2045
- * Allows engine to recognize color barcodes on color background as additional scan. Extremely slow mode.
2046
- */
2047
- getAllowComplexBackground()
2048
- {
2049
- return this.getJavaClass().getAllowComplexBackgroundSync();
2050
- }
2051
-
2052
- /**
2053
- * Allows engine to recognize color barcodes on color background as additional scan. Extremely slow mode.
2054
- */
2055
- setAllowComplexBackground(value)
2056
- {
2057
- this.getJavaClass().setAllowComplexBackgroundSync(value);
2058
- }
2059
-
2060
- /**
2061
- * Allows engine to enable median smoothing as additional scan. Mode helps to recognize noised barcodes.
2062
- */
2063
- getAllowMedianSmoothing()
2064
- {
2065
- return this.getJavaClass().getAllowMedianSmoothingSync();
2066
- }
2067
-
2068
- /**
2069
- * Allows engine to enable median smoothing as additional scan. Mode helps to recognize noised barcodes.
2070
- */
2071
- setAllowMedianSmoothing(value)
2072
- {
2073
- this.getJavaClass().setAllowMedianSmoothingSync(value);
2074
- }
2075
-
2076
- /**
2077
- * Window size for median smoothing. Typical values are 3 or 4. Default value is 3. AllowMedianSmoothing must be set.
2078
- */
2079
- getMedianSmoothingWindowSize()
2080
- {
2081
- return this.getJavaClass().getMedianSmoothingWindowSizeSync();
2082
- }
2083
-
2084
- /**
2085
- * Window size for median smoothing. Typical values are 3 or 4. Default value is 3. AllowMedianSmoothing must be set.
1695
+ * Recognition mode which sets size (from 1 to infinity) of barcode minimal element: matrix cell or bar.
1696
+ * @return size (from 1 to infinity) of barcode minimal element: matrix cell or bar.
2086
1697
  */
2087
- setMedianSmoothingWindowSize(value)
1698
+ getXDimension()
2088
1699
  {
2089
- this.getJavaClass().setMedianSmoothingWindowSizeSync(value);
1700
+ return this.getJavaClass().getXDimensionSync();
2090
1701
  }
2091
-
2092
1702
  /**
2093
- * Allows engine to recognize regular image without any restorations as main scan. Mode to recognize image as is.
1703
+ * Recognition mode which sets size (from 1 to infinity) of barcode minimal element: matrix cell or bar.
1704
+ * @param value (from 1 to infinity) of barcode minimal element: matrix cell or bar.
2094
1705
  */
2095
-
2096
- getAllowRegularImage()
1706
+ setXDimension(value)
2097
1707
  {
2098
- return this.getJavaClass().getAllowRegularImageSync();
1708
+ this.getJavaClass().setXDimensionSync(value);
2099
1709
  }
2100
1710
 
2101
1711
  /**
2102
- * Allows engine to recognize regular image without any restorations as main scan. Mode to recognize image as is.
1712
+ * Minimal size of XDimension in pixels which is used with UseMinimalXDimension.
1713
+ * @return Minimal size of XDimension in pixels which is used with UseMinimalXDimension.
2103
1714
  */
2104
-
2105
- setAllowRegularImage(value)
1715
+ getMinimalXDimension()
2106
1716
  {
2107
- this.getJavaClass().setAllowRegularImageSync(value);
1717
+ return this.getJavaClass().getMinimalXDimensionSync();
2108
1718
  }
2109
1719
 
2110
1720
  /**
2111
- * Allows engine to recognize decreased image as additional scan. Size for decreasing is selected by internal engine algorithms.<br>
2112
- * Mode helps to recognize barcodes which are noised and blurred but captured with high resolution.
1721
+ * Minimal size of XDimension in pixels which is used with UseMinimalXDimension.
1722
+ * @param value Minimal size of XDimension in pixels which is used with UseMinimalXDimension.
2113
1723
  */
2114
- getAllowDecreasedImage()
1724
+ setMinimalXDimension(value)
2115
1725
  {
2116
- return this.getJavaClass().getAllowDecreasedImageSync();
1726
+ this.getJavaClass().setMinimalXDimensionSync(value);
2117
1727
  }
2118
1728
 
2119
1729
  /**
2120
- * Allows engine to recognize decreased image as additional scan. Size for decreasing is selected by internal engine algorithms.<br>
2121
- * Mode helps to recognize barcodes which are noised and blurred but captured with high resolution.
1730
+ * Mode which enables methods to recognize barcode elements with the selected quality. Barcode element with lower quality requires more hard methods which slows the recognition.
1731
+ * @return Mode which enables methods to recognize barcode elements with the selected quality.
2122
1732
  */
2123
- setAllowDecreasedImage(value)
1733
+ getBarcodeQuality()
2124
1734
  {
2125
- this.getJavaClass().setAllowDecreasedImageSync(value);
1735
+ return this.getJavaClass().getBarcodeQualitySync();
2126
1736
  }
2127
-
2128
1737
  /**
2129
- * Allows engine to recognize image without small white spots as additional scan. Mode helps to recognize noised image as well as median smoothing filtering.
1738
+ * Mode which enables methods to recognize barcode elements with the selected quality. Barcode element with lower quality requires more hard methods which slows the recognition.
1739
+ * @param value Mode which enables methods to recognize barcode elements with the selected quality.
2130
1740
  */
2131
-
2132
- getAllowWhiteSpotsRemoving()
1741
+ setBarcodeQuality(value)
2133
1742
  {
2134
- return this.getJavaClass().getAllowWhiteSpotsRemovingSync();
1743
+ this.getJavaClass().setBarcodeQualitySync(value);
2135
1744
  }
2136
1745
 
2137
1746
  /**
2138
- * Allows engine to recognize image without small white spots as additional scan. Mode helps to recognize noised image as well as median smoothing filtering.
2139
- */
2140
- setAllowWhiteSpotsRemoving(value)
2141
- {
2142
- this.getJavaClass().setAllowWhiteSpotsRemovingSync(value);
2143
- }
2144
-
2145
- /**
2146
- * Allows engine for 1D barcodes to recognize regular image with different params as additional scan. Mode helps to recongize low height 1D barcodes.
1747
+ * <p>
1748
+ * Deconvolution (image restorations) mode which defines level of image degradation. Originally deconvolution is a function which can restore image degraded
1749
+ * (convoluted) by any natural function like blur, during obtaining image by camera. Because we cannot detect image function which corrupt the image,
1750
+ * we have to check most well know functions like sharp or mathematical morphology.
1751
+ * @return Deconvolution mode which defines level of image degradation.
2147
1752
  */
2148
- getAllowOneDAdditionalScan()
1753
+ getDeconvolution()
2149
1754
  {
2150
- return this.getJavaClass().getAllowOneDAdditionalScanSync();
1755
+ return this.getJavaClass().getDeconvolutionSync();
2151
1756
  }
2152
-
2153
1757
  /**
2154
- * Allows engine for 1D barcodes to recognize regular image with different params as additional scan. Mode helps to recongize low height 1D barcodes.
1758
+ * Deconvolution (image restorations) mode which defines level of image degradation. Originally deconvolution is a function which can restore image degraded
1759
+ * (convoluted) by any natural function like blur, during obtaining image by camera. Because we cannot detect image function which corrupt the image,
1760
+ * we have to check most well know functions like sharp or mathematical morphology.
1761
+ * @param value Deconvolution mode which defines level of image degradation.
2155
1762
  */
2156
- setAllowOneDAdditionalScan(value)
1763
+ setDeconvolution(value)
2157
1764
  {
2158
- this.getJavaClass().setAllowOneDAdditionalScanSync(value);
1765
+ this.getJavaClass().setDeconvolutionSync(value);
2159
1766
  }
2160
1767
 
2161
1768
  /**
2162
- * Allows engine for 1D barcodes to quickly recognize high quality barcodes which fill almost whole image.<br>
2163
- * Mode helps to quickly recognize generated barcodes from Internet.
1769
+ * <p>
1770
+ * Mode which enables or disables additional recognition of barcodes on images with inverted colors (luminance).
1771
+ * @return Additional recognition of barcodes on images with inverse colors
2164
1772
  */
2165
- getAllowOneDFastBarcodesDetector()
1773
+ getInverseImage()
2166
1774
  {
2167
- return this.getJavaClass().getAllowOneDFastBarcodesDetectorSync();
1775
+ return this.getJavaClass().getInverseImageSync();
2168
1776
  }
2169
-
2170
1777
  /**
2171
- * Allows engine for 1D barcodes to quickly recognize high quality barcodes which fill almost whole image.<br>
2172
- * Mode helps to quickly recognize generated barcodes from Internet.
1778
+ * Mode which enables or disables additional recognition of barcodes on images with inverted colors (luminance).
1779
+ * @param value Additional recognition of barcodes on images with inverse colors
2173
1780
  */
2174
- setAllowOneDFastBarcodesDetector(value)
1781
+ setInverseImage(value)
2175
1782
  {
2176
- this.getJavaClass().setAllowOneDFastBarcodesDetectorSync(value);
1783
+ this.getJavaClass().setInverseImageSync(value);
2177
1784
  }
2178
1785
 
2179
1786
  /**
2180
- * Switches to the old barcode detector.
1787
+ * Mode which enables or disables additional recognition of color barcodes on color images.
1788
+ * @return Additional recognition of color barcodes on color images.
2181
1789
  */
2182
- getUseOldBarcodeDetector()
1790
+ getComplexBackground()
2183
1791
  {
2184
- try
2185
- {
2186
- this.getJavaClass().getUseOldBarcodeDetectorSync();
2187
- } catch (ex)
2188
- {
2189
- throw new BarcodeException(ex.getMessage());
2190
- }
1792
+ return this.getJavaClass().getComplexBackgroundSync();
2191
1793
  }
2192
1794
 
2193
1795
  /**
2194
- * Switches to the old barcode detector.
1796
+ * Mode which enables or disables additional recognition of color barcodes on color images.
1797
+ * @param value Additional recognition of color barcodes on color images.
2195
1798
  */
2196
- setUseOldBarcodeDetector(value)
1799
+ setComplexBackground(value)
2197
1800
  {
2198
- try
2199
- {
2200
- this.getJavaClass().setUseOldBarcodeDetectorSync(value);
2201
- } catch (ex)
2202
- {
2203
- throw new BarcodeException(ex.getMessage());
2204
- }
1801
+ this.getJavaClass().setComplexBackgroundSync(value);
2205
1802
  }
2206
1803
 
2207
1804
  /**
2208
1805
  * <p>
2209
- * Allows engine using additional image restorations to recognize corrupted barcodes. At this time, it is used only in MicroPdf417 barcode type.
2210
- * </p>Value:
2211
- * Allows engine using additional image restorations to recognize corrupted barcodes.
1806
+ * Allows engine to recognize barcodes which has incorrect checksumm or incorrect values. Mode can be used to recognize damaged barcodes with incorrect text.
1807
+ * @return Allows engine to recognize incorrect barcodes.
2212
1808
  */
2213
- getAllowAdditionalRestorations()
1809
+ getAllowIncorrectBarcodes()
2214
1810
  {
2215
- return this.getJavaClass().getAllowAdditionalRestorationsSync();
1811
+ return this.getJavaClass().getAllowIncorrectBarcodesSync();
2216
1812
  }
2217
-
2218
1813
  /**
2219
1814
  * <p>
2220
- * Allows engine using additional image restorations to recognize corrupted barcodes. At this time, it is used only in MicroPdf417 barcode type.
2221
- * </p>Value:
2222
- * Allows engine using additional image restorations to recognize corrupted barcodes.
2223
- */
2224
- setAllowAdditionalRestorations(value)
2225
- {
2226
- this.getJavaClass().setAllowAdditionalRestorationsSync(value);
2227
- }
2228
-
2229
- /**
2230
- * Allows engine for Postal barcodes to recognize slightly noised images. Mode helps to recognize sligtly damaged Postal barcodes.
2231
- */
2232
- getAllowMicroWhiteSpotsRemoving()
2233
- {
2234
- return this.getJavaClass().getAllowMicroWhiteSpotsRemovingSync();
2235
- }
2236
-
2237
- /**
2238
- * Allows engine for Postal barcodes to recognize slightly noised images. Mode helps to recognize sligtly damaged Postal barcodes.
2239
- */
2240
- setAllowMicroWhiteSpotsRemoving(value)
2241
- {
2242
- this.getJavaClass().setAllowMicroWhiteSpotsRemovingSync(value);
2243
- }
2244
-
2245
- /**
2246
- * Allows engine for 1D barcodes to quickly recognize middle slice of an image and return result without using any time-consuming algorithms.<br>
2247
- * @return Allows engine for 1D barcodes to quickly recognize high quality barcodes.
2248
- */
2249
- getFastScanOnly()
2250
- {
2251
- return this.getJavaClass().getFastScanOnlySync();
2252
- }
2253
-
2254
- /**
2255
- * Allows engine for 1D barcodes to quickly recognize middle slice of an image and return result without using any time-consuming algorithms.<br>
2256
- * @param value Allows engine for 1D barcodes to quickly recognize high quality barcodes.
2257
- */
2258
- setFastScanOnly(value)
2259
- {
2260
- this.getJavaClass().setFastScanOnlySync(value);
2261
- }
2262
-
2263
- /**
2264
- * Allows engine to recognize barcodes with salt and paper noise type. Mode can remove small noise with white and black dots.
2265
- */
2266
- getAllowSaltAndPaperFiltering()
2267
- {
2268
- return this.getJavaClass().getAllowSaltAndPaperFilteringSync();
2269
- }
2270
-
2271
- /**
2272
- * Allows engine to recognize barcodes with salt and paper noise type. Mode can remove small noise with white and black dots.
2273
- */
2274
- setAllowSaltAndPaperFiltering(value)
2275
- {
2276
- this.getJavaClass().setAllowSaltAndPaperFilteringSync(value);
2277
- }
2278
-
2279
- /**
2280
- * Allows engine to use gap between scans to increase recognition speed. Mode can make recognition problems with low height barcodes.
2281
- */
2282
- getAllowDetectScanGap()
2283
- {
2284
- return this.getJavaClass().getAllowDetectScanGapSync();
2285
- }
2286
-
2287
- /**
2288
- * Allows engine to use gap between scans to increase recognition speed. Mode can make recognition problems with low height barcodes.
2289
- */
2290
- setAllowDetectScanGap(value)
2291
- {
2292
- this.getJavaClass().setAllowDetectScanGapSync(value);
2293
- }
2294
-
2295
- /**
2296
- * Allows engine for Datamatrix to recognize dashed industrial Datamatrix barcodes.<br>
2297
- * Slow mode which helps only for dashed barcodes which consist from spots.
2298
- */
2299
- getAllowDatamatrixIndustrialBarcodes()
2300
- {
2301
- return this.getJavaClass().getAllowDatamatrixIndustrialBarcodesSync();
2302
- }
2303
-
2304
- /**
2305
- * Allows engine for Datamatrix to recognize dashed industrial Datamatrix barcodes.<br>
2306
- * Slow mode which helps only for dashed barcodes which consist from spots.
2307
- */
2308
- setAllowDatamatrixIndustrialBarcodes(value)
2309
- {
2310
- this.getJavaClass().setAllowDatamatrixIndustrialBarcodesSync(value);
2311
- }
2312
-
2313
- /**
2314
- * Allows engine for QR/MicroQR to recognize damaged MicroQR barcodes.
2315
- */
2316
- getAllowQRMicroQrRestoration()
2317
- {
2318
- return this.getJavaClass().getAllowQRMicroQrRestorationSync();
2319
- }
2320
-
2321
- /**
2322
- * Allows engine for QR/MicroQR to recognize damaged MicroQR barcodes.
2323
- */
2324
- setAllowQRMicroQrRestoration(value)
2325
- {
2326
- this.getJavaClass().setAllowQRMicroQrRestorationSync(value);
2327
- }
2328
-
2329
- /**
2330
- * Allows engine for 1D barcodes to recognize barcodes with single wiped/glued bars in pattern.
2331
- */
2332
- getAllowOneDWipedBarsRestoration()
2333
- {
2334
- return this.getJavaClass().getAllowOneDWipedBarsRestorationSync();
2335
- }
2336
-
2337
- /**
2338
- * Allows engine for 1D barcodes to recognize barcodes with single wiped/glued bars in pattern.
2339
- */
2340
- setAllowOneDWipedBarsRestoration(value)
2341
- {
2342
- this.getJavaClass().setAllowOneDWipedBarsRestorationSync(value);
2343
- }
2344
-
2345
- /**
2346
- * Barcode detector settings.
2347
- */
2348
- getDetectorSettings()
2349
- {
2350
- return this.detectorSettings;
2351
- }
2352
-
2353
- /**
2354
- * Barcode detector settings.
1815
+ * Allows engine to recognize barcodes which has incorrect checksumm or incorrect values. Mode can be used to recognize damaged barcodes with incorrect text.
1816
+ * @param value Allows engine to recognize incorrect barcodes.
2355
1817
  */
2356
- setDetectorSettings(value)
1818
+ setAllowIncorrectBarcodes(value)
2357
1819
  {
2358
- this.getJavaClass().setDetectorSettingsSync(value.getJavaClass());
2359
- this.detectorSettings = value;
1820
+ this.getJavaClass().setAllowIncorrectBarcodesSync(value);
2360
1821
  }
2361
1822
 
2362
1823
  /**
2363
- * apply all values from Src setting to this<br>
1824
+ * <p>
1825
+ * Function apply all values from Src setting to Dst
1826
+ * </p>
2364
1827
  * @param Src source settings
2365
1828
  */
2366
1829
  applyAll(Src)
2367
1830
  {
2368
- this.setAllowInvertImage(Src.getAllowInvertImage());
1831
+ this.setXDimension(Src.getXDimension());
1832
+ this.setMinimalXDimension(Src.getMinimalXDimension());
1833
+ this.setBarcodeQuality(Src.getBarcodeQuality());
1834
+ this.setDeconvolution(Src.getDeconvolution());
1835
+ this.setInverseImage(Src.getInverseImage());
1836
+ this.setComplexBackground(Src.getComplexBackground());
2369
1837
  this.setAllowIncorrectBarcodes(Src.getAllowIncorrectBarcodes());
2370
- this.setAllowComplexBackground(Src.getAllowComplexBackground());
2371
- this.setAllowMedianSmoothing(Src.getAllowMedianSmoothing());
2372
- this.setMedianSmoothingWindowSize(Src.getMedianSmoothingWindowSize());
2373
- this.setAllowRegularImage(Src.getAllowRegularImage());
2374
- this.setAllowDecreasedImage(Src.getAllowDecreasedImage());
2375
- this.setAllowWhiteSpotsRemoving(Src.getAllowWhiteSpotsRemoving());
2376
- this.setAllowOneDAdditionalScan(Src.getAllowOneDAdditionalScan());
2377
- this.setAllowOneDFastBarcodesDetector(Src.getAllowOneDFastBarcodesDetector());
2378
- this.setAllowMicroWhiteSpotsRemoving(Src.getAllowMicroWhiteSpotsRemoving());
2379
- this.setAllowSaltAndPaperFiltering(Src.getAllowSaltAndPaperFiltering());
2380
- this.setAllowDetectScanGap(Src.getAllowDetectScanGap());
2381
1838
  }
2382
1839
  }
2383
1840
 
@@ -3755,6 +3212,11 @@ DecodeType =
3755
3212
  */
3756
3213
  MICRO_QR: 56,
3757
3214
 
3215
+ /**
3216
+ * Specifies that the data should be decoded with <b>RectMicroQR (rMQR) Code</b> barcode specification
3217
+ */
3218
+ RECT_MICRO_QR: 83,
3219
+
3758
3220
  /**
3759
3221
  * Specifies that the data should be decoded with {@code <b>CompactPdf417</b>} (Pdf417Truncated) barcode specification
3760
3222
  */
@@ -4125,6 +3587,237 @@ BarCodeConfidence =
4125
3587
  STRONG: 100
4126
3588
  };
4127
3589
 
3590
+ /**
3591
+ * Enable checksum validation during recognition for 1D barcodes.
3592
+ *
3593
+ * Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible.
3594
+ *
3595
+ * Checksum never used: Codabar
3596
+ *
3597
+ * Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN
3598
+ *
3599
+ * Checksum always used: Rest symbologies
3600
+ *
3601
+ * This sample shows influence of ChecksumValidation on recognition quality and results
3602
+ * \code
3603
+ * generator = BarcodeGenerator(EncodeTypes.EAN_13, "1234567890128")
3604
+ * generator.save("test.png", BarCodeImageFormat.PNG)
3605
+ * reader = Recognition.BarCodeReader("test.png", None, DecodeType.EAN_13)
3606
+ * #checksum disabled
3607
+ * reader.setChecksumValidation(ChecksumValidation.OFF)
3608
+ * for result in reader.readBarCodes():
3609
+ * print("BarCode CodeText: " + result.getCodeText())
3610
+ * print("BarCode Value: " + result.getExtended().getOneD().getValue())
3611
+ * print("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum())
3612
+ *
3613
+ * \endcode
3614
+ * \code
3615
+ * reader = Recognition.BarCodeReader("test.png", None, DecodeType.EAN_13)
3616
+ * #checksum enabled
3617
+ * reader.setChecksumValidation(ChecksumValidation.ON)
3618
+ * for result in reader.readBarCodes():
3619
+ * print("BarCode CodeText: " + result.getCodeText())
3620
+ * print("BarCode Value: " + result.getExtended().getOneD().getValue())
3621
+ * print("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum())
3622
+ * \endcode
3623
+ *
3624
+ */
3625
+ ChecksumValidation =
3626
+ {
3627
+
3628
+ /**
3629
+ * If checksum is required by the specification - it will be validated.
3630
+ */
3631
+
3632
+ DEFAULT: 0,
3633
+
3634
+ /**
3635
+ * Always validate checksum if possible.
3636
+ */
3637
+ ON: 1,
3638
+
3639
+ /**
3640
+ * Do not validate checksum
3641
+ */
3642
+ OFF: 2
3643
+ }
3644
+
3645
+ /**
3646
+ * <p>
3647
+ * <p>
3648
+ * Deconvolution (image restorations) mode which defines level of image degradation. Originally deconvolution is a function which can restore image degraded
3649
+ * (convoluted) by any natural function like blur, during obtaining image by camera. Because we cannot detect image function which corrupt the image,
3650
+ * we have to check most well know functions like sharp or mathematical morphology.
3651
+ * </p>
3652
+ * </p><p><hr><blockquote><pre>
3653
+ * This sample shows how to use Deconvolution mode
3654
+ * <pre>
3655
+ * let reader = new BarCodeReader("test.png", null, [DecodeType.CODE_39_EXTENDED, DecodeType.CODE_128]);
3656
+ * reader.getQualitySettings().setDeconvolution(DeconvolutionMode.SLOW);
3657
+ * reader.readBarCodes().forEach(function(result, i, results)
3658
+ * {
3659
+ * console.log("BarCode CodeText: " + result.getCodeText());
3660
+ * });
3661
+ * </pre>
3662
+ * </pre></blockquote></hr></p>
3663
+ */
3664
+ DeconvolutionMode =
3665
+ {
3666
+ /**
3667
+ * <p>Enables fast deconvolution methods for high quality images.</p>
3668
+ */
3669
+ FAST: 0,
3670
+ /**
3671
+ * <p>Enables normal deconvolution methods for common images.</p>
3672
+ */
3673
+ NORMAL: 1,
3674
+ /**
3675
+ * <p>Enables slow deconvolution methods for low quality images.</p>
3676
+ */
3677
+ SLOW: 2
3678
+ };
3679
+ /**
3680
+ * <p>
3681
+ * <p>
3682
+ * Mode which enables or disables additional recognition of barcodes on images with inverted colors (luminance).
3683
+ * </p>
3684
+ * </p><p><hr><blockquote><pre>
3685
+ * This sample shows how to use InverseImage mode
3686
+ * <pre>
3687
+ *
3688
+ * let reader = new BarCodeReader("test.png", null, [DecodeType.CODE_39_EXTENDED, DecodeType.CODE_128]);
3689
+ * reader.getQualitySettings().setInverseImage(InverseImageMode.ENABLED);
3690
+ * reader.readBarCodes().forEach(function(result, i, results)
3691
+ * {
3692
+ * console.log("BarCode CodeText: " + result.getCodeText());
3693
+ * });
3694
+ * </pre>
3695
+ * </pre></blockquote></hr></p>
3696
+ */
3697
+ InverseImageMode =
3698
+ {
3699
+ /**
3700
+ * <p>At this time the same as Disabled. Disables additional recognition of barcodes on inverse images.</p>
3701
+ */
3702
+ AUTO: 0,
3703
+ /**
3704
+ * <p>Disables additional recognition of barcodes on inverse images.</p>
3705
+ */
3706
+ DISABLED: 1,
3707
+ /**
3708
+ * <p>Enables additional recognition of barcodes on inverse images</p>
3709
+ */
3710
+ ENABLED: 2
3711
+ };
3712
+
3713
+ /**
3714
+ * <p>
3715
+ * <p>
3716
+ * Recognition mode which sets size (from 1 to infinity) of barcode minimal element: matrix cell or bar.
3717
+ * </p>
3718
+ * </p><p><hr><blockquote><pre>
3719
+ * This sample shows how to use XDimension mode
3720
+ * <pre>
3721
+ * let reader = new BarCodeReader("test.png", null, [DecodeType.CODE_39_EXTENDED, DecodeType.CODE_128]);
3722
+ * reader.getQualitySettings().setXDimension(XDimensionMode.SMALL);
3723
+ * reader.readBarCodes().forEach(function(result, i, results)
3724
+ * {
3725
+ * console.log("BarCode CodeText: " + result.getCodeText());
3726
+ * });
3727
+ * </pre>
3728
+ * </pre></blockquote></hr></p>
3729
+ */
3730
+ XDimensionMode =
3731
+ {
3732
+ /**
3733
+ * <p>Value of XDimension is detected by AI (SVM). At this time the same as Normal</p>
3734
+ */
3735
+ AUTO: 0,
3736
+ /**
3737
+ * <p>Detects barcodes with small XDimension in 1 pixel or more with quality from BarcodeQuality</p>
3738
+ */
3739
+ SMALL: 1,
3740
+ /**
3741
+ * <p>Detects barcodes with classic XDimension in 2 pixels or more with quality from BarcodeQuality or high quality barcodes.</p>
3742
+ */
3743
+ NORMAL: 2,
3744
+ /**
3745
+ * <p>Detects barcodes with large XDimension with quality from BarcodeQuality captured with high-resolution cameras.</p>
3746
+ */
3747
+ LARGE: 3,
3748
+ /**
3749
+ * <p>Detects barcodes from size set in MinimalXDimension with quality from BarcodeQuality</p>
3750
+ */
3751
+ USE_MINIMAL_X_DIMENSION: 4
3752
+ }
3753
+
3754
+ /**
3755
+ * <p>
3756
+ * <p>
3757
+ * Mode which enables or disables additional recognition of color barcodes on color images.
3758
+ * </p>
3759
+ * </p><p><hr><blockquote><pre>
3760
+ * This sample shows how to use ComplexBackground mode
3761
+ * <pre>
3762
+ * let reader = new BarCodeReader("test.png", null, [DecodeType.CODE_39_EXTENDED, DecodeType.CODE_128]);
3763
+ * reader.getQualitySettings().setComplexBackground(ComplexBackgroundMode.ENABLED);
3764
+ * reader.readBarCodes().forEach(function(result, i, results)
3765
+ * {
3766
+ * console.log("BarCode CodeText: " + result.getCodeText());
3767
+ * });
3768
+ * </pre>
3769
+ * </pre></blockquote></hr></p>
3770
+ */
3771
+ ComplexBackgroundMode =
3772
+ {
3773
+ /**
3774
+ * <p>At this time the same as Disabled. Disables additional recognition of color barcodes on color images.</p>
3775
+ */
3776
+ AUTO: 0,
3777
+ /**
3778
+ * <p>Disables additional recognition of color barcodes on color images.</p>
3779
+ */
3780
+ DISABLED: 1,
3781
+ /**
3782
+ * <p>Enables additional recognition of color barcodes on color images.</p>
3783
+ */
3784
+ ENABLED: 2
3785
+
3786
+ }
3787
+
3788
+ /**
3789
+ * <p>
3790
+ * <p>
3791
+ * Mode which enables methods to recognize barcode elements with the selected quality. Barcode element with lower quality requires more hard methods which slows the recognition.
3792
+ * </p>
3793
+ * </p><p><hr><blockquote><pre>
3794
+ * This sample shows how to use BarcodeQuality mode
3795
+ * <pre>
3796
+ * let reader = new BarCodeReader("test.png", null, [DecodeType.CODE_39_EXTENDED, DecodeType.CODE_128]);
3797
+ * reader.getQualitySettings().setBarcodeQuality(BarcodeQualityMode.LOW);
3798
+ * reader.readBarCodes().forEach(function(result, i, results)
3799
+ * {
3800
+ * console.log("BarCode CodeText: " + result.getCodeText());
3801
+ * });
3802
+ * </pre>
3803
+ * </pre></blockquote></hr></p>
3804
+ */
3805
+ BarcodeQualityMode =
3806
+ {
3807
+ /**
3808
+ * <p>Enables recognition methods for High quality barcodes.</p>
3809
+ */
3810
+ HIGH: 0,
3811
+ /**
3812
+ * <p>Enables recognition methods for Common(Normal) quality barcodes.</p>
3813
+ */
3814
+ NORMAL: 1,
3815
+ /**
3816
+ * <p>Enables recognition methods for Low quality barcodes.</p>
3817
+ */
3818
+ LOW: 2
3819
+ }
3820
+
4128
3821
  module.exports = {
4129
3822
  BarCodeReader,
4130
3823
  Quadrangle,
@@ -4132,8 +3825,8 @@ module.exports = {
4132
3825
  Pdf417ExtendedParameters,
4133
3826
  OneDExtendedParameters,
4134
3827
  Code128ExtendedParameters,
4135
- BarcodeSvmDetectorSettings,
4136
3828
  DecodeType,
3829
+ ChecksumValidation,
4137
3830
  BarCodeResult,
4138
3831
  BarCodeRegionParameters,
4139
3832
  BarCodeExtendedParameters,
@@ -4148,5 +3841,10 @@ module.exports = {
4148
3841
  RecognitionAbortedException,
4149
3842
  DotCodeExtendedParameters,
4150
3843
  DataMatrixExtendedParameters,
4151
- GS1CompositeBarExtendedParameters
3844
+ GS1CompositeBarExtendedParameters,
3845
+ DeconvolutionMode,
3846
+ InverseImageMode,
3847
+ XDimensionMode,
3848
+ ComplexBackgroundMode,
3849
+ BarcodeQualityMode
4152
3850
  };