osg Image转opencv Mat

osg Image转opencv Mat

 

osg::ref_ptr<osg::Image> saveOsgImgObj = new osg::Image();
saveOsgImgObj = captureCallback2Obj->getOsgCameraImage();

cv::Mat opencv_img(saveOsgImgObj->t(), saveOsgImgObj->s(), CV_8UC3);
opencv_img.data = (uchar *)saveOsgImgObj->data();
cv::flip(opencv_img, opencv_img, 0);
cv::cvtColor(opencv_img, opencv_img, CV_RGB2BGR);

 

 

##############

posted @ 2021-10-03 18:53  西北逍遥  阅读(413)  评论(0编辑  收藏  举报