Skip to content

Commit

Permalink
replacing another cout with printf
Browse files Browse the repository at this point in the history
For better performance on windows commandline
  • Loading branch information
hn-88 authored Apr 26, 2020
1 parent 4b20d3b commit cdf2a58
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions OCVWarp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1081,35 +1081,24 @@ int main(int argc,char *argv[])
if(showdisplay)
imshow("Display", dst);

//std::cout << "\x1B[2K"; // Erase the entire current line.
//~ #ifdef __unix__
//~ std::cout << "\x1B[0E"; // Move to the beginning of the current line.
//~ #else
//~ //std::cout << std::endl;
//~ #endif
printf("\r");
printf("\r");

fps++;
t_end = time(NULL);
if (t_end - t_start >= 5)
{
//~ #ifdef __unix__
//~ std::cout << "Frame: " << framenum++ << " x: " << anglex << " y: " << angley << " fps: " << fps/5 << std::flush;
//~ #else
//~ std::cout << "Frame: " << framenum++ << " x: " << anglex << " y: " << angley << " fps: " << fps/5 << std::endl;
//~ #endif
printf("Frame: %llu x: %.0f y: %.0f fps: %.1f \r", framenum++, anglex, angley, float(fps)/5 );
// extra spaces to delete previous line's characters if any
fflush(stdout);
t_start = time(NULL);
fps = 0;
}
else
#ifdef __unix__
std::cout << "Frame: " << framenum++ << " x: " << anglex << " y: " << angley << std::flush;
#else
framenum++;
#endif
{
printf("Frame: %llu x: %.0f y: %.0f \r", framenum++, anglex, angley, float(fps)/5 );
fflush(stdout);
}

//outputVideo.write(res); //save or
outputVideo << dst;
Expand Down

0 comments on commit cdf2a58

Please sign in to comment.