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

Method Draw

example/CarsCounting.h:271–289  ·  view source on GitHub ↗

\brief Draw \param frame

Source from the content-addressed store, hash-verified

269 /// \param frame
270 ///
271 void Draw(cv::Mat frame) const
272 {
273 auto Ptf2i = [&](cv::Point2f pt)
274 {
275 return cv::Point(cvRound(frame.cols * pt.x), cvRound(frame.rows * pt.y));
276 };
277
278 cv::line(frame, Ptf2i(m_pt1), Ptf2i(m_pt2), cv::Scalar(0, 255, 255), 1, cv::LINE_8, 0);
279
280 std::string label = "Line " + std::to_string(m_uid) + ": " + std::to_string(m_intersect1) + "/" + std::to_string(m_intersect2);
281 int baseLine = 0;
282 double fontScale = 0.7;
283 int thickness = 1;
284 cv::Size labelSize = cv::getTextSize(label, cv::FONT_HERSHEY_SIMPLEX, fontScale, 1, &baseLine);
285 cv::Point pt(Ptf2i(0.5f * (m_pt1 + m_pt2)));
286 pt.y += labelSize.height;
287 //pt.x += labelSize.width;
288 cv::putText(frame, label, pt, cv::FONT_HERSHEY_TRIPLEX, fontScale, cv::Scalar(0, 0, 0), thickness);
289 }
290
291 ///
292 /// \brief IsIntersect

Callers 1

DrawDataMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected