MCPcopy Create free account
hub / github.com/Smorodov/Multitarget-tracker / CalcPredictionEllipse

Method CalcPredictionEllipse

src/Tracker/track.cpp:425–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423
424///
425cv::RotatedRect CTrack::CalcPredictionEllipse(cv::Size_<track_t> minRadius) const
426{
427 // Move ellipse to velocity
428 auto velocity = m_kalman.GetVelocity();
429 Point_t d(3.f * velocity[0], 3.f * velocity[1]);
430
431 cv::RotatedRect rrect(m_predictionPoint, cv::Size2f(std::max(minRadius.width, fabs(d.x)), std::max(minRadius.height, fabs(d.y))), 0);
432
433 if (fabs(d.x) + fabs(d.y) > 4) // pix
434 {
435 if (fabs(d.x) > 0.0001f)
436 {
437 track_t l = std::min(rrect.size.width, rrect.size.height) / 3;
438
439 track_t p2_l = sqrtf(sqr(d.x) + sqr(d.y));
440 rrect.center.x = l * d.x / p2_l + m_predictionPoint.x;
441 rrect.center.y = l * d.y / p2_l + m_predictionPoint.y;
442
443 rrect.angle = atanf(d.y / d.x);
444 }
445 else
446 {
447 rrect.center.y += d.y / 3;
448 rrect.angle = static_cast<float>(CV_PI / 2.);
449 }
450 }
451 return rrect;
452}
453
454///
455/// \brief CTrack::IsInsideArea

Callers 1

GetEllipseDistMethod · 0.80

Calls 3

fabsFunction · 0.85
sqrFunction · 0.85
GetVelocityMethod · 0.80

Tested by

no test coverage detected