cv::Mat detect PixelFormat

偶尔善良 提交于 2019-12-05 14:27:34

cv::Mat.depth() returns the pixel type, eg. CV_8U for 8bit unsigned etc. and cv::Mat.channels() returns the number of channels, typically 3 for a colour image

For 'regular images' opencv generally uses 8bit BGR colour order which should map directly onto a Windows bitmap or most Windows libs.

SO you probably want system.drawing.imaging.pixelformat.Format24bppRgb, I don't know what order ( RGB or BGR) it uses but you can use the opencv cv::cvtColor() with CV_BGR2RGB to convert to RGB

Thanks for the help! The problem was something else. I just did not allocate memory for the Image Object. So there was nothing to really display. Using cv::Mat img; in the headerFile and img = new cv::Mat(120,160,0); in Constructor (ocvcamimg Class) got it to work. (ocvcamimg->captureCamMatImg() returns img).

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