コード例 #1
0
ファイル: Frame.cpp プロジェクト: yogevyuval/paintcode_v2
// For some reason draws points instead of lines
void Frame::drawMotion(MotionHandler * mh)
{
    if (mh == NULL)
        return;
    if (mh->getState() == MotionHandler::RECORDING)
    {
        Motion motion = mh->getMotion();
        if(motion.length() < 2)
            return;
        // Here's the problem - cur and last are the same
        Candidate *last = motion.getCandidate(0),
            *cur = motion.getCandidate(1);
        float lastX = last->getX(),
            lastY = last->getY(),
            x = cur->getX(),
            y = cur->getY();
        cout << "last: " << lastX << ", " << lastY << endl;
        cout << "cur: " << x << ", " << y << endl;
        cvLine(motionTrack, cvPoint(x, y), cvPoint(lastX, lastY), cvScalar(0,0,255), 6);
        cvAdd(curFrame, motionTrack, curFrame);
    }
}