diff --git a/src/openalpr/alpr.cpp b/src/openalpr/alpr.cpp index 840b96b..a89ce21 100644 --- a/src/openalpr/alpr.cpp +++ b/src/openalpr/alpr.cpp @@ -68,6 +68,11 @@ namespace alpr return impl->recognize(imageBytes); } + AlprResults Alpr::recognize(std::vector imageBytes, std::vector regionsOfInterest) + { + return impl->recognize(imageBytes, regionsOfInterest); + } + AlprResults Alpr::recognize(unsigned char* pixelData, int bytesPerPixel, int imgWidth, int imgHeight, std::vector regionsOfInterest) { return impl->recognize(pixelData, bytesPerPixel, imgWidth, imgHeight, regionsOfInterest); diff --git a/src/openalpr/alpr.h b/src/openalpr/alpr.h index 7146322..c94ed9b 100644 --- a/src/openalpr/alpr.h +++ b/src/openalpr/alpr.h @@ -132,8 +132,11 @@ namespace alpr // Recognize from an image on disk AlprResults recognize(std::string filepath); - // Recognize from byte data representing an encoded image (e.g., BMP, PNG, JPG, GIF etc). - AlprResults recognize(std::vector imageBytes); + // Recognize from byte data representing an encoded image (e.g., BMP, PNG, JPG, GIF etc). + AlprResults recognize(std::vector imageBytes); + + // Recognize from byte data representing an encoded image (e.g., BMP, PNG, JPG, GIF etc). + AlprResults recognize(std::vector imageBytes, std::vector regionsOfInterest); // Recognize from raw pixel data. AlprResults recognize(unsigned char* pixelData, int bytesPerPixel, int imgWidth, int imgHeight, std::vector regionsOfInterest); diff --git a/src/openalpr/alpr_impl.cpp b/src/openalpr/alpr_impl.cpp index fc8ca37..aa10796 100644 --- a/src/openalpr/alpr_impl.cpp +++ b/src/openalpr/alpr_impl.cpp @@ -345,6 +345,13 @@ namespace alpr return this->recognize(img); } + AlprResults AlprImpl::recognize(std::vector imageBytes, std::vector regionsOfInterest) + { + cv::Mat img = cv::imdecode(cv::Mat(imageBytes), 1); + + return this->recognize(img, regionsOfInterest); + } + AlprResults AlprImpl::recognize( unsigned char* pixelData, int bytesPerPixel, int imgWidth, int imgHeight, std::vector regionsOfInterest) { diff --git a/src/openalpr/alpr_impl.h b/src/openalpr/alpr_impl.h index f5fcbd9..776807b 100644 --- a/src/openalpr/alpr_impl.h +++ b/src/openalpr/alpr_impl.h @@ -76,6 +76,7 @@ namespace alpr AlprFullDetails recognizeFullDetails(cv::Mat img, std::vector regionsOfInterest); AlprResults recognize( std::vector imageBytes ); + AlprResults recognize( std::vector imageBytes, std::vector regionsOfInterest ); AlprResults recognize( unsigned char* pixelData, int bytesPerPixel, int imgWidth, int imgHeight, std::vector regionsOfInterest ); AlprResults recognize( cv::Mat img ); AlprResults recognize( cv::Mat img, std::vector regionsOfInterest );