Alturos.Yolo
Alturos.Yolo copied to clipboard
Question about Converting Bitmap to imageData
This program make it a lot easier for me to incorporate the yolov3 tiny into my c# project. Thanks a lot. My images from video is in Bitmap format. What is the best way to convert Bitmap image to imageData to be used in "yoloWrapper.Detect(imageData);". Do you have a function that use Bitmap or Image as input? I notice the function in yoloWrapper.cs: [DllImport(YoloLibraryGpu, EntryPoint = "detect_mat")] internal static extern int DetectImageGpu(IntPtr pArray, int nSize, ref BboxContainer container);
Hey, I'm a noob here but may be it could help you. It's possible to provide image data as byte array. I save image into memory stream and convert it into array with ToArray().
Make bitmap to image byte array using memorystream
Here is sample.
bitmap image; //here you should put your bitmap image
byte[] imgByteArray;
using (var stream = new MemoryStream())
{
image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
imgByteArray = stream.ToArray();
}
var items = yoloWrapper.Detect(imgByteArray);