Page 2 of 2

Re: C++ Single dot tracking Problem

Posted: Fri Jul 13, 2007 3:59 pm
by Birch
Yes, if you are only trying to track a marker then you will defintely not want to use the Vector tracking. The Vector tracking is meant to extract 6DOF with a three marker cluster (typically a Track Clip), and will not work when only one marker is detected.

Here is a section of the code from the VC8b sample which shows how to work INPObject.

Code: Select all

void CCameraDlg::UpdateDotInfo(INPCameraFrame * pFrame)
{
    LONG lCount = 0;

    pFrame->get_Count(&lCount);

    for (int i = 0; i < lCount; i++)
    {
        CComPtr<INPObject> spObject;

        pFrame->Item(i, &spObject);

        LONG lRank;

        spObject->get_Rank(&lRank);
        if (lRank == 1)
        {
            // this is the currently tracked object... 
            CComVariant varX, varY, varArea;

            // values are double's so we need to use a variant to query for them
            spObject->get_X(&varX);
            spObject->get_Y(&varY);
            spObject->get_Area(&varArea);

            // smooth the data
            m_spSmoothingDot->Update(varX, varY);

            // grab the smoothed data
            m_spSmoothingDot->get_X(&varX);
            m_spSmoothingDot->get_Y(&varY);

            // update the UI
            m_strDotPosition.Format(TEXT("%.3f, %.3f"), varX.dblVal, varY.dblVal);
            m_strDotArea.Format(TEXT("%.f"), varArea.dblVal);
        }
    }
}

Re: C++ Single dot tracking Problem

Posted: Sat Jul 21, 2007 4:45 pm
by demonwhisperer
Thanks alot. Got it working from this code. Cheers

~Paul