Ask Your Question

breich90's profile - activity

2015-10-05 17:09:16 -0600 received badge  Famous Question (source)
2014-07-22 01:47:56 -0600 received badge  Notable Question (source)
2014-03-27 10:41:21 -0600 received badge  Taxonomist
2014-01-30 00:30:15 -0600 received badge  Popular Question (source)
2013-03-04 22:23:32 -0600 received badge  Student (source)
2013-03-04 10:48:00 -0600 asked a question cvCvtColor - cannot convert 'cv::Mat' to 'const CvArr*'

Hi,

I am encountering problems when I try to use cvCvtColor. I am using OpenCV functions in ROS after using the ROS opencv_bridge package to translate from ROS published images to an OpenCV Mat. I get the following compilation error:

'cannot convert 'cv::Mat' to 'const CvArr* {aka const void}' for argument '1' to 'void cvCvtColor(const CvArr, CvArr*, int)'

I need to use cvCvtColor to translate to HSV colorspace in order to threshold white from the converted image. My understanding of CvArr* is that it is a catch-all for multiple types of inputs, including a cv::Mat.

// cv_ptr is the image converted from ROS; ->image points to the associated cv::Mat

cv::Mat* rosImg = &cv_ptr->image;

cv::Mat A = *rosImg;

// Create an empty CVImage that we can designate as the HSV copy.

IplImage* imgHSV = cvCreateImage(cvSize(1024,768), 8, 3);

// Convert the color of the ROS image from RGB into HSV.

cvCvtColor(A, imgHSV, CV_BGR2HSV);