Opencv learning notes () -- display the current FPS

Source: Internet
Author: User

Recently, a real-time display is required, so I want to display FPS on the screen. FPS is the abbreviation of frame per second. FPS is used to measure the quantity of information used to save and Display Dynamic videos. In general, it refers to the number of pictures of an animation or video.

This requires meSystem FunctionsMentioned in the first lectureGettickcount, gettickfrequencyThese two functions. The previous function returns the number of tick times, and the latter function returns the number of tick times per second. Their ratio is time.

If you want to getProgramYou can use the following example:

 
Double T = (double) gettickcount (); // do something... t = (double) gettickcount ()-T)/gettickfrequency ();

The above procedures are being testedAlgorithmIs a good test program. Here I just need to rewrite this example to get the time between each frame, and then use the previousPlotting FunctionsWhat I mentioned in that sectionPuttextDisplay FPS to the screen.

But there is a problem that makes me feel uncomfortable,It is not very accurate when it is used, and it feels that the time is faster than the actual time.. There are few tests and you are not afraid to talk about them. You are welcome to test and give your comments.

Very simple, source code: http://download.csdn.net/detail/yang_xian521/3957523

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.