图片中文字定位识别tesseract如何增强文字框选范围呢?

在图片中查找文字定位查找到的定位乱七八糟,调了RIL_WORD以及RIL_TEXTLINE等等模式也不行

img

Box[1]:x=213,y=8,w=117,h=16,confidence:58,text:抗疫图片专栏姓名

像这种带连线的根本都分不开,要是能够达到腾讯QQ的文字识别效果就好了。
腾讯QQ的文字识别绝大多数都是可以做到把文字按一小块一小块的,它是如何做到的呢?

img

import net.sourceforge.tess4j.Tesseract;
import org.bytedeco.javacpp.BytePointer;
import org.bytedeco.leptonica.BOX;
import org.bytedeco.leptonica.BOXA;
import org.bytedeco.leptonica.PIX;
import org.bytedeco.tesseract.TessBaseAPI;
 
import java.io.File;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
 
import static org.bytedeco.leptonica.global.lept.*;
import static org.bytedeco.tesseract.global.tesseract.RIL_WORD;
 
public class imageUrl {
 
    public static void main(String[] args) throws Exception {
 
        BytePointer outtext;
 
        TessBaseAPI api = new TessBaseAPI();
 
        if (api.Init("tessdata", "zwp") != 0) {
 
            System.err.println("Could not initialalize tesseract");
 
            System.exit(0);
 
        }
        File file = new File("image.png");
 
        PIX image = pixRead(file.getAbsolutePath());
 
        image=pixConvertRGBToGrayFast(image);
 
        api.SetImage(image);
 
        int[] blockIds = {};
 
        long starttime = System.currentTimeMillis();
 
        BOXA boxes = api.GetComponentImages(RIL_WORD, true, null, blockIds);
 
        for (int i = 0; i < boxes.n(); i++) {
 
            BOX box = boxes.box(i);
 
            api.SetRectangle(box.x(), box.y(), box.w(), box.h());
 
            outtext = api.GetUTF8Text();
 
            String ocrresult = outtext.getString();
 
            int conf = api.MeanTextConf();
 
            String boxinformation = String.format("Box[%d]:x=%d,y=%d,w=%d,h=%d,confidence:%d,text:%s", i, box.x(),
                    box.y(), box.w(), box.h(), conf, ocrresult);
            System.out.println(boxinformation);
            outtext.deallocate();
        }
        api.End();
        pixDestroy(image);
        long invertaltime = System.currentTimeMillis() - starttime;
        System.out.println("识别用时:" + invertaltime);
    }
}

我的想法:
1,腾讯强,而我们鸡。
2,简单点的做法还是记录下文字的位置,然后识别。

自己标注,重新画框,重新训练模型,文字检测,应该会有用吧,就是成本太大。。

腾讯是自己写的控件,或者CSS做得非常好
你可以根据腾讯控件的使用效果去开发属于自己的控件

可以使用图片识别抓取软件或第三方插件

关键词:神经网络 文字检测 CTPN

请问谁知道怎么解决pytesseract返回小方块啊?