CDC *pDC = GetDC();
char *pbuf;
pbuf=(char*)img.data; //MAT数据区
//图像倒了,需要倒过来
int iMapMode= (*pDC).SetMapMode(MM_ANISOTROPIC);
(*pDC).SetWindowExt(1,-1);//逻辑坐标反向,
(*pDC).SetViewportExt(1,1);//
(*pDC).SetWindowOrg(0,640); //逻辑原点
//说明480-1,必须减1,否则不能实现图像(不知为什么?)
DrawDibDraw( mhDrawDib, (*pDC).GetSafeHdc(),0, 0, 640,480-1, mpBitmapInfo, (LPVOID)(pbuf),0, 0, 640, 480,DDF_BUFFER );//DDF_FULLSCREEN) ;