Rectangle 27 0

opencv How to display HSV image after using RGBtoHSV converter function in c++?

Mat hsv, bgr; // hsv is the hsv image you want to display
cvtColor(hsv, bgr, CV_HSV2BGR);
imshow("lolz", bgr);

It was before 3 channel and after the conversion it is also 3 channel but other values. imshow() still wants to display the image as RGB image but then with HSV values which leads to an invalid image.

imshow() thinks, the Matrix is in BGR order. Converting the image to HSV just converts the RGB values to HSV channel values.