diff --git a/src/bindings/csharp/openalpr-net/bitmapmat-net.h b/src/bindings/csharp/openalpr-net/bitmapmat-net.h index a65acf3..cedbf94 100644 --- a/src/bindings/csharp/openalpr-net/bitmapmat-net.h +++ b/src/bindings/csharp/openalpr-net/bitmapmat-net.h @@ -65,7 +65,7 @@ namespace openalprnet { channels = 4; break; default: - throw gcnew NotImplementedException(); + throw gcnew NotSupportedException(bitmap->PixelFormat.ToString()); } BitmapData^ bitmapData = bitmap->LockBits( diff --git a/src/bindings/csharp/openalpr-net/helper-net.h b/src/bindings/csharp/openalpr-net/helper-net.h index ce93a1b..806ace0 100644 --- a/src/bindings/csharp/openalpr-net/helper-net.h +++ b/src/bindings/csharp/openalpr-net/helper-net.h @@ -50,6 +50,11 @@ namespace openalprnet static Bitmap^ MatToBitmap(cv::Mat mat) { + if (mat.empty()) + { + return nullptr; + } + const int width = mat.size().width; const int height = mat.size().height; const int channels = mat.channels();