Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about Converting Bitmap to imageData #182

Open
futureflsl opened this issue Jul 26, 2021 · 2 comments
Open

Question about Converting Bitmap to imageData #182

futureflsl opened this issue Jul 26, 2021 · 2 comments

Comments

@futureflsl
Copy link

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);

@subsneer
Copy link

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().

@KoreanPro
Copy link

KoreanPro commented Aug 20, 2021

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants