diff --git a/example/CarsCounting.cpp b/example/CarsCounting.cpp index 72dec265..f9b1b0f6 100644 --- a/example/CarsCounting.cpp +++ b/example/CarsCounting.cpp @@ -73,7 +73,7 @@ void CarsCounting::DrawTrack(cv::Mat frame, const TrackingObject& track, bool dr label << TypeConverter::Type2Str(track.m_type) << " " << cvRound(velocity) << " km/h"; int baseLine = 0; - double fontScale = 0.5; + double fontScale = (frame.cols < 2000) ? 0.5 : 1.; cv::Size labelSize = cv::getTextSize(label.str(), cv::FONT_HERSHEY_TRIPLEX, fontScale, 1, &baseLine); if (brect.x < 0) @@ -232,7 +232,7 @@ void CarsCounting::DrawData(cv::Mat frame, const std::vector& tr if (m_showLogs) std::cout << "Frame " << framesCounter << ": tracks = " << tracks.size() << ", time = " << currTime << std::endl; -#if 0 // Debug output +#if 1 // Debug output if (!m_geoParams.Empty()) { std::vector points = m_geoParams.GetFramePoints(); @@ -273,6 +273,12 @@ void CarsCounting::DrawData(cv::Mat frame, const std::vector& tr cv::namedWindow("Geo map", cv::WINDOW_NORMAL); cv::imshow("Geo map", geoMap); #endif + if (true) + { + double k = 0.25; + cv::Size mapPreview(cvRound(frame.cols * k), cvRound(((frame.cols * k) / geoMap.cols) * geoMap.rows)); + 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); + } } } diff --git a/example/CarsCounting.h b/example/CarsCounting.h index 777183c1..a9629699 100644 --- a/example/CarsCounting.h +++ b/example/CarsCounting.h @@ -167,16 +167,16 @@ class GeoParams cv::Point_ gp2(m_geoPoints[(i + 1) % m_geoPoints.size()]); cv::Point p2(m_p2mParams.Geo2Pix(gp2)); - cv::line(map, p1, p2, cv::Scalar(255, 255, 255), 1, cv::LINE_AA); + cv::line(map, p1, p2, cv::Scalar(255, 255, 255), 2, cv::LINE_AA); //std::cout << p1 << " - " << p2 << std::endl; std::stringstream label; label << std::fixed << std::setw(5) << std::setprecision(5) << "[" << m_geoPoints[i].x << ", " << m_geoPoints[i].y << "]"; int baseLine = 0; - double fontScale = 0.5; - cv::Size labelSize = cv::getTextSize(label.str(), cv::FONT_HERSHEY_SIMPLEX, fontScale, 1, &baseLine); - cv::putText(map, label.str(), p1, cv::FONT_HERSHEY_SIMPLEX, fontScale, cv::Scalar(255, 255, 255)); + double fontScale = (map.cols < 1000 && map.rows < 1000) ? 0.5 : 1.; + cv::Size labelSize = cv::getTextSize(label.str(), cv::FONT_HERSHEY_TRIPLEX, fontScale, 1, &baseLine); + cv::putText(map, label.str(), p1, cv::FONT_HERSHEY_TRIPLEX, fontScale, cv::Scalar(255, 255, 255)); } #endif @@ -189,7 +189,7 @@ class GeoParams auto center = m_p2mParams.Geo2Pix(geoCenter); //std::cout << "Convert: " << track.m_rrect.center << " -> " << geoCenter << " -> " << center << std::endl; if (center.x > 0 && center.x < map.cols && center.y > 0 && center.y < map.rows) - cv::ellipse(map, center, cv::Size(3, 3), 0, 0, 360, cv::Scalar(255, 0, 255), cv::FILLED, 8); + cv::ellipse(map, center, cv::Size(5, 5), 0, 0, 360, cv::Scalar(255, 0, 255), cv::FILLED, 8); } } diff --git a/example/VideoExample.h b/example/VideoExample.h index 03a51af4..6e4d1fde 100644 --- a/example/VideoExample.h +++ b/example/VideoExample.h @@ -229,7 +229,7 @@ class VideoExample bool m_isDetectorInitialized = false; std::string m_inFile; std::string m_outFile; - int m_fourcc = cv::VideoWriter::fourcc('M', 'J', 'P', 'G'); + int m_fourcc = cv::VideoWriter::fourcc('h', '2', '6', '5'); //cv::VideoWriter::fourcc('M', 'J', 'P', 'G'); int m_startFrame = 0; int m_endFrame = 0; int m_finishDelay = 0;