Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <opencv2/opencv.hpp>
- #include <cstdint>
- #include <chrono>
- #include <iostream>
- int main()
- {
- using std::chrono::high_resolution_clock;
- using std::chrono::duration_cast;
- using std::chrono::microseconds;
- cv::Mat img(cv::Mat::zeros(1200, 1600, CV_8UC3));
- high_resolution_clock::time_point t1 = high_resolution_clock::now();
- for (uint32_t i(0); i < 256; ++i) {
- cv::imshow("foo", img);
- cv::waitKey(1);
- img += 1;
- }
- high_resolution_clock::time_point t2 = high_resolution_clock::now();
- auto duration = duration_cast<microseconds>(t2 - t1).count();
- double t_ms(static_cast<double>(duration) / 1000.0);
- std::cout
- << "Total = " << t_ms << " ms\n"
- << "Iteration = " << (t_ms / 256) << " ms\n"
- << "FPS = " << (256 / t_ms * 1000.0) << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement