mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 23:22:51 +08:00
Add overloads for MemoryStream and byte array to motion detector.
This commit is contained in:
@@ -100,6 +100,21 @@ namespace openalprnet {
|
|||||||
return dstMat;
|
return dstMat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cv::Mat MemoryStreamBitmapToMat(MemoryStream^ memoryStream)
|
||||||
|
{
|
||||||
|
Bitmap^ bitmap = gcnew Bitmap(memoryStream);
|
||||||
|
cv::Mat mat = BitmapToMat(bitmap);
|
||||||
|
return mat;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cv::Mat ByteArrayToMat(array<Byte>^ byteArray)
|
||||||
|
{
|
||||||
|
MemoryStream^ ms = gcnew MemoryStream(byteArray);
|
||||||
|
cv::Mat mat(MemoryStreamBitmapToMat(ms));
|
||||||
|
delete ms;
|
||||||
|
return mat;
|
||||||
|
}
|
||||||
|
|
||||||
static Bitmap^ MatToBitmap(cv::Mat mat)
|
static Bitmap^ MatToBitmap(cv::Mat mat)
|
||||||
{
|
{
|
||||||
const int width = mat.size().width;
|
const int width = mat.size().width;
|
||||||
@@ -223,6 +238,16 @@ namespace openalprnet {
|
|||||||
return ResetMotionDetection(Mat(filename, matType));
|
return ResetMotionDetection(Mat(filename, matType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResetMotionDetection(MemoryStream^ memoryStream)
|
||||||
|
{
|
||||||
|
return ResetMotionDetection(Mat(memoryStream));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResetMotionDetection(array<Byte>^ byteArray)
|
||||||
|
{
|
||||||
|
return ResetMotionDetection(Mat(byteArray));
|
||||||
|
}
|
||||||
|
|
||||||
System::Drawing::Rectangle MotionDetect(Bitmap^ bitmap)
|
System::Drawing::Rectangle MotionDetect(Bitmap^ bitmap)
|
||||||
{
|
{
|
||||||
return MotionDetect(Mat(bitmap));
|
return MotionDetect(Mat(bitmap));
|
||||||
@@ -233,6 +258,16 @@ namespace openalprnet {
|
|||||||
return MotionDetect(Mat(filename, matType));
|
return MotionDetect(Mat(filename, matType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System::Drawing::Rectangle MotionDetect(MemoryStream^ memoryStream)
|
||||||
|
{
|
||||||
|
return MotionDetect(Mat(memoryStream));
|
||||||
|
}
|
||||||
|
|
||||||
|
System::Drawing::Rectangle MotionDetect(array<Byte>^ byteArray)
|
||||||
|
{
|
||||||
|
return MotionDetect(Mat(byteArray));
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ResetMotionDetection(cv::Mat mat)
|
void ResetMotionDetection(cv::Mat mat)
|
||||||
{
|
{
|
||||||
@@ -257,6 +292,18 @@ namespace openalprnet {
|
|||||||
return mat;
|
return mat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cv::Mat Mat(MemoryStream^ memoryStream)
|
||||||
|
{
|
||||||
|
cv::Mat mat = AlprHelper::MemoryStreamBitmapToMat(memoryStream);
|
||||||
|
return mat;
|
||||||
|
}
|
||||||
|
|
||||||
|
cv::Mat Mat(array<Byte>^ byteArray)
|
||||||
|
{
|
||||||
|
cv::Mat mat = AlprHelper::ByteArrayToMat(byteArray);
|
||||||
|
return mat;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
~AlprMotionDetectionNet()
|
~AlprMotionDetectionNet()
|
||||||
|
Reference in New Issue
Block a user