Exposed setPrewarp function in Python binding

This commit is contained in:
Matt Hill
2016-02-16 15:08:04 -05:00
parent ceefcea0ea
commit 766e6383ea
2 changed files with 23 additions and 0 deletions

View File

@@ -81,6 +81,9 @@ class Alpr():
self._set_country_func = self._openalprpy_lib.setCountry
self._set_country_func.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
self._set_prewarp_func = self._openalprpy_lib.setPrewarp
self._set_prewarp_func.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
self._set_default_region_func = self._openalprpy_lib.setDefaultRegion
self._set_default_region_func.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
@@ -181,6 +184,18 @@ class Alpr():
country = _convert_to_charp(country)
self._set_country_func(self.alpr_pointer, country)
def set_prewarp(self, prewarp):
"""
Updates the prewarp configuration used to skew images in OpenALPR before
processing.
:param prewarp: A unicode/ascii string (Python 2/3) or bytes array (Python 3)
:return: None
"""
prewarp = _convert_to_charp(prewarp)
self._set_prewarp_func(self.alpr_pointer, prewarp)
def set_default_region(self, region):
"""
This sets the default region for detecting license plates. For example,

View File

@@ -104,6 +104,14 @@ extern "C" {
nativeAlpr->setCountry(country);
}
OPENALPR_EXPORT void setPrewarp(Alpr* nativeAlpr, char* cprewarp)
{
// Convert strings from java to C++ and release resources
std::string prewarp(cprewarp);
nativeAlpr->setPrewarp(prewarp);
}
OPENALPR_EXPORT void setDefaultRegion(Alpr* nativeAlpr, char* cdefault_region)
{
// Convert strings from java to C++ and release resources