OpenCV·计算用时

来源:互联网 发布:淘宝详情页画布大小 编辑:程序博客网 时间:2024/06/06 14:39

经常使用计时操作,做个记录,方便下次直接用。

函数介绍:

function 1: int64 cv::getTickCount ()

    The function returns the number of ticks after the certain event (for example, when the machine was turned on). It can be used to initialize RNG or to measure a function execution time by reading the tick count before and after the function call.

function 2: double cv::getTickFrequency()

    The function returns the number of ticks per second.

    That is, the following code computes the execution time in seconds:

double t = (double)getTickCount();// do something ...t = ((double)getTickCount() - t)/getTickFrequency();cout << "Used time :" << t << "s" << endl;
原创粉丝点击