Load Image
Elliot8212 opened this issue · 2 comments
Elliot8212 commented
Cannot use Image or Bitmap, it necessary need to be a path.
bobezlolz commented
you can convert the bitmap/image to a byte array and pass it to the predictor
static byte[] ToByteArray(System.Drawing.Image imageIn, System.Drawing.Imaging.ImageFormat fmt)
{
if (imageIn != null)
{
using (MemoryStream ms = new MemoryStream())
{
imageIn.Save(ms, fmt);
return ms.ToArray();
}
}
return new byte[] { };
}
var result = await predictor.DetectAsync(ToByteArray(image, System.Drawing.Imaging.ImageFormat.Png));
dme-compunet commented
Bitmap
is only in Windows, you can use the code in the comment above.