11#include " CLICommands.hpp"
22
33#include " VideoCaptureFactory.hpp"
4+ #include " vision-core/core/opencv_interop.hpp"
45
56#include < chrono>
67#include < filesystem>
@@ -115,15 +116,15 @@ void processVideo(InferencePipeline &pipeline, const std::string &source) {
115116 auto duration =
116117 std::chrono::duration_cast<std::chrono::milliseconds>(end - start)
117118 .count ();
118- double fps = 1000.0 / duration;
119+ double fps = 1000.0 / static_cast < double >( duration) ;
119120 std::string fpsText = " FPS: " + std::to_string (fps);
120121 cv::putText (frame, fpsText, cv::Point (10 , 30 ), cv::FONT_HERSHEY_SIMPLEX , 1 ,
121122 cv::Scalar (0 , 255 , 0 ), 2 );
122123
123124 pipeline.renderResults (results, frame);
124125
125126 cv::imshow (" opencv feed" , frame);
126- char key = cv::waitKey (1 );
127+ const int key = cv::waitKey (1 );
127128 if (key == 27 || key == ' q' ) {
128129 LOG (INFO ) << " Exit requested" ;
129130 break ;
@@ -148,7 +149,7 @@ void processVideoClassification(InferencePipeline &pipeline,
148149
149150 cv::Mat frame;
150151 std::vector<cv::Mat> frameBuffer;
151- frameBuffer.reserve (requiredFrames);
152+ frameBuffer.reserve (static_cast < size_t >( requiredFrames) );
152153
153154 while (videoInterface->readFrame (frame)) {
154155 frameBuffer.push_back (frame.clone ());
@@ -165,7 +166,7 @@ void processVideoClassification(InferencePipeline &pipeline,
165166 auto duration =
166167 std::chrono::duration_cast<std::chrono::milliseconds>(end - start)
167168 .count ();
168- double fps = 1000.0 / duration;
169+ double fps = 1000.0 / static_cast < double >( duration) ;
169170 std::string fpsText = " FPS: " + std::to_string (fps);
170171
171172 cv::Mat displayFrame = frameBuffer.back ().clone ();
@@ -178,7 +179,7 @@ void processVideoClassification(InferencePipeline &pipeline,
178179 frameBuffer.erase (frameBuffer.begin ());
179180 }
180181
181- char key = cv::waitKey (1 );
182+ const int key = cv::waitKey (1 );
182183 if (key == 27 || key == ' q' ) {
183184 LOG (INFO ) << " Exit requested" ;
184185 break ;
@@ -229,7 +230,7 @@ void processOpticalFlow(InferencePipeline &pipeline) {
229230 if (std::holds_alternative<vision_core::OpticalFlow>(prediction)) {
230231 vision_core::OpticalFlow flow =
231232 std::get<vision_core::OpticalFlow>(prediction);
232- flow.flow .copyTo (image);
233+ vision_core::toCvMat ( flow.flow ) .copyTo (image);
233234 }
234235 }
235236
@@ -358,9 +359,10 @@ int BenchmarkCommand::execute(InferencePipeline &pipeline) {
358359 std::chrono::duration_cast<std::chrono::milliseconds>(end - start)
359360 .count ();
360361 LOG (INFO ) << " Iteration " << i << " : " << duration << " ms" ;
361- total_time += duration;
362+ total_time += static_cast < double >( duration) ;
362363 }
363- double average_time = total_time / pipeline.config .benchmark_iterations ;
364+ double average_time =
365+ total_time / static_cast <double >(pipeline.config .benchmark_iterations );
364366 LOG (INFO ) << " Average inference time over "
365367 << pipeline.config .benchmark_iterations
366368 << " iterations: " << average_time << " ms" ;
0 commit comments