Warning: "continue 2" targeting switch is equivalent to "break 2". Did you mean to use "continue 3"? in /var/www/sensionweb.com/public_html/vqmod/vqmod.php on line 684
Warning: Cannot modify header information - headers already sent by (output started at /var/www/sensionweb.com/public_html/vqmod/vqmod.php:684) in /var/www/sensionweb.com/public_html/system/framework.php on line 510Warning: Cannot modify header information - headers already sent by (output started at /var/www/sensionweb.com/public_html/vqmod/vqmod.php:684) in /var/www/sensionweb.com/public_html/catalog/controller/startup/session.php on line 25Warning: Cannot modify header information - headers already sent by (output started at /var/www/sensionweb.com/public_html/vqmod/vqmod.php:684) in /var/www/sensionweb.com/storage/modification/catalog/controller/startup/startup.php on line 104Warning: Cannot modify header information - headers already sent by (output started at /var/www/sensionweb.com/public_html/vqmod/vqmod.php:684) in /var/www/sensionweb.com/storage/modification/catalog/controller/startup/startup.php on line 162
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/module/journal2_side_category.php on line 278

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/module/journal2_side_category.php on line 284

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/module/journal2_side_category.php on line 290

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/module/journal2_side_category.php on line 296

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/module/journal2_side_category.php on line 330

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/module/journal2_side_category.php on line 336

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/model/journal2/menu.php on line 54

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/model/journal2/menu.php on line 59

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/model/journal2/menu.php on line 64

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/model/journal2/menu.php on line 69

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/model/journal2/menu.php on line 94

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/model/journal2/menu.php on line 99

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 279

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 284

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 701

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 707

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 713

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 719

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 755

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 761

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 844

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 978

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 1011

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 1093

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 1213

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 1220

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 1227

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 1234

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 1267

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/sensionweb.com/public_html/catalog/controller/journal2/menu.php on line 1274
CodeMAX Barcode Reader SDK C++ Example | Sension

CodeMAX Barcode Reader SDK C++ Example

Posted by Sension Admin 30/05/2018 0 Comment(s) Knowledge Base,

CodeMAX Barcode Reader SDK C++ Example


Images of barcodes cannot always be captured under ideal conditions. This often results in underexposed, blurry or distorted images. Additionally, the barcodes can be damaged e.g. by scratches, wrinkles or glare in the image. Decoding such challenging barcode images is no problem with the CodeMAX Barcode Reader SDK, and it is surprisingly simple compared to competing barcode reader SDK’s.

Let’s look at an example of how easily the CodeMAX Barcode Reader SDK can be integrated into a small C++ program to decode an image containing a severely damaged Code128 barcode and a wrinkled EAN13 barcode as seen below. Note that we do not need to explicitly specify that we are looking for these particular types of barcodes or set any special options to decode the degraded barcodes. The CodeMAX Barcode Reader SDK will automatically detect all supported barcodes in the image, and restore any damages such that the barcodes can be decoded.

 



The example usage of the CodeMAX Barcode Reader SDK for C++ looks like this:
 

 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
// First we import the CodeMAX Barcode Reader SDK library 
// and instantiate objects and variables:
 
#include "codemax.h"
#include "cmdefines.h"
 
using namespace cm;
 
int main(int argc, char *argv[])
{
 CodeMAX decoder;
 cmIoImg inputImage;
 cmIoImg resultImage;
 cmDecodeInfo decodeInfo;
 
 // Then we load the test image:
 inputImage.load("image.jpg");
 
 // Next we initialize the decoder to decode barcodes using 
 // the precise mode allow maximum 100 ms to decode a barcode
 // before time-out and enable all supported symbologies.
 decoder.setup(enumProcStrategy::CM_PROCSTRATEGY_PRECISE, 100, CM_ENABLE_ALL);
 
 // Now we are ready to start decoding, which is done by providing
 // the input image and an optional empty image which will contain 
 // information about the decoded barcodes:
 decoder.decodeImage(inputImage, decodeInfo, NULL, &resultImage);
 
 // Finally, we save the result image to the disk, and iterate over
 // all decoded barcodes and print relevant information about the 
 // barcodes to the terminal.
 resultImage.save("resultImage.jpg");
 
 std::cout << "CodeMAX Barcode Reader SDK C++ Example\n\n";
 
 for (int i = 0; i < decodeInfo.numBarcodes; i++)
 {
  decoder.getBarcodeRegionInfo(i, decodeInfo);
  std::cout << "Barcode type: " << decodeInfo.barcodeData[i].barcodeType << "\n";
  std::cout << "Barcode content: " << decodeInfo.barcodeData[i].barcodeContent << "\n";
 }
 
 return 0;
}

 

The output in the terminal looks like this after executing the example program:


1
2
3
4
5
6
CodeMAX Barcode Reader SDK C++ Example
 
Barcode type: EAN13
Barcode content: 5711988001082
Barcode type:: CODE128
Barcode content: 9208607303193208


And the output image with overlay information:

 



Hence, with just a few lines of code the extremely powerful, yet easy to use CodeMAX Barcode Reader SDK can be used to decode severely degraded barcodes. Please note that this is bare minimum working example. You should always include error checking in production code. Contact us already today for a free 30 day trial of the CodeMAX Barcode Reader Demo SDK which supports both 1D and 2D barcodes.

Please refer to the list supported symbologies for an overview of all the different barcodes the CodeMAX Barcode Reader SDK supports. It is also possible to test our CodeMAX Barcode Reader SDK using our online barcode reader.