Esempio n. 1
0
void Particle::update(double deltaX, double deltaY, double deltaYaw,
		LaserProxy &laser) {
	_position.x += deltaX * 100;
	_position.y += deltaY * 100;
	_yaw += deltaYaw;

	_predBel = _bel * calcProbability(deltaX, deltaY, deltaYaw);
	_bel = _predBel * NORMALIZE_FACTOR * scanProbability(laser);
	_bel = _bel > 1.0 ? 1.0 : _bel;
}
    int track(Mat &image,Rect &rect)
    {
        int status=0;
        cvtColor(image, hsv, CV_BGR2HSV_FULL);
        selection=rect;
        if(rect.width!=0&&rect.height!=0)
        {
            if(trackObject==false)
                buildHistogram ();
            if(trackObject==true)
            {
                Rect trackWindow=selection;
                Mat backproj=calcProbability ();
                RotatedRect trackBox = CamShift(backproj,trackWindow,TermCriteria( CV_TERMCRIT_EPS | CV_TERMCRIT_ITER, 10, 1 ));
                if( trackWindow.area() <= 1 )
                {
                    int cols = backproj.cols, rows = backproj.rows, r = (MIN(cols, rows) + 5)/6;
                    trackWindow = Rect(0,0,0,0);
                    trackObject=false;
                }
                else
                {
                    Point2f rect_points[4]; trackBox.points( rect_points );
                          for( int j = 0; j < 4; j++ )
                              line( image, rect_points[j], rect_points[(j+1)%4], Scalar(0,0,255), 1, 8 );

                }

            }
        }
        else
        {
            trackObject=false;
        }

        status=1;
        return status;
    }
Esempio n. 3
0
void CRtfWord::calcCoordinatesAndProbability() {
    calcProbability();
    calcSpelling();
    calcBRect();
}