mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-05 07:27:24 +08:00
Added a function to the C binding to free a char* pointer
This commit is contained in:
@@ -21,7 +21,8 @@
|
||||
#include <alpr.h>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
OPENALPRC_DLL_EXPORT OPENALPR* openalpr_init(const char* country, const char* configFile, const char* runtimeDir)
|
||||
{
|
||||
alpr::Alpr* alpr_inst = new alpr::Alpr(country, configFile, runtimeDir);
|
||||
@@ -99,6 +100,12 @@ OPENALPRC_DLL_EXPORT char* openalpr_recognize_encodedimage(OPENALPR* instance, u
|
||||
return result_obj;
|
||||
}
|
||||
|
||||
|
||||
OPENALPRC_DLL_EXPORT void openalpr_free_response_string(char* response)
|
||||
{
|
||||
free(response);
|
||||
}
|
||||
|
||||
OPENALPRC_DLL_EXPORT void openalpr_cleanup(OPENALPR* instance)
|
||||
{
|
||||
delete ((alpr::Alpr*) instance);
|
||||
|
@@ -65,6 +65,11 @@ char* openalpr_recognize_rawimage(OPENALPR* instance, unsigned char* pixelData,
|
||||
// Recognizes the encoded (e.g., JPEG, PNG) image. bytes are the raw bytes for the image data.
|
||||
char* openalpr_recognize_encodedimage(OPENALPR* instance, unsigned char* bytes, long long length, struct AlprCRegionOfInterest roi);
|
||||
|
||||
// Frees a char* response that was provided from a recognition request.
|
||||
// This is required for interoperating with managed languages (e.g., C#) that can't free the memory themselves
|
||||
void openalpr_free_response_string(char* response);
|
||||
|
||||
// Free the memory for the OpenALPR instance created with openalpr_init
|
||||
void openalpr_cleanup(OPENALPR* instance);
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user