@@ -106,23 +106,17 @@ void AsyncDetector::Process()
106106 DrawData (processedFrame, framesCounter, currTime);
107107
108108 if (!m_outFile.empty () && !writer.isOpened ())
109- {
110109 writer.open (m_outFile, cv::VideoWriter::fourcc (' H' , ' F' , ' Y' , ' U' ), m_fps, processedFrame->m_frame .size (), true );
111- }
112110 if (writer.isOpened ())
113- {
114111 writer << processedFrame->m_frame ;
115- }
116112
117113#ifndef SILENT_WORK
118114 cv::imshow (" Video" , processedFrame->m_frame );
119115
120116 int waitTime = 1 ;// std::max<int>(1, cvRound(1000 / m_fps - currTime));
121117 int k = cv::waitKey (waitTime);
122118 if (k == 27 )
123- {
124119 break ;
125- }
126120#else
127121 std::this_thread::sleep_for (std::chrono::milliseconds (1 ));
128122#endif
@@ -140,9 +134,7 @@ void AsyncDetector::Process()
140134 m_framesQue.SetBreak (true );
141135
142136 if (thCapture.joinable ())
143- {
144137 thCapture.join ();
145- }
146138
147139 std::cout << " work time = " << (allTime / freq) << std::endl;
148140#ifndef SILENT_WORK
@@ -161,8 +153,7 @@ void AsyncDetector::Process()
161153void AsyncDetector::DrawTrack (cv::Mat frame,
162154 int resizeCoeff,
163155 const TrackingObject& track,
164- bool drawTrajectory
165- )
156+ bool drawTrajectory)
166157{
167158 auto ResizeRect = [&](const cv::Rect& r) -> cv::Rect
168159 {
@@ -226,9 +217,7 @@ void AsyncDetector::DrawData(frame_ptr frameInfo, int framesCounter, int currTim
226217 std::cout << " Frame " << framesCounter << " : " ;
227218 int id = frameInfo->m_inDetector .load ();
228219 if (id > 0 )
229- {
230220 std::cout << " (" << id << " ) detects = " << frameInfo->m_regions .size () << " , " ;
231- }
232221 std::cout << " tracks = " << frameInfo->m_tracks .size () << " , time = " << currTime << std::endl;
233222 }
234223
@@ -242,8 +231,7 @@ void AsyncDetector::DrawData(frame_ptr frameInfo, int framesCounter, int currTim
242231 {
243232 if (track.IsRobust (1 , // Minimal trajectory size
244233 0 .3f , // Minimal ratio raw_trajectory_points / trajectory_lenght
245- cv::Size2f (0 .1f , 8 .0f )) // Min and max ratio: width / height
246- )
234+ cv::Size2f (0 .1f , 8 .0f ))) // Min and max ratio: width / height
247235 {
248236 // std::cout << track.m_type << " - " << track.m_rect << std::endl;
249237
@@ -271,13 +259,10 @@ void AsyncDetector::CaptureThread(std::string fileName, int startFrame, float* f
271259{
272260 cv::VideoCapture capture;
273261 if (fileName.size () == 1 )
274- {
275262 capture.open (atoi (fileName.c_str ()));
276- }
277263 else
278- {
279264 capture.open (fileName);
280- }
265+
281266 if (!capture.isOpened ())
282267 {
283268 *stopFlag = true ;
@@ -372,9 +357,7 @@ void AsyncDetector::CaptureThread(std::string fileName, int startFrame, float* f
372357 break ;
373358 }
374359 if (frameInfo->m_clFrame .empty ())
375- {
376360 frameInfo->m_clFrame = frameInfo->m_frame .getUMat (cv::ACCESS_READ );
377- }
378361
379362 framesQue->AddNewFrame (frameInfo, 15 );
380363
@@ -389,14 +372,12 @@ void AsyncDetector::CaptureThread(std::string fileName, int startFrame, float* f
389372
390373 framesQue->SetBreak (true );
391374 if (thTracking.joinable ())
392- {
393375 thTracking.join ();
394- }
376+
395377 framesQue->SetBreak (true );
396378 if (thDetection.joinable ())
397- {
398379 thDetection.join ();
399- }
380+
400381 framesQue->SetBreak (true );
401382}
402383
0 commit comments