GdPicture.NET.14
GdPicture14 Namespace / GdPictureOCR Class / GdPictureOCR Constructor
Example





In This Topic
GdPictureOCR Constructor
In This Topic
Creates a new instance of the GdPictureOCR class. This instance represents a wrapper, that you will need to perform all available OCR operations. At the same it enables you to find out all required results in one place.
Syntax
'Declaration
 
Public Function New()
public GdPictureOCR()
public GdPictureOCR(); 
public function GdPictureOCR();
public: GdPictureOCR();
public:
GdPictureOCR();

Return Value

A new instance of the GdPictureOCR class.
Remarks
Using only this object you are able to set available parameters required for OCR processes, run the process itself and also to check results in one place.
Example
How to create and initialize a GdPictureOCR object.
'The first option:
 
Dim gdpictureOCR As GdPictureOCR = New GdPictureOCR()
 
gdpictureOCR.CharacterSet = "0123456789"
gdpictureOCR.Context = OCRContext.OCRContextSingleBlock
gdpictureOCR.LanguageModelPenaltyNonDictWords = 0.2F
gdpictureOCR.LanguageModelPenaltyNonFreqDictWords = 0.25F
gdpictureOCR.MaxCharHeight = 100
gdpictureOCR.MaxCharWidth = 10
gdpictureOCR.MinCharHeight = 50
gdpictureOCR.MinCharWidth = 5
gdpictureOCR.OCRMode = OCRMode.FavorAccuracy
gdpictureOCR.ResourcesFolder = "\GdPicture.Net 14\redist\OCR"
gdpictureOCR.Timeout = 500
 
gdpictureOCR.Dispose()
 
'The second option:
 
'The very good practice is to use the keyword "using".
Using gdpictureOCR As GdPictureOCR = New GdPictureOCR()
    gdpictureOCR.CharacterSet = "0123456789"
    gdpictureOCR.Context = OCRContext.OCRContextSingleBlock
    gdpictureOCR.LanguageModelPenaltyNonDictWords = 0.2F
    gdpictureOCR.LanguageModelPenaltyNonFreqDictWords = 0.25F
    gdpictureOCR.MaxCharHeight = 100
    gdpictureOCR.MaxCharWidth = 10
    gdpictureOCR.MinCharHeight = 50
    gdpictureOCR.MinCharWidth = 5
    gdpictureOCR.OCRMode = OCRMode.FavorAccuracy
    gdpictureOCR.ResourcesFolder = "\GdPicture.Net 14\redist\OCR"
    gdpictureOCR.Timeout = 500
 
    'You can do your another stuff with gdpictureOCR here.
End Using
//The first option:
 
GdPictureOCR gdpictureOCR = new GdPictureOCR();
 
gdpictureOCR.CharacterSet = "0123456789";
gdpictureOCR.Context = OCRContext.OCRContextSingleBlock;
gdpictureOCR.LanguageModelPenaltyNonDictWords = 0.2F;
gdpictureOCR.LanguageModelPenaltyNonFreqDictWords = 0.25F;
gdpictureOCR.MaxCharHeight = 100;
gdpictureOCR.MaxCharWidth = 10;
gdpictureOCR.MinCharHeight = 50;
gdpictureOCR.MinCharWidth = 5;
gdpictureOCR.OCRMode = OCRMode.FavorAccuracy;
gdpictureOCR.ResourcesFolder = "\\GdPicture.Net 14\\redist\\OCR";
gdpictureOCR.Timeout = 500;
 
gdpictureOCR.Dispose();
 
//The second option:
 
//The very good practice is to use the keyword "using".
using (GdPictureOCR gdpictureOCR = new GdPictureOCR())
{
    gdpictureOCR.CharacterSet = "0123456789";
    gdpictureOCR.Context = OCRContext.OCRContextSingleBlock;
    gdpictureOCR.LanguageModelPenaltyNonDictWords = 0.2F;
    gdpictureOCR.LanguageModelPenaltyNonFreqDictWords = 0.25F;
    gdpictureOCR.MaxCharHeight = 100;
    gdpictureOCR.MaxCharWidth = 10;
    gdpictureOCR.MinCharHeight = 50;
    gdpictureOCR.MinCharWidth = 5;
    gdpictureOCR.OCRMode = OCRMode.FavorAccuracy;
    gdpictureOCR.ResourcesFolder = "\\GdPicture.Net 14\\redist\\OCR";
    gdpictureOCR.Timeout = 500;
 
    //You can do your another stuff with gdpictureOCR here.
}
See Also