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 function GdPictureOCR();
Return Value
A new instance of the GdPictureOCR class.
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