0
votes

I am using a C++ code with old version of opencv that uses this to convert BGR to HSV -

cvCvtColor(frame, imgHSV, CV_BGR2HSV);
cvReleaseImage(&imgHSV);

where frame and imgHSV are IplImage* objects

The newer versions of opencv don't have this method and I found cvtColor() in imgproc that does the same. But this method uses cv::InputArray and cv::OutputAray formats for parameters instead of IplImage* . How do I convert and convert back the IplImage* formats to these new formats? Any other way to convert from BGR to HSV for IplImage* that I don't know of?

1

1 Answers

2
votes

use cv::Mat instead of IplImage here, in general, prefer the c++ api to the deprecated c-api:

cv::Mat img = cv::imread("my.png");

cv::Mat hsv;
cv::cvtColor(frame, hsv, CV_BGR2HSV);
cv::imshow("hsv",hsv);
cv::waitKey();