diff --git a/src/openalpr/alpr.cpp b/src/openalpr/alpr.cpp index c9d2a88..d2ee8f6 100644 --- a/src/openalpr/alpr.cpp +++ b/src/openalpr/alpr.cpp @@ -59,11 +59,11 @@ AlprResults Alpr::recognize(unsigned char* pixelData, int bytesPerPixel, int img std::string Alpr::toJson( AlprResults results ) { - return impl->toJson(results); + return AlprImpl::toJson(results); } AlprResults Alpr::fromJson(std::string json) { - return impl->fromJson(json); + return AlprImpl::fromJson(json); } diff --git a/src/openalpr/alpr.h b/src/openalpr/alpr.h index f737e06..6bec99c 100644 --- a/src/openalpr/alpr.h +++ b/src/openalpr/alpr.h @@ -114,8 +114,8 @@ class Alpr AlprResults recognize(unsigned char* pixelData, int bytesPerPixel, int imgWidth, int imgHeight, std::vector regionsOfInterest); - std::string toJson(const AlprResults results); - AlprResults fromJson(std::string json); + static std::string toJson(const AlprResults results); + static AlprResults fromJson(std::string json); bool isLoaded(); diff --git a/src/openalpr/alpr_impl.h b/src/openalpr/alpr_impl.h index cebd565..b8963eb 100644 --- a/src/openalpr/alpr_impl.h +++ b/src/openalpr/alpr_impl.h @@ -79,8 +79,8 @@ class AlprImpl void setTopN(int topn); void setDefaultRegion(std::string region); - std::string toJson( const AlprResults results ); - AlprResults fromJson(std::string json); + static std::string toJson( const AlprResults results ); + static AlprResults fromJson(std::string json); static std::string getVersion(); Config* config; @@ -99,7 +99,7 @@ class AlprImpl std::vector convertRects(std::vector regionsOfInterest); - cJSON* createJsonObj(const AlprPlateResult* result); + static cJSON* createJsonObj(const AlprPlateResult* result); }; diff --git a/src/tests/test_api.cpp b/src/tests/test_api.cpp index cd9e508..a469edf 100644 --- a/src/tests/test_api.cpp +++ b/src/tests/test_api.cpp @@ -18,7 +18,6 @@ using namespace std; TEST_CASE( "JSON Serialization/Deserialization", "[json]" ) { - Alpr alpr("us"); AlprResults origResults; origResults.epoch_time = getEpochTime(); origResults.img_width = 640; @@ -53,8 +52,8 @@ TEST_CASE( "JSON Serialization/Deserialization", "[json]" ) { origResults.plates.push_back(apr); - std::string resultsJson = alpr.toJson(origResults); - AlprResults roundTrip = alpr.fromJson(resultsJson); + std::string resultsJson = Alpr::toJson(origResults); + AlprResults roundTrip = Alpr::fromJson(resultsJson); REQUIRE( roundTrip.epoch_time == origResults.epoch_time ); REQUIRE( roundTrip.img_width == origResults.img_width );