How to use the tesserocr.file_to_text function in tesserocr

To help you get started, we’ve selected a few tesserocr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sirfz / tesserocr / tests / test_api.py View on Github external
def test_image_file(self):
        """Test SetImageFile and GetUTF8Text."""
        self._api.SetImageFile(self._image_file)
        text = self._api.GetUTF8Text()
        self.assertIn('quick', text)
        text2 = tesserocr.file_to_text(self._image_file)
        self.assertEqual(text, text2)
github JiangKui007 / jx_ocr / photoPretreatLib / fileOcrTrement.py View on Github external
return im


bim = image.point(table,'1')

"""使用tesserocr图像识别引擎对图片识别"""
bim.save('temporary_file/a6.tiff')

#api法调用tesserocr
api = tesserocr.PyTessBaseAPI(lang='chi_sim')
api.SetImageFile('temporary_file/a6.tiff')
print api.GetUTF8Text().strip()
#print tesserocr.image_to_text(image)  # print ocr text from image
# or
#调用file_to_text方法
print tesserocr.file_to_text('temporary_file/a4.tiff',lang='chi_sim')