Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 如何在本地路径中转换和保存Hocr文件?如何解决以下函数中的错误?_Python 3.x_Image Processing_Python Tesseract_Hocr - Fatal编程技术网

Python 3.x 如何在本地路径中转换和保存Hocr文件?如何解决以下函数中的错误?

Python 3.x 如何在本地路径中转换和保存Hocr文件?如何解决以下函数中的错误?,python-3.x,image-processing,python-tesseract,hocr,Python 3.x,Image Processing,Python Tesseract,Hocr,我在下面的函数中得到了意外的缩进 def save_hocr(self,data=[]): df_hocr=数据 u=0 对于df_hocr中的img: u=u+1 image=base64b64解码(str(img)) img=Image.open(io.BytesIO(Image)) imagePath=(D:\\'+str(u)+.jpeg) 保存(图像路径,'jpeg') hocr=pytesseract.image\u to\u pdf\u或\u hocr(img,扩展名='hocr'

我在下面的函数中得到了意外的缩进

def save_hocr(self,data=[]):
df_hocr=数据
u=0
对于df_hocr中的img:
u=u+1
image=base64b64解码(str(img))
img=Image.open(io.BytesIO(Image))
imagePath=(D:\\'+str(u)+.jpeg)
保存(图像路径,'jpeg')
hocr=pytesseract.image\u to\u pdf\u或\u hocr(img,扩展名='hocr')
Y=打开(str(u)+“.html”,“wb”)
Y.write(hocr)
Y.关闭()
返回“ok”