Carmen® OCR

Software Library for Container Code Recognition

Highlighted Features

supported-codes

Supported Codes

ISO 6346 (BIC), MOCO, and ILU container codes recognized.

tried-and-tested

Tried and tested

Used in thousands of systems worldwide.

scalability

Scalability

From small through medium, to large and complex systems.

image-based-code-recognition

Image-based Code Recognition

SDK supports image processing.

major-op-systems-supported

Major OP Systems Supported

Runs on Windows and Linux.

regular-updates

Regular Updates

Four updates released per year.

Sample Codes


        /** \file *********************************************************************
        *
        * cmocr02 - Sample program for Container Code Reader
        *
        * 2006-2021 (c) Adaptive Recognition Hungary Inc. (http://www.adaptiverecognition.com)
        ******************************************************************************/
       
        /**
         * cmocr_readcodea() example
         *
         * Purpose:
         *		Demonstrates the use of the cmocr_getresult() function
         *		to read industrial codes from a series of images.
         *
         * Description:
         *		After the user choose what kind o engine would like to try,f
         *		the application loads the necessary images from file, adds them to the engine, and calls
         *		the cmocr_getresult() function to read industrial codes from the series.
         */
       
       #include "gxsdldr.c"
       #include "gximage.h"
       #include "cmocr.h"
       #include "gxproperty.h"
       #include 
       #include  
       #include "stringtools.c"
       
         /** Prints the GX error code and string to the stderr. */
       void print_error(const char* format, ...) {
           int errcode;
           char errstr[256];
           char _format[1024];
           va_list args;
       
           gx_geterrora(&errcode, errstr, sizeof(errstr) - 1);
           errstr[sizeof(errstr) - 1] = 0;
           gx_snprintf(_format, sizeof(_format), "\n<%s> GX error (%x) occured: %s\n", format, errcode, errstr);
       
           va_start(args, format);
           vfprintf(stderr, _format, args);
           va_end(args);
       }
       
       /**
        * Main function
        */
       
       #define NOCRTYPES	11
       const char ocr_types[NOCRTYPES][16] =
       {
           "aar",
           "accr_usa",
           "bra",
           "chassis",
           "ilu",
           "iso",
           "isoilu",
           "moco"
           "rus",
           "uic",
           "usdot",
       };
       
       int main(void)
       {
           gxHANDLE ocrhandle = { 0 };
           gxHANDLE imagehandle = { 0 };
           gxHANDLE prophandle;
           struct CMOCR_RESULT* presult = NULL;
           int confidence;
           char code[64];
           char* type = 0;
           int choice_int;
           int ix;
           bool b_err = false;
       
           /** Open the container reader */
           if (!gx_openmodulea(&prophandle, "gxproperty", "default"))
           {
               print_error("Error while opening gxproperty module");
               return 0;
           }
       
           printf("Which engine would you like to try ?\n1.AAR\n2.ACCR_USA\n3.BRA\n4.CHASSIS\n5.ILU\n6.ISO\n7.ISOILU\n8.MOCO\n9.RUS\n10.UIC\n11.USDOT\n12.OLD engine(released before 21Q1)\n13.Use the default engine\nPlease choose a number between 1 and 13! Your choice : ");
           scanf("%d", &choice_int);
       
           while (choice_int < 1 || choice_int > 13)
           {
               printf("Please choose a number between 1 and 13: ");
               scanf("%d", &choice_int);
           }
           printf("\n");
       
           if (choice_int <= NOCRTYPES)
           {
               char t[16] = "", ev[64] = "";
               char engname[128] = "";
               memset(engname, 0, sizeof(engname));
       
               type = gx_strdup(ocr_types[choice_int - 1]);
               gx_strncpy(t, type, sizeof(t));
               strupr(t);
       
               memset(ev, 0, sizeof(ev));
               gx_snprintf(ev, sizeof(ev) - 1, "%s/cmocr", type);
               if (!gx_getpropertya(prophandle, ev, engname, (int)sizeof(engname)))
               {
                   print_error("Reading %s property error", ev);
                   b_err = true;
               }
               else
               {
                   printf("You have choosen the \"%s\" engine: %s\n\n", t, engname);
       
                   /** Open the container reader */
                   if (!gx_openmodulea(&ocrhandle, "cmocr", type)) {
                       print_error("Error while opening cmocr module");
                       b_err = true;
                   }
               }
           }
           else
               if (choice_int == 12)
               {
                   char engine[128] = "";
                   printf("You have choosen an old engine (released before 21Q1), please give us the exact engine name like \"cmaccr-7.3.2.66:ilu\": ");
                   scanf("%s", engine);
       
                   if (!gx_setpropertya(prophandle, "default/cmocr", engine))
                   {
                       print_error("Error while setting \"%s\" engine as a default", engine);
                       b_err = true;
                   }
                   else
                   {
                       char t[16] = "";
                       type = substring(engine, indexOf(engine, ':') + 1);
                       trimstr(type);
       
                       gx_strncpy(t, type, sizeof(t));
                       strupr(t);
                       printf("You have choosen the old (\"%s\") engine: %s\n\n", t, engine);
       
                       /** Open the container reader */
                       if (!gx_openmodulea(&ocrhandle, "cmocr", "default"))
                       {
                           print_error("Error while opening cmocr module");
                           b_err = true;
                       }
                   }
               }
               else			
                   /** Open the container reader */
                   if (!gx_openmodulea(&ocrhandle, "cmocr", "default"))
                   {
                       print_error("Error while opening cmocr module");
                       b_err = true;
                   }
                   else
                   {
                       char defeng[128] = "";
                       memset(defeng, 0, sizeof(defeng));
                       if (!gx_getpropertya(prophandle, "default/cmocr", defeng, (int)sizeof(defeng)))
                       {
                           print_error("Get property error");
                           b_err = true;
                       }
                       else
                       {
                           char t[16] = "", * t1, * t2;
                           type = substring(defeng, indexOf(defeng, ':') + 1);
                           trimstr(type);
                           gx_strncpy(t, type, sizeof(t));
                           strupr(t);
                           printf("You have choosen the default (\"%s\") engine: %s\n\n", t, defeng);
                       }
                   }
                   
           if (!b_err)
           {
               int i;
               char images[3][128];
               /** Open the image module and allocates the image structure */
               if (!gx_openmodulea(&imagehandle, "gximage", "default"))
               {
                   print_error("Error while opening gximage module");
                   gx_unrefhandle(&ocrhandle);
                   gx_unrefhandle(&prophandle);
                   return 0;
               }
       
               /** Reset the container module */
               if (!cmocr_reset(ocrhandle))
               {
                   print_error("Reset error");
                   gx_unrefhandle(&ocrhandle);
                   gx_unrefhandle(&imagehandle);
                   gx_unrefhandle(&prophandle);
                   return 0;
               }
       
               memset(images, 0, sizeof(images));
               for (i = 0; i < 3; i++)
               {
                   gx_snprintf(images[i], sizeof(images[i]), "../../../data/%s%02i.jpg", type, i + 1);
               }
               free(type);
       
               for (ix = 0; ix < 3; ix++) { /** Allocate an image */ gxIMAGE* image = 0; if (!gx_allocimage(imagehandle, &image)) { print_error("Allocate image failed"); gx_unrefhandle(&ocrhandle); gx_unrefhandle(&imagehandle); gx_unrefhandle(&prophandle); return 0; } /** Load the image */ printf("Load image: %s...", images[ix]); if (!gx_loadimagea(imagehandle, image, images[ix], GX_UNDEF)) { print_error("FAILED"); gx_unrefimage(imagehandle, image); gx_unrefhandle(&ocrhandle); gx_unrefhandle(&imagehandle); gx_unrefhandle(&prophandle); return 0; } else printf("OK\n"); /** Add image to the module */ printf("Add image to the module..."); if (!cmocr_addimage(ocrhandle, image, 0)) { print_error("FAILED"); gx_unrefimage(imagehandle, image); gx_unrefhandle(&ocrhandle); gx_unrefhandle(&imagehandle); gx_unrefhandle(&prophandle); return 0; } else printf("OK\n"); gx_unrefimage(imagehandle, image); } /** Read the first container code */ printf("\nRead the container code by cmocr_getresult() function..."); if (!cmocr_getresult(ocrhandle, &presult)) { print_error("FAILED"); } else printf("OK\n"); if (!presult || (presult->code[0] == 0)) {
                   printf("No result\n");
               }
               else
               {
                   int csvalid, checksum;
                   printf("Code: '%s', Confidence: '%i'\n", presult->code, presult->confidence);
                   for (ix = 0; ix < presult->nimage; ix++)
                       printf("\tImgIndex: %d Code: '%s', Confidence: '%i'\n",
                           presult->images[ix].imgindex,
                           presult->images[ix].text,
                           presult->images[ix].confidence);
                   printf("\nRead the result of the checksum validation...");
                   if (!cmocr_checksumisvalid(ocrhandle, presult->code, &csvalid, &checksum)) {
                       print_error("FAILED");
                       if (presult) gx_globalfree(presult);
                       return 0;
                   }
                   else printf("OK\nChecksum validation result: %i, checksum: %i\n\n", csvalid, checksum);
               }
               /** Release the result memory */
               if (presult) { gx_globalfree(presult); presult = 0; }
               /** Release the handle */
               if (gx_isvalidhandle(ocrhandle)) gx_unrefhandle(&ocrhandle);
               if (gx_isvalidhandle(imagehandle)) gx_unrefhandle(&imagehandle);
               if (gx_isvalidhandle(prophandle)) gx_unrefhandle(&prophandle);
       
               return 1;
           }
       }
       
    


        /** \file *********************************************************************
        *
        * cmocr02 - Sample program for Container Code Reader
        *
        * 2006-2021 (c) Adaptive Recognition Hungary Inc. (http://www.adaptiverecognition.com)
        ******************************************************************************/
       
        /**
         * FindFirstContainerCode() example
         *
         * Purpose:
         *		Demonstrates the use of the FindFirstContainerCode() function
         *		to read industrial codes from a series of images.
         *
         * Description:
         *		After the user choose what kind of engine would like to try,
         *		the application loads the necessary images from file, adds them to the engine, and calls
         *		the FindFirstContainerCode() function to read indutrial codes from the series.
         */
       
       #include "gxsdldr.cpp"
       #include "gximage.h"
       #include "cmocr.h"
       #include "gxproperty.h"
       
       #include 
       #include 
       #include 
       #include 
       
       #ifdef GX_NAMESPACES
       using namespace gx;
       using namespace cm;
       using namespace std;
       #endif
       
       // trim from start (in place)
       static inline void ltrim(std::string& s) {
           s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) {
               return !std::isspace(ch);
               }));
       }
       
       // trim from end (in place)
       static inline void rtrim(std::string& s) {
           s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) {
               return !std::isspace(ch);
               }).base(), s.end());
       }
       
       // trim from both ends (in place)
       static inline void trim(std::string& s) {
           ltrim(s);
           rtrim(s);
       }
       
       static inline std::string strupr(std::string s)
       {
           std::string ret = s;
           std::transform(ret.begin(), ret.end(), ret.begin(), [](unsigned char c) { return std::toupper(c); });
           return ret;
       }
       /**
       * Main function
       */
       int main(void) {
       
           const int NOCRTYPES = 11;
       
           char* ocr_types[NOCRTYPES] =
           {
               "aar",
               "accr_usa",
               "bra",
               "chassis",
               "ilu",
               "iso",
               "isoilu",
               "moco"
               "rus",
               "uic",
               "usdot",
           };
       
           try {
               gxProperty gxProperty;
       
               cout << "Which engine would you like to try ?\n1.AAR\n2.ACCR_USA\n3.BRA\n4.CHASSIS\n5.ILU\n6.ISO\n7.ISOILU\n8.MOCO\n9.RUS\n10.UIC\n11.USDOT\n12.OLD engine(released before 21Q1)\n13.Use the default engine\nPlease choose a number between 1 and 13! Your choice : "; int choice_int; cin >> choice_int;
       
               while (choice_int < 1 || choice_int > 13)
               {
                   cout << "Please choose a number between 1 and 13: "; cin >> choice_int;
               }
               cout << endl;
       
               // Open the container reader
               cmOcr* ocr = 0;
               string type = "";
       
               if (choice_int <= NOCRTYPES)
               {
                   type = ocr_types[choice_int - 1];
                   std::string utype = strupr(type);
                   string engine = gxProperty.GetProperty(type + "/cmocr");
                   cout << "You have choosen the \"" << utype << "\" engine: " << engine << "\n\n";
                   ocr = new cmOcr(type);
               }
               else if (choice_int == 12)
               {
                   cout << "You have choosen an old engine (released before 21Q1), please give us the exact engine name like \"cmaccr-7.3.2.66:ilu\": "; string engine; cin >> engine;
                   gxProperty.SetProperty("default/cmocr", engine);
                   type = engine.substr(engine.find(':') + 1);
                   trim(type);
                   std::string utype = strupr(type);
                   cout << "You have choosen the old (\"" << utype << "\") engine: " << engine << "\n\n";
                   ocr = new cmOcr("default");
               }
               else
               {
                   ocr = new cmOcr("default");
                   string engine = gxProperty.GetProperty("default/cmocr");
                   type = engine.substr(engine.find(':') + 1);
                   trim(type);
                   std::string utype = strupr(type);
                   cout << "You have choosen the default (\"" << utype << "\") engine: " << engine << "\n\n"; } // Reset the container module ocr->Reset();
       
               char images[3][128];
               memset(images, 0, sizeof(images));
               for (int i = 0; i < 3; i++)
               {
                   gx_snprintf(images[i], sizeof(images[i]), "../../../data/%s%02i.jpg", type.c_str(), i + 1);
               }
       
               for (int ix = 0; ix < 3; ix++) {
                   // Load the image
                   gxImage image;
                   cout << "Load " << images[ix] << "...";
                   image.Load(images[ix]);
                   cout << "OK" << endl;
       
                   // Add image to the module
                   cout << "Add image to the module" << "..."; ocr->AddImage(image, 0);
                   cout << "OK" << endl;
               }
               cout << endl;
               // Read the code
               cout << "Read the code by FindFirstContainerCode() function..."; ocr->FindFirstContainerCode();
               cout << "OK" << endl; if(ocr->IsValid())
               {
                   cout << "Code: '" << ocr->GetCodeA() << "', Confidence: '" << ocr->GetConfidence() << "'" << endl;
                   for (int ix=0; ixGetNumberOfImages(); ix++)
                       cout << "\t" <<
                       "ImgIndex: " << ocr->GetImageIndex(ix) << ", " <<
                       "Code: '" << ocr->GetImageTextA(ix) << "', " <<
                       "Confidence: '" << ocr->GetImageConfidence(ix) << "'" << endl;
       
                   cout  << endl << "Read the result of the checksum validation..."; int csvalid = ocr->ChecksumIsValid();
                   int checksum = ocr->GetChecksum();
                   cout << "OK" << endl;
                   cout << "Checksum validation result: " << csvalid << ", checksum: " << checksum << endl << endl;
               }
               else
               {
                   cout << "No result" << endl;
               }
       
           } catch(gxError &e) {
           
               // Displays error code and description
               cerr << "GX error (" << e.GetErrorCode() << ") occurred: " << e.GetErrorStringA() << "\n";
               // Terminates the program
               return 0;
           }
       
           return 1;
       }
        
    


        /** \file *********************************************************************
        *
        * cmocr02 - Sample program for Container Code Reader
        *
        * 2006-2021 (c) Adaptive Recognition Hungary Inc. (http://www.adaptiverecognition.com)
        ******************************************************************************/
       
       /**
        * FindFirstContainerCode() example
        *
        * Purpose:
        *		Demonstrates the use of the FindFirstContainerCode() function
        *		to read industrial codes from a series of images.
        *
        * Description:
        *		After the user choose what kind of engine would like to try,
        *		the application loads the necessary images from file, adds them to the engine, and calls 
        *		the FindFirstContainerCode() function to read indutrial codes from the series.
        */
       
       using gx;
       using cm;
       using System;
       
       namespace cmocr01
       {
           class MainClass
           {
               const int NOCRTYPES = 11; // Number of OCR engine types
               public static string[] ocr_types = new string[NOCRTYPES]
               {
                   "aar",
                   "accr_usa",
                   "bra",
                   "chassis",
                   "ilu",
                   "iso",
                   "isoilu",
                   "moco"
                   "rus",
                   "uic",
                   "usdot",
               };
       
               public static void Main(string[] args)
               {
                   try
                   {
                       gxProperty gxProperty = new gxProperty();
       
                       Console.Write("Which engine would you like to try ?\n1.AAR\n2.ACCR_USA\n3.BRA\n4.CHASSIS\n5.ILU\n6.ISO\n7.ISOILU\n8.MOCO\n9.RUS\n10.UIC\n11.USDOT\n12.OLD engine(released before 21Q1)\n13.Use the default engine\nPlease choose a number between 1 and 13! Your choice : ");
       
                       string choice = Console.ReadLine();
                       //Console.WriteLine("\""+choice+"\"");
                       int choice_int = Convert.ToInt32(choice);
                       while (choice_int < 1 || choice_int > 13)
                       {
                           Console.Write("Please choose a number between 1 and 13: ");
                           choice = Console.ReadLine();
                           //Console.WriteLine("\"" + choice + "\"");
                           choice_int = Convert.ToInt32(choice);
                       }
                       Console.WriteLine();
       
                       //Creates the OCR object
                       cmOcr ocr;
                       string type = "";
       
                       if (choice_int <= NOCRTYPES)
                       {
                           type = ocr_types[choice_int - 1];
                           Console.WriteLine("You have choosen the \"{0}\" engine: {1}\n", type.ToUpper(), gxProperty.GetProperty(type + "/cmocr"));
                           ocr = new cmOcr(type);
                       }
                       else if (choice_int == 12)
                       {
                           Console.Write("You have choosen an old engine (released before 21Q1), please give us the exact engine name like \"cmaccr-7.3.2.66:ilu\": ");
                           string engine = Console.ReadLine();
                           Console.WriteLine();
                           //Console.WriteLine("\"" + engine + "\"");
                           gxProperty.SetProperty("default/cmocr", engine);
                           type = engine.Substring(engine.IndexOf(":") + 1);
                           type = type.Trim();
                           Console.WriteLine("You have choosen the old (\"{0}\") engine: {1}\n", type.ToUpper(), engine);
                           ocr = new cmOcr("default");
                       }
                       else
                       {
                           ocr = new cmOcr("default");
                           string engine = gxProperty.GetProperty("default/cmocr");
                           type = engine.Substring(engine.IndexOf(":") + 1);
                           type = type.Trim();
                           Console.WriteLine("You have choosen the default (\"{0}\") engine: {1}\n", type.ToUpper(), engine);
                       }
       
                       ocr.Reset();
       
                       string[] images = new string[3];
                       for (int i = 0; i < images.Length; i++)
                       {
                           images[i] = "../../../../../../data/" + type + (i + 1).ToString("D2") + ".jpg";
                       }
       
                       for (int ix = 0; ix < 3; ix++)
                       {
                           // Creates the image object
                           gxImage image = new gxImage("default");
                           // Loads the sample image
                           Console.Write("Load {0}...", images[ix]);
                           image.Load(images[ix]);
                           Console.WriteLine("OK");
                           // Add image to the module
                           Console.Write("Add image to the module...");
                           ocr.AddImage(image, 0);
                           Console.WriteLine("OK");
                           image.Dispose();
                       }
                       Console.WriteLine();
                       //Console.WriteLine(ocr.GetProperty("datafile"));
                       // Read the code
                       Console.Write("Read the code by FindFirstContainerCode() function...");                
                       ocr.FindFirstContainerCode();
                       Console.WriteLine("OK");
                       if (ocr.IsValid())
                       {
                           Console.WriteLine("Code: '{0}', Confidence: '{1}'", ocr.GetCode(), ocr.GetConfidence());
                           for (int ix = 0; ix < ocr.GetNumberOfImages(); ix++)
                           {
                               Console.WriteLine("\tImgIndex: {0}, Code: '{1}', Confidence: '{2}'",
                                   ocr.GetImageIndex(ix),
                                   ocr.GetImageText(ix),
                                   ocr.GetImageConfidence(ix));
                           }
                           Console.Write("Read the result of the checksum validation...");
                           int csvalid = ocr.ChecksumIsValid();
                           int checksum = ocr.GetChecksum();
                           Console.WriteLine("OK");
                           Console.WriteLine("Checksum validation result: {0}, checksum: {1}", csvalid, checksum);
                       }
                       else
                       {
                           Console.WriteLine("No result");
                       }
                       //Console.ReadKey();
                   }
                   catch (gxException)
                   {
                       Console.Error.WriteLine("GX error (" + gxSystem.GetErrorCode() + ") occured: " + gxSystem.GetErrorString());
                       //Console.ReadKey();
                   }
               }
           }
       }
       
    


        /** \file *********************************************************************
        *
        * cmocr02 - Sample program for Container Code Reader
        *
        * 2006-2021 (c) Adaptive Recognition Hungary Inc. (http://www.adaptiverecognition.com)
        ******************************************************************************/
       
       /**
        * FindFirstContainerCode() example
        *
        * Purpose:
        *		Demonstrates the use of the FindFirstContainerCode() function
        *		to read industrial codes from a series of images.
        *
        * Description:
        *		After the user choose what kind of engine would like to try,
        *		the application loads the necessary images from file, adds them to the engine, and calls 
        *		the FindFirstContainerCode() function to read indutrial codes from the series.
        */
       
       import com.adaptiverecognition.gx.*;
       import com.adaptiverecognition.cm.*;
       
       import java.io.InputStreamReader;
       import java.io.BufferedReader;
       import java.io.IOException;
       
       public class cmocr02
       {
           static
           {
               try
               {
                   System.loadLibrary("jgx");
                   System.loadLibrary("jcmocr");
               }
               catch (UnsatisfiedLinkError e)
               {
                   System.err.println("Native code library failed to load." + e);
                   System.exit(1);
               }
           }
       
           public static int NOCRTYPES = 11;
           
           public static String ocr_types[] = 
           {
                   "aar",
                   "accr_usa",
                   "bra",
                   "chassis",
                   "ilu",
                   "iso",
                   "isoilu",
                   "moco"
                   "rus",
                   "uic",
                   "usdot",
           };
           
           public static void main(String argv[]) throws IOException
           {
               try
               {
                   gxProperty gxProperty = new gxProperty();
                   
                   System.out.print("Which engine would you like to try ?\n1.AAR\n2.ACCR_USA\n3.BRA\n4.CHASSIS\n5.ILU\n6.ISO\n7.ISOILU\n8.MOCO\n9.RUS\n10.UIC\n11.USDOT\n12.OLD engine(released before 21Q1)\n13.Use the default engine\nPlease choose a number between 1 and 13! Your choice : ");
                   
                   // Enter data using BufferReader
                   BufferedReader reader = new BufferedReader(
                       new InputStreamReader(System.in));
                   
                   String choice = reader.readLine();
                   int choice_int = Integer.parseInt(choice);
                   while (choice_int < 1 || choice_int > 13)
                   {
                       System.out.print("Please choose a number between 1 and 13: ");
                       choice = reader.readLine();
                       //Console.WriteLine("\"" + choice + "\"");
                       choice_int = Integer.parseInt(choice);
                   }
                   System.out.println("");
                   
                   // Creates the OCR object
                   cmOcr ocr;
                   String type = "";
                   
                   if (choice_int <= NOCRTYPES)
                   {
                       type = ocr_types[choice_int - 1];
                       System.out.println("You have choosen the \"" + type.toUpperCase() + "\" engine: " + gxProperty.GetProperty(type + "/cmocr") + "\n");
                       ocr = new cmOcr(type);
                   }
                   else if (choice_int == 12)
                   {
                       System.out.println("You have choosen an old engine (released before 21Q1), please give us the exact engine name like \"cmaccr-7.3.2.66:ilu\": ");
                       String engine = reader.readLine();
                       //System.out.println("\"" + engine + "\"");
                       gxProperty.SetProperty("default/cmocr", engine);
                       type = engine.substring(engine.indexOf(":") + 1);
                       type = type.trim();
                       System.out.println("You have choosen the old (\"" + type.toUpperCase() + "\") engine: " + engine + "\n");
                       ocr = new cmOcr("default");
                   }
                   else
                   {
                       ocr = new cmOcr("default");
                       String engine = gxProperty.GetProperty("default/cmocr");
                       //System.out.println("\"" + engine + "\"");
                       gxProperty.SetProperty("default/cmocr", engine);
                       type = engine.substring(engine.indexOf(":") + 1);
                       type = type.trim();
                       System.out.println("You have choosen the default (\"" + type.toUpperCase() + "\") engine: " + engine + "\n");
                   }
       
                   // Reset the container module
                   ocr.Reset();
                   
                   String images[] = new String[3];
                   for (int i = 0; i < images.length; i++)
                   {
                       images[i] = "../../data/" + type + String.format("%02d", i + 1) +".jpg";
                   }
       
                   for (int ix = 0; ix < 3; ix++)
                   {
                       // Creates the image object
                       gxImage image = new gxImage("default");
                       // Loads the sample image
                       System.out.print("Load: " + images[ix] + "...");
                       image.Load(images[ix]);
                       System.out.println("OK");
                       // Add image to the module
                       System.out.print("Add image to the module...");
                       ocr.AddImage(image, 0);
                       System.out.println("OK");
                   }
                   System.out.println("");
                   // Read code
                   System.out.print("Read the code by FindFirstContainerCode() fucntion...");
                   ocr.FindFirstContainerCode();
                   System.out.println("OK");
                   if (ocr.IsValid())
                   {
                       System.out.println("Code: '" + ocr.GetCode() + "', Confidence: '" + ocr.GetConfidence() + "'");
                       for (int ix = 0; ix < ocr.GetNumberOfImages(); ix++)
                           System.out.println("\tImgIndex: " + ocr.GetImageIndex(ix) + ", " +
                               "Code: '" + ocr.GetImageText(ix) + ", " +
                               "Confidence: '" + ocr.GetImageConfidence(ix) + "'");
                       System.out.print("Read the result of the checksum validation...");
                       int csvalid = ocr.ChecksumIsValid();
                       int checksum = ocr.GetChecksum();				
                       System.out.println("OK\nChecksum validation result: " + csvalid + ", checksum: " + checksum);
                   }
                   else
                   {
                       System.out.println("No result");
                   }
               }
               catch (RuntimeException e)
               {
                   System.err.println("GX error (" + String.format("0x%08x",gxSystem.GetErrorCode()) + ") occured: " + gxSystem.GetErrorString());
                   System.exit(1);
               }
           }
       }
       
    


        '/** \file *********************************************************************
        ' *
        ' * cmanpr01 - CMANPR sample program
        ' *
        ' * 2006-2021 (c) Adaptive Recognition Hungary Inc. (http://www.adaptiverecognition.com)
        ' ******************************************************************************/
        '
        '/**
        ' * Show an ANPR process
        ' *
        ' * Purpose:
        ' *		At the beginning, the application is checking if everything is all right with the gxsd.dat syntax, if not, the execution will stop and will notify the user about the problem.
        ' *		Shows how to do an ANPR on an image and print out the result in text
        ' */
        
        Imports System
        Imports gx
        Imports cm
        
        Module Main
            Sub Main()
                Try
                    Dim gxProperty As gxProperty = New gxProperty
                    gxProperty.IsPropertiesValid()
                    Console.WriteLine("The syntax of the gxsd.dat file is fine!")
                    Console.WriteLine()
        
                    ' Creates the ANPR object
                    Dim anpr As cmAnpr = New cmAnpr("default")
                    ' Creates the image object
                    Dim image As gxImage = New gxImage("default")
        
                    ' Gets the name of the default engine
                    Console.WriteLine("Engine: '{0}'", anpr.GetProperty("anprname"))
                    Console.WriteLine()
        
                    ' Checks the licenses for the default engine 
                    If Not anpr.CheckLicenses4Engine("", 0) Then
                        Console.WriteLine("Cannot find licenses for the current engine!!!")
                        Exit Sub
                    End If
        
                    ' Loads the sample image
                    image.Load("../../../../../../data/plate.jpg")
        
                    ' Finds the first license plate
                    If anpr.FindFirst(image) Then
                        ' Get short country code
                        Dim cc As String
                        cc = anpr.GetCountryCode(anpr.GetType(), CC_TYPE.CCT_COUNTRY_SHORT)
                        If cc.Length = 0 Then cc = "No plate type"
                        ' Displays the result, Country code and type
                        Console.WriteLine("Plate text: '{0}'; Country code: '{1}' ({2})", anpr.GetText(), cc, anpr.GetType())
                    Else
                        Console.WriteLine("No license plate found")
                    End If
                    Console.ReadKey()
                Catch ex As gxException
                    Console.Error.WriteLine("GX error (" + gxSystem.GetErrorCode().ToString() + ") occured: " + gxSystem.GetErrorString())
                    Console.ReadKey()
                End Try
            End Sub
        End Module
        
    

Licensing Guidelines Based on
Processing Power and Requirements

Guidelines
Single License (Image/Sec) Dual License (Image/Sec) Quad License (Image/Sec)
i3 processor
1 - 2 1 - 3 1 - 6
i5 processor
1 - 2 1 - 4 1 - 8
i7 processor
1 - 3 4 - 6 2 - 12
i3 processor
1 - 2
i5 processor
1 - 2
i7 processor
1 - 3
i3 processor
1 - 3
i5 processor
1 - 4
i7 processor
4 - 6
i3 processor
1 - 6
i5 processor
1 - 8
i7 processor
2 - 12
Image processing capacity depends on numerous factors, such as resolution, the processing capacity of hardware, the complexity of regional license plates, and the number of license plate types. The values above are guidelines based on FHD resolution and OCR-ready images. For more information, please contact us.

Product Documentation and Other Resources

Contact

AR_PRODUCT

Ez a form a termékekhez. Minden terméknél a preferred product type-ot fix értékkel egy hidden mezőben el kell helyezni. Az Aktív form nevek kezdődjenek így: AR_PRODUCT_(product név)

  • Please describe your type of business
  • This field is for validation purposes and should be left unchanged.

GET MORE INFORMATION OR A QUOTE

Our sales & product experts are here to help you. Contact us or find an affiliate near your location.

View our representatives on a map