Home > Software engineering >  MFC Mat HBitmap, couldn't show the pictures, is always a piece of black
MFC Mat HBitmap, couldn't show the pictures, is always a piece of black

Time:09-16

Use OPENCV to deal with a picture, can you tell me how to deal with good images are converted to bitmap or hbitmap
The following code MAT to HBITMAP but pictures can't show don't know what reason be
BOOL CFaceDemoDlg: : MatToHBitmap (Mat& _mat HBITMAP& _hBmp)
{
//MAT TYPE=(nChannels - 1 + CV_8U) & lt; <3
Int nChannels=(_mat type () & gt;> 3) - CV_8U + 1;
Int iSize=_mat. * _mat cols. Rows * nChannels;
_hBmp=CreateBitmap (_mat. Cols, _mat. Rows, 1, nChannels * 8, _mat. Data);
if (! _hBmp)
{
return FALSE;
}
Return TRUE;
}

CodePudding user response:

Advice is saved as a picture in the OPENCV, open in the MFC

CodePudding user response:

Using CreateDIBitmap, lpbmi Settings must be in agreement and the format of the Mat

CodePudding user response:

I am on the net to collect the Mat HBITMAP code, then show a blank as you

CodePudding user response:

https://blog.csdn.net/youyingbo/article/details/80688202
  • Related