tags:

views:

226

answers:

1

in my project I want to use EmguCV lib, but the function of EmguCV can not process the Bitmap object, so i have to convert Bitmap to some other type, Intptr is a choice but I really don't know how to code, the fellow code is abstract from my project like this:

Bitmap bmp = new Bitmap(e.width, e.height,
    System.Drawing.Imaging.PixelFormat.Format24bppRgb);
System.Drawing.Imaging.BitmapData data = 
    bmp.LockBits(new Rectangle(0, 0, e.width, e.height), 
        System.Drawing.Imaging.ImageLockMode.ReadWrite, 
        System.Drawing.Imaging.PixelFormat.Format24bppRgb);
int dataLength = e.width * e.height * 3;
Win32.memcpy(data.Scan0, (IntPtr)e.data, (uint)dataLength);
convertBitmapToIntptr(bmp);

How can I code in this function convertBitmapToIntptr(bmp)?

A: 

you want to wrap this in a class....

I've done this and called it "FastBitmap" and you can lock it in the constructor, get the ptr, and add methods to work with the ptr

Keith Nicholas