1 | initial version |
After a day or two struggling to get an OpenCV Mat to Windows Bitmap I came across a simple solution after trying so many different things found on the Net. Try this:
Mat matImage = imread("image.bmp", CV_LOAD_IMAGE_COLOR); cvtColor(matImage, matImage, CV_BGRA2RGBA);
mhBitmap = CreateBitmap(matImage.cols, matImage.rows, 1, 32, matImage.data);
And then you have a Bitmap to use in the Picture Control/Box. This is for MFC but I think it should be similar for C++/CLI. It was an ah-ha moment.
2 | No.2 Revision |
After a day or two struggling to get an OpenCV Mat to Windows Bitmap I came across a simple solution after trying so many different things found on the Net. Try this:
Mat matImage = imread("image.bmp", CV_LOAD_IMAGE_COLOR); cvtColor(matImage, matImage, CV_BGRA2RGBA);
mhBitmap = CreateBitmap(matImage.cols, matImage.rows, 1, 32, matImage.data);
And then you have a Bitmap to use in the Picture Control/Box. This is for MFC but I think it should be similar for C++/CLI. It was an ah-ha moment.
3 | No.3 Revision |
After a day or two struggling to get an OpenCV Mat to Windows Bitmap I came across a simple solution after trying so many different things found on the Net. Try this:
Mat matImage = imread("image.bmp", CV_LOAD_IMAGE_COLOR); cvtColor(matImage, matImage, CV_BGRA2RGBA);
mhBitmap hBitmap = CreateBitmap(matImage.cols, matImage.rows, 1, 32, matImage.data);
And then you have a Bitmap to use in the Picture Control/Box. This is for MFC but I think it should be similar for C++/CLI. It was an ah-ha moment.
4 | No.4 Revision |
After a day or two struggling to get an OpenCV Mat to Windows Bitmap I came across a simple solution after trying so many different things found on the Net. Try this:
Mat matImage = imread("image.bmp", CV_LOAD_IMAGE_COLOR);
cvtColor(matImage, matImage, And then you have a Bitmap to use in the Picture Control/Box. This is for MFC but I think it should be similar for C++/CLI. It was an ah-ha moment.