Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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')