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

Method DrawTrack

async_detector/AsyncDetector.cpp:141–185  ·  view source on GitHub ↗

\brief AsyncDetector::DrawTrack \param frame \param track \param drawTrajectory \param isStatic

Source from the content-addressed store, hash-verified

139/// \param isStatic
140///
141void AsyncDetector::DrawTrack(cv::Mat frame,
142 const TrackingObject& track,
143 bool drawTrajectory)
144{
145 if (track.m_isStatic)
146 {
147#if (CV_VERSION_MAJOR >= 4)
148 cv::rectangle(frame, track.m_rrect.boundingRect(), cv::Scalar(255, 0, 255), 2, cv::LINE_AA);
149#else
150 cv::rectangle(frame, track.m_rrect.boundingRect(), cv::Scalar(255, 0, 255), 2, CV_AA);
151#endif
152 }
153 else
154 {
155#if (CV_VERSION_MAJOR >= 4)
156 cv::rectangle(frame, track.m_rrect.boundingRect(), cv::Scalar(0, 255, 0), 1, cv::LINE_AA);
157#else
158 cv::rectangle(frame, track.m_rrect.boundingRect(), cv::Scalar(0, 255, 0), 1, CV_AA);
159#endif
160 }
161
162 if (drawTrajectory)
163 {
164 cv::Scalar cl = m_colors[track.m_ID.ID2Module(m_colors.size())];
165
166 for (size_t j = 0; j < track.m_trace.size() - 1; ++j)
167 {
168 const TrajectoryPoint& pt1 = track.m_trace.at(j);
169 const TrajectoryPoint& pt2 = track.m_trace.at(j + 1);
170#if (CV_VERSION_MAJOR >= 4)
171 cv::line(frame, pt1.m_prediction, pt2.m_prediction, cl, 1, cv::LINE_AA);
172#else
173 cv::line(frame, pt1.m_prediction, pt2.m_prediction, cl, 1, CV_AA);
174#endif
175 if (pt2.m_hasRaw)
176 {
177#if (CV_VERSION_MAJOR >= 4)
178 cv::circle(frame, pt2.m_prediction, 4, cl, 4, cv::LINE_AA);
179#else
180 cv::circle(frame, pt2.m_prediction, 4, cl, 4, CV_AA);
181#endif
182 }
183 }
184 }
185}
186
187///
188/// \brief AsyncDetector::DrawData

Callers

nothing calls this directly

Calls 2

ID2ModuleMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected