Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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);