Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

C wrapper for setTo gets error: checkScalar(value, type(), _value.kind(), _InputArray::MAT ) in function setTo

I'm getting weird results with C binding for setTo

        extern "C" {

        Mat* cv_Mat_setTo(Mat* self, Scalar* value) {
            Mat* m = new Mat;
            *m = *value;
            return new Mat(self->setTo(*m));
        }
        }



        my .hpp:

        extern "C" {


        Mat* cv_Mat_setTo(Mat*self, Scalar* value);

        }

It compiles fine.

This is the code I'm referring to. I'm just tring to use the C version instead of the C++.

    cv::Mat plot(200, 200, CV_8UC3);
    plot.setTo(cv::Scalar(255.0,255.0,255.0));

and this is how I'm using it:

      cv::Mat plot(200, 200, CV_8UC3);
      Scalar s = cv::Scalar(255.0,255.0,255.0);
      cv_Mat_setTo(&plot,&s);

any ideas on why it's doing this?