Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why I can't create a polylines

t2 is a vector(Point2f). When I create a circle that's success. but can't create a polylines

     for (int sn=0; sn<2; sn++){
            mat.copyTo(image);
            for(int ar=0; ar<jnt[0]

.size(); ar++){
            t1 = pointz.at(ar);
            t0 = jnt[ax].at(ar); //ref
            t1.x = c60 * (t0.x - t1.x) - s60 * (t0.y - t1.y) + t1.x;
            t1.y =  s60 * (t0.x - t1.x) + c60 * (t0.y - t1.y) + t1.y;
            t.push_back(t1);
        }
        t2=t;
        t.clear();
        etrans = evec.t();
        Qnew = Mat (t2).reshape(0,5);
        yminq = Qnew - q_bar;
        b_bar = etrans.mul(yminq);
        q_new = q_bar +( b_bar.mul(evec));
        qbaru = q_new.reshape(0,1);
        y_bar = qbaru;
        pointz = t2;
        q_bar = Mat(t2).reshape(0,5);
        waitKey(1000);

    }
    for(int ao=0; ao<t2.size(); ao++){
        Point pt = t2.at(ao);
        circle(image,pt,1,Scalar(0,0,255),2);
    }
    cvtColor(image, image, COLOR_BGR2GRAY);
    polylines(image,t2,false,Scalar(255,255,255),2,150,0);
    imshow("Fitting",image);

this is the error

OpenCV Error: Assertion failed (p.checkVector(2, CV_32S) >= 0) in cv::polylines, file ........\opencv\modules\core\src\drawing.cpp, line 2067

Why I can't create a polylines

t2 is a vector(Point2f). When I create a circle that's success. but can't create a polylines

     for (int sn=0; sn<2; sn++){
            mat.copyTo(image);
            for(int ar=0; ar<jnt[0]

.size(); ar++){
            t1 = pointz.at(ar);
            t0 = jnt[ax].at(ar); //ref
            t1.x = c60 * (t0.x - t1.x) - s60 * (t0.y - t1.y) + t1.x;
            t1.y =  s60 * (t0.x - t1.x) + c60 * (t0.y - t1.y) + t1.y;
            t.push_back(t1);
        }
        t2=t;
        t.clear();
        etrans = evec.t();
        Qnew = Mat (t2).reshape(0,5);
        yminq = Qnew - q_bar;
        b_bar = etrans.mul(yminq);
        q_new = q_bar +( b_bar.mul(evec));
        qbaru = q_new.reshape(0,1);
        y_bar = qbaru;
        pointz = t2;
        q_bar = Mat(t2).reshape(0,5);
        waitKey(1000);

    }
    for(int ao=0; ao<t2.size(); ao++){
        Point pt = t2.at(ao);
        circle(image,pt,1,Scalar(0,0,255),2);
    }
    cvtColor(image, image, COLOR_BGR2GRAY);
    polylines(image,t2,false,Scalar(255,255,255),2,150,0);
    imshow("Fitting",image);

this is the error

OpenCV Error: Assertion failed (p.checkVector(2, CV_32S) >= 0) in cv::polylines, file ........\opencv\modules\core\src\drawing.cpp, line 2067

thankyou :)