您的位置:首页 > 财经 > 产业 > 研发外包_大公司需要seo是什么职业_百度端口开户推广_seo深度优化公司

研发外包_大公司需要seo是什么职业_百度端口开户推广_seo深度优化公司

2025/1/10 10:39:29 来源:https://blog.csdn.net/xiaolixi199311/article/details/144864170  浏览:    关键词:研发外包_大公司需要seo是什么职业_百度端口开户推广_seo深度优化公司
研发外包_大公司需要seo是什么职业_百度端口开户推广_seo深度优化公司

OpenCV的TickMeter计时类

    • 1. TickMeter是一个计时的类
      • 1.1 计算耗时
      • 1.2 计算循环的平均耗时和FPS
      • 1.3 function
    • 2. 案例

1. TickMeter是一个计时的类

https://docs.opencv.org/4.x/d9/d6f/classcv_1_1TickMeter.html#details
在这里插入图片描述

1.1 计算耗时

        TickMeter tm;tm.start();// do something ...tm.stop();cout << "Total time: " << tm.getTimeSec() << endl;

1.2 计算循环的平均耗时和FPS

        TickMeter tm;for (int i = 0; i < COUNT; i++){tm.start();// do something ...tm.stop();cout << "Last iteration: " << tm.getLastTimeSec() << endl;}cout << "Average time per iteration in seconds: " << tm.getAvgTimeSec() << endl;cout << "Average FPS: " << tm.getFPS() << endl;

1.3 function

indexfunction
1getAvgTimeMilli
2getAvgTimeSec
3getCounter
4getFPS
5getTimeMicro
6getTimeMilli
7getTimeSec
8getTimeTicks
9reset
10start
11stop

2. 案例

import timeimport cv2tm = cv2.TickMeter()
index = 0
print(f"|index|function|")
print(f"|:----:|:----:|")
for i, con in enumerate(dir(tm)):if con.startswith("__"):continueindex += 1print(f"|{index}|\t{con}|")def show():for _ in range(10):tm.start()time.sleep(0.1)tm.stop()print(f"总计数次数 Last iteration: {tm.getCounter()}")print(f"getTimeSec 总耗时(s): {tm.getTimeSec()} getTimeMilli 总耗时(ms): {tm.getTimeMilli()} "f"getTimeMicro 总耗时(us): {tm.getTimeMicro()} getTimeTicks 总tick(us): {tm.getTimeTicks()}")print(f"Average time per iteration in seconds: {tm.getAvgTimeSec()} Millis: {tm.getAvgTimeMilli()}")print(f"Average FPS: {tm.getFPS()}")show()
tm.reset()
print("after tm.reset()" + "------------------------")
show()
|index|function|
|:----:|:----:|
|1|	getAvgTimeMilli|
|2|	getAvgTimeSec|
|3|	getCounter|
|4|	getFPS|
|5|	getTimeMicro|
|6|	getTimeMilli|
|7|	getTimeSec|
|8|	getTimeTicks|
|9|	reset|
|10|	start|
|11|	stop|
总计数次数 Last iteration: 1
getTimeSec 总耗时(s): 0.105019959 getTimeMilli 总耗时(ms): 105.019959 getTimeMicro 总耗时(us): 105019.959 getTimeTicks 总tick(us): 105019959
总计数次数 Last iteration: 2
getTimeSec 总耗时(s): 0.209122084 getTimeMilli 总耗时(ms): 209.122084 getTimeMicro 总耗时(us): 209122.084 getTimeTicks 总tick(us): 209122084
总计数次数 Last iteration: 3
getTimeSec 总耗时(s): 0.311539417 getTimeMilli 总耗时(ms): 311.53941699999996 getTimeMicro 总耗时(us): 311539.41699999996 getTimeTicks 总tick(us): 311539417
总计数次数 Last iteration: 4
getTimeSec 总耗时(s): 0.412974 getTimeMilli 总耗时(ms): 412.974 getTimeMicro 总耗时(us): 412974.0 getTimeTicks 总tick(us): 412974000
总计数次数 Last iteration: 5
getTimeSec 总耗时(s): 0.51804475 getTimeMilli 总耗时(ms): 518.04475 getTimeMicro 总耗时(us): 518044.75 getTimeTicks 总tick(us): 518044750
总计数次数 Last iteration: 6
getTimeSec 总耗时(s): 0.623065542 getTimeMilli 总耗时(ms): 623.0655419999999 getTimeMicro 总耗时(us): 623065.5419999999 getTimeTicks 总tick(us): 623065542
总计数次数 Last iteration: 7
getTimeSec 总耗时(s): 0.727750709 getTimeMilli 总耗时(ms): 727.750709 getTimeMicro 总耗时(us): 727750.709 getTimeTicks 总tick(us): 727750709
总计数次数 Last iteration: 8
getTimeSec 总耗时(s): 0.831228417 getTimeMilli 总耗时(ms): 831.228417 getTimeMicro 总耗时(us): 831228.417 getTimeTicks 总tick(us): 831228417
总计数次数 Last iteration: 9
getTimeSec 总耗时(s): 0.933850459 getTimeMilli 总耗时(ms): 933.850459 getTimeMicro 总耗时(us): 933850.459 getTimeTicks 总tick(us): 933850459
总计数次数 Last iteration: 10
getTimeSec 总耗时(s): 1.038880917 getTimeMilli 总耗时(ms): 1038.880917 getTimeMicro 总耗时(us): 1038880.9169999999 getTimeTicks 总tick(us): 1038880917
Average time per iteration in seconds: 0.10388809169999999 Millis: 103.88809169999999
Average FPS: 9.625742312099858
after tm.reset()------------------------
总计数次数 Last iteration: 1
getTimeSec 总耗时(s): 0.10503875 getTimeMilli 总耗时(ms): 105.03875 getTimeMicro 总耗时(us): 105038.75 getTimeTicks 总tick(us): 105038750
总计数次数 Last iteration: 2
getTimeSec 总耗时(s): 0.210075042 getTimeMilli 总耗时(ms): 210.075042 getTimeMicro 总耗时(us): 210075.042 getTimeTicks 总tick(us): 210075042
总计数次数 Last iteration: 3
getTimeSec 总耗时(s): 0.315131042 getTimeMilli 总耗时(ms): 315.131042 getTimeMicro 总耗时(us): 315131.04199999996 getTimeTicks 总tick(us): 315131042
总计数次数 Last iteration: 4
getTimeSec 总耗时(s): 0.416519501 getTimeMilli 总耗时(ms): 416.519501 getTimeMicro 总耗时(us): 416519.501 getTimeTicks 总tick(us): 416519501
总计数次数 Last iteration: 5
getTimeSec 总耗时(s): 0.521595918 getTimeMilli 总耗时(ms): 521.5959180000001 getTimeMicro 总耗时(us): 521595.9180000001 getTimeTicks 总tick(us): 521595918
总计数次数 Last iteration: 6
getTimeSec 总耗时(s): 0.626131752 getTimeMilli 总耗时(ms): 626.131752 getTimeMicro 总耗时(us): 626131.752 getTimeTicks 总tick(us): 626131752
总计数次数 Last iteration: 7
getTimeSec 总耗时(s): 0.727543668 getTimeMilli 总耗时(ms): 727.543668 getTimeMicro 总耗时(us): 727543.6680000001 getTimeTicks 总tick(us): 727543668
总计数次数 Last iteration: 8
getTimeSec 总耗时(s): 0.832573168 getTimeMilli 总耗时(ms): 832.573168 getTimeMicro 总耗时(us): 832573.1680000001 getTimeTicks 总tick(us): 832573168
总计数次数 Last iteration: 9
getTimeSec 总耗时(s): 0.937604126 getTimeMilli 总耗时(ms): 937.604126 getTimeMicro 总耗时(us): 937604.1259999999 getTimeTicks 总tick(us): 937604126
总计数次数 Last iteration: 10
getTimeSec 总耗时(s): 1.04264996 getTimeMilli 总耗时(ms): 1042.6499600000002 getTimeMicro 总耗时(us): 1042649.9600000002 getTimeTicks 总tick(us): 1042649960
Average time per iteration in seconds: 0.10426499600000001 Millis: 104.26499600000001
Average FPS: 9.590946514782392Process finished with exit code 0

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com