qt - How can I convert a QImage of format RGB32 to OpenCV::mat? -


i have qimage of format rgb32 when this:

cv::mat depthmat(depthimg.height(),depthimg.width(),cv_8uc3,(uchar*)depthimg.bits(),depthimg.bytesperline()); 

i image of left. supposed image on right. enter image description here

okay! figured out! rgb32 has 8 bits of r, 8 bits of g, 8 bits of b , 8 bits of alpha. it's rgba. so, can use this:

cv::mat depthmat(depthimg.height(),depthimg.width(),cv_8uc4,(uchar*)depthimg.bits(),depthimg.bytesperline()); 

enter image description here


Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -