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

Method DrawData

example/CarsCounting.cpp:231–295  ·  view source on GitHub ↗

\brief CarsCounting::DrawData \param frame

Source from the content-addressed store, hash-verified

229/// \param frame
230///
231void CarsCounting::DrawData(cv::Mat frame, const std::vector<TrackingObject>& tracks, int framesCounter, int currTime)
232{
233 m_logger->info("Frame ({1}): tracks = {2}, time = {3}", framesCounter, tracks.size(), currTime);
234
235#if 1 // Debug output
236 if (!m_geoParams.Empty())
237 {
238 std::vector<cv::Point> points = m_geoParams.GetFramePoints();
239 for (size_t i = 0; i < points.size(); ++i)
240 {
241 cv::line(frame, points[i % points.size()], points[(i + 1) % points.size()], cv::Scalar(255, 255, 255), 1, cv::LINE_AA);
242 }
243 }
244#endif
245
246 for (const auto& track : tracks)
247 {
248 if (track.m_isStatic)
249 {
250 DrawTrack(frame, track, true, framesCounter);
251 }
252 else
253 {
254 if (track.IsRobust(cvRound(m_fps / 4), // Minimal trajectory size
255 0.8f, // Minimal ratio raw_trajectory_points / trajectory_lenght
256 cv::Size2f(0.1f, 8.0f)) // Min and max ratio: width / height
257 )
258 {
259 DrawTrack(frame, track, true, framesCounter);
260
261 CheckLinesIntersection(track, static_cast<float>(frame.cols), static_cast<float>(frame.rows));
262 }
263 }
264 }
265 //m_detector->CalcMotionMap(frame);
266
267 if (!m_geoParams.Empty())
268 {
269 cv::Mat geoMap = m_geoParams.DrawTracksOnMap(tracks);
270 if (!geoMap.empty())
271 {
272#ifndef SILENT_WORK
273 cv::namedWindow("Geo map", cv::WINDOW_NORMAL);
274 cv::imshow("Geo map", geoMap);
275#endif
276 if (true)
277 {
278 double k = 0.25;
279 cv::Size mapPreview(cvRound(frame.cols * k), cvRound(((frame.cols * k) / geoMap.cols) * geoMap.rows));
280 cv::resize(geoMap, frame(cv::Rect(frame.cols - mapPreview.width - 1, frame.rows - mapPreview.height - 1, mapPreview.width, mapPreview.height)), mapPreview, 0, 0, cv::INTER_CUBIC);
281 }
282 }
283 }
284
285 for (const auto& rl : m_lines)
286 {
287 rl.Draw(frame);
288 }

Callers

nothing calls this directly

Calls 7

EmptyMethod · 0.80
GetFramePointsMethod · 0.80
IsRobustMethod · 0.80
DrawTracksOnMapMethod · 0.80
DrawMethod · 0.80
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected