Reputation: 649
I have a QImage of format RGB32 When I do this:
cv::Mat depthMat(depthImg.height(),depthImg.width(),CV_8UC3,(uchar*)depthImg.bits(),depthImg.bytesPerLine());
I get the image of the left. I am actually supposed to get the image on the right.
Upvotes: 1
Views: 3556
Reputation: 649
Okay! I figured it out! RGB32 has 8 bits of R, 8 bits of G, 8 bits of B and 8 bits of Alpha. It's essentially RGBA. So, we can use this:
cv::Mat depthMat(depthImg.height(),depthImg.width(),CV_8UC4,(uchar*)depthImg.bits(),depthImg.bytesPerLine());
Upvotes: 5