怎么将内存中的图像数据读出来?求高手!!!
C#中,调用的C++ DLL,在DLL中有API函数:
LONG APIENTRY devwdm_GetImageBuffer(BYTE *pImageMem);
函数功能: 采集一帧RGB24图像到内存
pImageMem: 图像缓冲区指针
C#调用:
[DllImport("devwdm.dll")]
//函数功能:采集一帧RGB24图像到内存 pImageMem:图像缓冲区指针
public static extern int devwdm_GetImageBuffer(IntPtr pImageMem);
//要读取的内存长度
int len=100;
byte[] imgByte=new byte[len];
IntPtr hglobal = Marshal.AllocHGlobal(len);
devwdm_GetImageBuffer(hglobal);
pictureBox1.Image = Image.FromStream(new MemoneryStream(imgByte));//imgByte为内存数据
Marshal.FreeHGlobal(hglobal);