error when trying to convert rgb to hsv...
I am the moment trying to convert a rgb to hsv, which seems impossible.. I thought i might have been due the Mat being empty.. but thats not the case...
I get this error message.
/build/buildd/opencv-2.4.8+dfsg1/modules/imgproc/src/color.cpp:3642: error: (-215) depth == CV_8U || depth == CV_16U || depth == CV_32F in function cvtColor
for these lines of code..
Point find(Mat frame)
{
Mat imgOriginal = frame.clone();
Mat imgHSV = frame.clone();
if (frame.empty())
{
cout << "Empty...';
exit -1;
}
cvtColor(imgOriginal, imgHSV, COLOR_BGR2HSV); //Convert the captured frame from BGR to HSV
what could be going wrong here???
Check the type of frame (
frame.type()
), it seems to be unsupported for the function. Also, cloningframe
toimgHSV
is a waste of time. Apart from that, and maybe unrelated, what version of OpenCV are you using? Because COLOR_BGR2HSV is for 3.0.0, but your error says you're using an installation folder called 2.4.8, and that's weird...oh... yeah.. it looks like i have multiple versions.. but yeah, i need to use the one for 2.4.8...
What types does is support?
The ones indicated in the error message. And I correct myself, I've just discovered that the flag COLOR_BGR2HSV is valid for 2.4 tree too (I though it should be CV_BGR2HSV).
but again.. what type am i looking for.. couldn't i just convert it to certain type or something like that?
I told you, the needed type is one of the mentioned in the error message: CV_8U or CV_16U or CV_32F. Start by checking which type is your image, to then choose the better convertion.