cv::minAreaRect initialization error

asked 2013-12-18 23:55:34 -0500

std::vector<cv::point> points;

      cv::Mat_<uchar>::iterator it = ThreshIm.begin<uchar>();
      cv::Mat_<uchar>::iterator end = ThreshIm.end<uchar>();
      for (; it != end; ++it)
        if (*it)
          points.push_back(it.pos());

        cv::RotatedRect box;

           box = cv::minAreaRect(Mat(points));

The program builds successfully but then upon running(on qt-creator IDE)the following error is shown:

what(): /build/buildd/opencv-2.3.1/modules/imgproc/src/utils.cpp:53: error: (-5) Input array is not a valid matrix in function cvPointSeqFromMat

The program has unexpectedly finished.

What might be going wrong?

edit retag flag offensive close merge delete