Commit 8be87cdb authored by Jerome Flesch's avatar Jerome Flesch

Merge branch 'master' into 'master'

Add libtesseract API endpoint for image resolution setting

See merge request !110
parents 4c1942d8 6b1bed66
...@@ -168,6 +168,13 @@ if g_libtesseract: # pragma: no cover ...@@ -168,6 +168,13 @@ if g_libtesseract: # pragma: no cover
] ]
g_libtesseract.TessBaseAPIInit3.restype = ctypes.c_int g_libtesseract.TessBaseAPIInit3.restype = ctypes.c_int
g_libtesseract.TessBaseAPISetSourceResolution.argtypes = [
ctypes.c_void_p, # TessBaseAPI*
ctypes.c_int, # PPI
]
g_libtesseract.TessBaseAPISetSourceResolution.restype = None
g_libtesseract.TessBaseAPISetVariable.argtypes = [ g_libtesseract.TessBaseAPISetVariable.argtypes = [
ctypes.c_void_p, # TessBaseAPI* ctypes.c_void_p, # TessBaseAPI*
ctypes.c_char_p, # name ctypes.c_char_p, # name
...@@ -464,7 +471,7 @@ def set_image(handle, image): ...@@ -464,7 +471,7 @@ def set_image(handle, image):
) )
dpi = image.info.get("dpi", [DPI_DEFAULT])[0] dpi = image.info.get("dpi", [DPI_DEFAULT])[0]
g_libtesseract.TessBaseAPISetSourceResolution(handle, dpi) g_libtesseract.TessBaseAPISetSourceResolution(ctypes.c_void_p(handle), dpi)
def recognize(handle): def recognize(handle):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment