Fixed the easy things on the names detections
This commit is contained in:
@@ -19,13 +19,14 @@ namespace OCR_Decode
|
||||
{
|
||||
string result = "";
|
||||
|
||||
Image rawData = Image;
|
||||
rawData.Save(Reader.DEBUG_DUMP_FOLDER + Name + "_Before" + ".png");
|
||||
Bitmap rawData = WindowImage;
|
||||
rawData = Window.ConvertToBlackAndWhite(rawData,100);
|
||||
|
||||
TesseractEngine engine = new TesseractEngine(TESS_DATA_FOLDER.FullName, "eng", EngineMode.Default);
|
||||
var tessImage = Pix.LoadFromMemory(ImageToByte(WindowImage));
|
||||
|
||||
Page page = engine.Process(tessImage);
|
||||
Graphics g = Graphics.FromImage(rawData);
|
||||
// Get the iterator for the page layout
|
||||
using (var iter = page.GetIterator())
|
||||
{
|
||||
@@ -33,13 +34,19 @@ namespace OCR_Decode
|
||||
iter.Begin();
|
||||
do
|
||||
{
|
||||
Rect boundingBox;
|
||||
// Get the bounding box for the current element
|
||||
if (iter.TryGetBoundingBox(PageIteratorLevel.Word, out boundingBox))
|
||||
{
|
||||
g.DrawRectangle(Pens.Red, new Rectangle(boundingBox.X1, boundingBox.Y1, boundingBox.Width, boundingBox.Height));
|
||||
}
|
||||
// Get the text for the current element
|
||||
result += iter.GetText(PageIteratorLevel.Word);
|
||||
} while (iter.Next(PageIteratorLevel.Word));
|
||||
}
|
||||
//REMOVE !!!
|
||||
//result += rnd.Next(0,100);
|
||||
rawData.Save(Reader.DEBUG_DUMP_FOLDER + result + "_Before" + ".png");
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user