rmtheis / tess-two

Fork of Tesseract Tools for Android
Apache License 2.0
3.76k stars 1.38k forks source link

Is there any document or sample code for HydrogenTextDetector? #189

Closed hgneng closed 7 years ago

hgneng commented 7 years ago

I am interested in HydrogenTextDetector. However, I found little information about it. I Is there any document or sample code for HydrogenTextDetector?

I guess this is a library that detect smallest area that contains text from image. Please tell me what exactly do if my guess is wrong.

I suppose getTextAreas() will return a smaller width and height area than source image but it doesn't (from Java code, getTextAreas always return same width and height to source image). So how do I use this library?

Here is some of my code that try to use HydrogenTextDetector:

        Bitmap bitmap = BitmapFactory.decodeFile("/sdcard/tesseract/tests/2-1234567890.png");
        Pix pix = ReadFile.readBitmap(bitmap);
        HydrogenTextDetector textDetector = new HydrogenTextDetector();
        textDetector.setSourceImage(pix);
        textDetector.detectText();
        Pixa pixa = textDetector.getTextAreas();
        pix.recycle();
rmtheis commented 7 years ago

Is there any document or sample code for HydrogenTextDetector?

The short answer is no. You may be able to get some hints from looking at the source code in hydrogentextdetector.cpp and hydrogentextdetector.h.

For me, the default settings have worked to detect regions of small black text on a white background. Maybe try tweaking the parameters in the C++ code.