diff --git a/src/bindings/csharp/openalpr-net/openalpr-net.cpp b/src/bindings/csharp/openalpr-net/openalpr-net.cpp index 05a5ecd..bd0ed82 100644 --- a/src/bindings/csharp/openalpr-net/openalpr-net.cpp +++ b/src/bindings/csharp/openalpr-net/openalpr-net.cpp @@ -1329,6 +1329,14 @@ namespace openalprnet { return gcnew AlprResultsNet(results); } + /// + /// Recognize from a bitmap + /// + AlprResultsNet^ recognize(Bitmap^ bitmap) + { + return recognize(bitmap, gcnew List()); + } + /// /// Recognize from a bitmap /// @@ -1341,20 +1349,17 @@ namespace openalprnet { } /// - /// Recognize from a bitmap + /// Recognize from MemoryStream representing an encoded image (e.g., BMP, PNG, JPG, GIF etc). /// - AlprResultsNet^ recognize(Bitmap^ bitmap) + AlprResultsNet^ recognize(MemoryStream^ memoryStream) { - cv::Mat frame = AlprHelper::BitmapToMat(bitmap); - std::vector rois; - AlprResults results = m_Impl->recognize(frame.data, frame.elemSize(), frame.cols, frame.rows, rois); - return gcnew AlprResultsNet(results); + return recognize(memoryStream, gcnew List()); } /// /// Recognize from MemoryStream representing an encoded image (e.g., BMP, PNG, JPG, GIF etc). /// - AlprResultsNet^ recognize(MemoryStream^ memoryStream) + AlprResultsNet^ recognize(MemoryStream^ memoryStream, List^ regionsOfInterest) { std::vector p = AlprHelper::MemoryStreamToVector(memoryStream); AlprResults results = m_Impl->recognize(p); @@ -1366,6 +1371,14 @@ namespace openalprnet { /// /// Bytes representing image data AlprResultsNet^ recognize(cli::array^ imageBuffer) { + return recognize(imageBuffer, gcnew List()); + } + + /// + /// Recognize from byte data representing an encoded image (e.g., BMP, PNG, JPG, GIF etc). + /// + /// Bytes representing image data + AlprResultsNet^ recognize(cli::array^ imageBuffer, List^ regionsOfInterest) { std::vector p = AlprHelper::ToVector(imageBuffer); AlprResults results = m_Impl->recognize(p); return gcnew AlprResultsNet(results); @@ -1374,8 +1387,15 @@ namespace openalprnet { /// /// Recognize from raw pixel data /// - AlprResultsNet^ recognize(cli::array^ pixelData, int bytesPerPixel, int imgWidth, int imgHeight, List^ regionsOfInterest) { - unsigned char* p = AlprHelper::ToCharPtr(pixelData); + AlprResultsNet^ recognize(cli::array^ imageBuffer, int bytesPerPixel, int imgWidth, int imgHeight) { + return recognize(imageBuffer, bytesPerPixel, imgWidth, imgHeight, gcnew List()); + } + + /// + /// Recognize from raw pixel data + /// + AlprResultsNet^ recognize(cli::array^ imageBuffer, int bytesPerPixel, int imgWidth, int imgHeight, List^ regionsOfInterest) { + unsigned char* p = AlprHelper::ToCharPtr(imageBuffer); std::vector rois = AlprHelper::ToVector(regionsOfInterest); AlprResults results = m_Impl->recognize(p, bytesPerPixel, imgWidth, imgHeight, rois); free(p); // ?? memory leak?