Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

imshow expects BGR images. If the result is messed up, I think the problem is with the VideoCapture. Maybe VideoCapture gives RGB? Anyway you can use cv::cvtColor to convert between BGR and RGB.

cv::cvtColor(rgbMat, bgrMat, cv::COLOR_RGB2BGR);
cv::cvtColor(bgrMat, rgbMat, cv::COLOR_BGR2RGB);

imshow expects BGR images. If the result is messed up, I think the problem is with the VideoCapture. Maybe VideoCapture gives RGB? Anyway you can use cv::cvtColor cv::cvtColor to convert between BGR and RGB.

cv::cvtColor(rgbMat, bgrMat, cv::COLOR_RGB2BGR);
cv::cvtColor(bgrMat, rgbMat, cv::COLOR_BGR2RGB);

Disclaimer: I only have experience with OpenCV on desktop.