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

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -