Invalid arguments Candidates are: void minEnclosingCircle(const cv::_InputArray &, cv::Point_<float> &, float &)

asked 2015-05-15 08:03:47 -0600

Jasdeep gravatar image

updated 2015-05-15 08:05:11 -0600

berak gravatar image

hi ,

i am using this method to detect circles using contours in android jni ,

 std::vector<cv::Point2f> center(contours.size() );
 std::vector<cv::vector<cv::Point> > contours_poly( contours.size() );
 std::vector<float>radius( contours.size() ); 
 for(int i=0;i<contours.size;i++){
      minEnclosingCircle(Mat(contours_poly[i]),cv::Point_<float>(center[i]),radius[i]); 
 }

but getting this error : Invalid arguments ' Candidates are: void minEnclosingCircle(const cv::_InputArray &, cv::Point_<float> &, float &)'

thanks

edit retag flag offensive close merge delete

Comments

it wants a reference to the center point, you're giving it a temporary copy. also please change all your cv::vector to std::vector. last: it's contours.size(), not contours.size, so:

for (size_t i=0;i<contours.size();i++){
      minEnclosingCircle(contours_poly[i],center[i],radius[i]); 
}
berak gravatar imageberak ( 2015-05-15 08:17:19 -0600 )edit

nope , its not working...

std::vector<point_<float>&> center(contours.size() ); for( int i = 0; i < contours.size(); i++ ) {

              **minEnclosingCircle(Mat(contours_poly[i]),center[i],radius[i]);**

         }

same error :Invalid arguments Candidates are: void minEnclosingCircle(const cv::_InputArray &, cv::Point_<float> &, float &)

Jasdeep gravatar imageJasdeep ( 2015-05-16 00:51:08 -0600 )edit

std::vector<point_<float>&> center(contours.size() ); is wrong . - remove the &

berak gravatar imageberak ( 2015-05-16 01:17:59 -0600 )edit

removed , but getting same error..i have tried:

  1. std::vector<point_<float> > center(contours.size() );
  2. std::vector<point2f> center(contours.size() );

for

minEnclosingCircle(Mat(contours_poly[i]),center[i],radius[i]); same invalid arguments error

Jasdeep gravatar imageJasdeep ( 2015-05-16 02:04:30 -0600 )edit

could you update your question with the current code now ? there's obviously still something wrong, but hard to see without proper context

berak gravatar imageberak ( 2015-05-16 02:31:08 -0600 )edit

basically converting :http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.html to android using jni ,c++,opencv

JNIEXPORT jint JNICALL Java_com_demo_app_Opencvpart_convertNativeGray(JNIEnv*, jobject, jlong addrRgba, jlong addrGray) {
    std::vector<std::vector<cv::Point> > contours;
    std::vector<Point2f> center(contours.size() );
    std::vector<float> radius(contours.size() );
    for( int i = 0; i < contours.size(); i++ ) {
        cv::approxPolyDP(Mat(contours[i]),Mat(contours_poly[i]), 3, true );
        boundRect[i] = boundingRect( Mat(contours_poly[i]) );
        minEnclosingCircle(Mat(contours_poly[i]),center[i],radius[i]);
    }
Jasdeep gravatar imageJasdeep ( 2015-05-16 03:03:13 -0600 )edit