Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

From the openCV documentation,

First of all, you should use only cvInRangeS for using the Scalar limits. The reason you are getting the exception is that, the destination Matrix should be of single channel. You are creating it as a 3 channel.

Change the following line of code from this


IplImage* imageMask = cvCreateImage(cvGetSize(frame), IPL_DEPTH_8U, 3);


To


IplImage* imageMask = cvCreateImage(cvGetSize(frame), IPL_DEPTH_8U, 1);


And use cvInRangeS, it works. And move to C++ interface of openCV, developers here mostly not using c interface and you may not get the answers.