How to use cvCvtColor (opencv)?

Hello all,

I am a new user of "opencv" library, and I would be more than happy to receive help in the next issue.

I am interested to convert the format of an BGR image into RGB.
After digging in the net, I have found that it is done by "cvCvtColor" function, and I use it in the next way:

IplImage* gtkMask;
gtkMask = (IplImage*) malloc ( sizeof(*image) );
cvCvtColor ( image, gtkMask, CV_BGR2RGB );

While "image" is also of type IplImage*.
There are no compilations problems, but after running this code, I receive an exception from inside:

OpenCV Error: Bad argument (Unknown array type) in cvarrToMat, file /tmp/buildd/ros-diamondback-vision-opencv-1.4.3/debian/ros-diamondback-vision-opencv/opt/ros/diamondback/stacks/vision_opencv/opencv2/build/opencv-svn/modules/core/src/matrix.cpp, line 641
terminate called after throwing an instance of 'cv::Exception'
what(): /tmp/buildd/ros-diamondback-vision-opencv-1.4.3/debian/ros-diamondback-vision-opencv/opt/ros/diamondback/stacks/vision_opencv/opencv2/build/opencv-svn/modules/core/src/matrix.cpp:641: error: (-5) Unknown array type in function cvarrToMat

What I have done wrong? How to deal with the problem?

Thank you all in advance,
Regards.
Topic archived. No new replies allowed.