如何从iOS中的图像中检测和提取文本的位置

时间:2014-10-06 04:13:27

标签: ios opencv tesseract text-recognition

如何从图像中检测和提取文本的位置。对于来自百事可乐瓶图像的文字“百事可乐”。 http://www.csmonitor.com/var/ezflow_site/storage/images/media/content/2013/0321-new-pepsi-bottle.jpg/15343519-1-eng-US/0321-new-pepsi-bottle.jpg_full_600.jpg

2 个答案:

答案 0 :(得分:0)

首先你需要两张这样的照片。在opencv或photoshop中使用canny。

enter image description here enter image description here

然后将背景差异设为如下

    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
    Mat model = Highgui.imread("D:\\BKDiff\\can1.jpg",Highgui.CV_LOAD_IMAGE_GRAYSCALE);
    Mat scene = Highgui.imread("D:\\BKDiff\\can2.jpg",Highgui.CV_LOAD_IMAGE_GRAYSCALE);
    Mat diff = new Mat();
    Core.absdiff(model,scene,diff);
    Imgproc.threshold(diff,diff,15,1000,Imgproc.THRESH_BINARY);
    int distortion = Core.countNonZero(diff);
    Highgui.imwrite("D:\\BKDiff\\out.jpg",diff);

之后,你会得到这个。

enter image description here

答案 1 :(得分:0)

您还可以在Stroke Width transform上看到以下论文。它易于实现,并且具有很高的准确性。

我看到还有一个implementation