Convert Bitmap to Mat

≡放荡痞女 提交于 2019-12-01 14:10:39

if you're constructing a cv::Mat from your Bitmap, you will have to use

cv::imshow("w", imageMap);

to draw it.

again, the address of a cv::Mat is not the same as an IplImage* required by cvShowImage();

(btw, you should get rid of all other deprecated c-api calls, too.)

also, be a bit careful, a Mat constructed the way you do, has a borrowed pointer to the pixels.

i don't know anything about gdi+, but if that pointer goes out of scope or gets invalid when you call enhanced->UnlockRect (or what it was called), you will need to do

Mat safeImg = imageMap.clone();

to achieve a 'deep' copy.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!