I am confused as to why you added the * 200 to the SetROI method here:
Code: Select all
Call oGDTemp.SetROI(CInt(LeftArea * 200), CInt(TopArea * 200), CInt(WidthArea * 200), CInt(HeightArea * 200))
I'm writing in C#, and evaluating the library for an internal tool.
We need the ability to allow the user to designate multiple regions of interest on an image, and then click a button to "test" that each region pulls back the appropriate data for that region. In some cases this requires that the image be rotated prior to the user selecting an area.
In testing with a single image, that the user must rotate counter-clockwise once. It appears that I am getting the appropriate Top/Left/Width/Height from the viewer. However, when the "test" is kicked off, the OCR returns an empty string, no errors.
When rotating, I'm already converting from PDF to GDPictureImage?
Code: Select all
int imgID = gdViewer1.PdfRenderPageToGdPictureImage(200 , 1);
oGdPictureImaging.Rotate(imgID, GdPicture.RotateFlipType.Rotate90FlipNone);
gdViewer1.DisplayFromGdPictureImage(imgID);
So - perhaps later, when I attempt to do the OCR, I need to use some other method for getting the imgID from the viewer?
Code: Select all
int imgID = gdViewer1.PdfRenderPageToGdPictureImage(200, 1);
float myTopArea = float.Parse(this.txtbxTop.Text);
float myLeftArea = float.Parse(this.txtBxLeft.Text);
float myWidthArea = float.Parse(this.txtbxWidth.Text);
float myHeightArea = float.Parse(this.txtbxHeight.Text);
string myResults = "";
oGdPictureImaging.SetROI(Convert.ToInt32(myLeftArea * 200), Convert.ToInt32(myTopArea * 200), Convert.ToInt32(myWidthArea * 200), Convert.ToInt32(myHeightArea ));
myResults = oGdPictureImaging.OCRTesseractDoOCR(imgID, TesseractDictionary.TesseractDictionaryEnglish, "C:\\Program Files\\GdPicture.NET\\Redist\\OCR\\" , "");
if (oGdPictureImaging.GetStat() == GdPictureStatus.OCRDictionaryNotFound){
MessageBox.Show("Needed dictionary is not into the specified path! ");
}
if (myResults == "")
{
MessageBox.Show("Didn't find anything, spinning it!");
oGdPictureImaging.Rotate(imgID, GdPicture.RotateFlipType.Rotate90FlipNone);
myResults = oGdPictureImaging.OCRTesseractDoOCR(imgID, TesseractDictionary.TesseractDictionaryEnglish, "C:\\Program Files\\GdPicture.NET\\Redist\\OCR\\", "");
}
if (myResults == "")
{
MessageBox.Show("Didn't find anything, spinning it!");
oGdPictureImaging.Rotate(imgID, GdPicture.RotateFlipType.Rotate90FlipNone);
myResults = oGdPictureImaging.OCRTesseractDoOCR(imgID, TesseractDictionary.TesseractDictionaryEnglish, "C:\\Program Files\\GdPicture.NET\\Redist\\OCR\\", "");
}
if (myResults == "")
{
MessageBox.Show("Didn't find anything, spinning it!");
oGdPictureImaging.Rotate(imgID, GdPicture.RotateFlipType.Rotate90FlipNone);
myResults = oGdPictureImaging.OCRTesseractDoOCR(imgID, TesseractDictionary.TesseractDictionaryEnglish, "C:\\Program Files\\GdPicture.NET\\Redist\\OCR\\", "");
}
if (myResults == "")
{
MessageBox.Show("Didn't find anything, I am done!");
}
else
{
MessageBox.Show("FOUND: " + myResults);
}
oGdPictureImaging.OCRTesseractClear();
However, I haven't found a method for returning the imgID from the viewer, nor a method for creating an imgID from a gdPictureImage within the viewer. End result is, I can't seem to figure out how to actually get my Region OCR'd.