1
我想用Boost優化我的Python程序,並用C++函數替換一些Python代碼。通過Boost將圖像從Python發送到C++
Python代碼:
from PIL import Image
for i in xrange(len(lines)):
im = Image.fromarray(lines[i])
line = pytesseract.image_to_string(im, "ukr+ukrb") # working to slow
和代碼在C++:
Pix *image = pixRead("/home/lucas63/Downloads/test.tif"); # here i need to get image directly from Python
api->SetImage(image);
outText = api->GetUTF8Text();
printf("OCR output:\n%s", outText);`
所以,我需要做兩件事情:從Python來
- 發送圖像C++使用
Boost.Python
。 - 向C++發送圖像數組(我想通過在C++中使用多線程處理來提高性能)。
感謝您的回答,我將嘗試用tesserocr替換py-tesseract,並且稍後我會寫關於結果 – lucas63
Ty的幫助,現在它工作得更好 – lucas63