Merge pull request #170 from peters/master

.NET binding tweaks
This commit is contained in:
Matthew Hill
2015-08-05 09:13:36 -04:00
2 changed files with 6 additions and 1 deletions

View File

@@ -65,7 +65,7 @@ namespace openalprnet {
channels = 4; channels = 4;
break; break;
default: default:
throw gcnew NotImplementedException(); throw gcnew NotSupportedException(bitmap->PixelFormat.ToString());
} }
BitmapData^ bitmapData = bitmap->LockBits( BitmapData^ bitmapData = bitmap->LockBits(

View File

@@ -50,6 +50,11 @@ namespace openalprnet
static Bitmap^ MatToBitmap(cv::Mat mat) static Bitmap^ MatToBitmap(cv::Mat mat)
{ {
if (mat.empty())
{
return nullptr;
}
const int width = mat.size().width; const int width = mat.size().width;
const int height = mat.size().height; const int height = mat.size().height;
const int channels = mat.channels(); const int channels = mat.channels();