Exemplo n.º 1
0
TouchEvent::TouchEvent(int id, Type eventType, BlobPtr pBlob, const IntPoint& pos, 
        Source source, const glm::vec2& speed)
    : CursorEvent(id, eventType, pos, source),
      m_pBlob(pBlob),
      m_bHasHandOrientation(false)
{
    setSpeed(speed);
    if (pBlob) {
        m_Orientation = pBlob->getOrientation();
        m_Area = pBlob->getArea();
        m_Center = pBlob->getCenter();
        m_Eccentricity = pBlob->getEccentricity();
        const glm::vec2& axis0 = m_pBlob->getScaledBasis(0);
        const glm::vec2& axis1 = m_pBlob->getScaledBasis(1);
        if (glm::length(axis0) > glm::length(axis1)) {
            m_MajorAxis = axis0;
            m_MinorAxis = axis1;
        } else {
            m_MajorAxis = axis1;
            m_MinorAxis = axis0;
        }
    } else {
        m_Orientation = 0;
        m_Area = 20;
        m_Center = glm::vec2(0, 0);
        m_Eccentricity = 0;
        m_MajorAxis = glm::vec2(5, 0);
        m_MinorAxis = glm::vec2(0, 5);
    }
}
Exemplo n.º 2
0
bool TrackerThread::isRelevant(BlobPtr pBlob, int minArea, int maxArea,
        float minEccentricity, float maxEccentricity)
{
    bool res;
    res = isInbetween(pBlob->getArea(), float(minArea), float(maxArea)) && 
            isInbetween(pBlob->getEccentricity(), minEccentricity, maxEccentricity);
    return res;
}