Severity |
Code |
Description |
Project |
File |
Line |
Suppression State |
Error |
CS1503 |
Argument 1: cannot convert from ‘System.Drawing.Bitmap’ to ‘byte[,,*]’ |
ClientSideFaceRecognition |
C:\Users\user\Desktop\VS Studio projects\ClientSideFaceRecognition\Form1.cs |
171 |
Active |
private Image<Bgr, byte> ByteArrayToImage(byte[] byteArray)
{
using (MemoryStream ms = new MemoryStream(byteArray))
{
Bitmap bitmap = (Bitmap)Image.FromStream(ms);
Image<Bgr, byte> image = new Image<Bgr, byte>(bitmap);
return image;
}
}
that error is purely C#, with no immediate relation to OpenCV or any of its third party wrappers for C#
2 Likes
I might be the only C# Open CV developer around here but the error seems to be that the constructors for the type Image<Bgr, byte> do not have an argument for a Bitmap. Try a string or youcan make the method return a Mat object
using Emgu.CV;
using Emgu.CV.CvEnum;
private Mat ArrayToMat(byte[] byteArray)
{
Mat mat = new Mat(1, byteArray.Length, DepthType.Cv8U, 1);
mat.SetTo<byte>(byteArray);
return mat;
}
2 Likes
Thanks I will try this out.
1 Like