OpenCV(python)程序執行時間計算

OpenCV(python)程序執行時間計算

OpenCV(python)程序執行時間計算


資料來源: https://mp.weixin.qq.com/s?__biz=MzA4MDExMDEyMw==&mid=2247490632&idx=2&sn=35d1620889d0e0aff78091dc903f055e&chksm=9fa86b0ca8dfe21aaa1a89b5e5bc4f38b058b553c9f37c2ebbaaf8dd92feaa075d8cc3653c91&scene=126&sessionid=1606955379&key=acbfa0a404122fa504fc61d55d27034dd2e59ca298bf23a9d93d3fac7d2ed76f7cdd3d891188c104941f60dd7982a4ac0c8db45759572aa6d48949f6f5a8ba328c91aea8d99b7dadae95c532540ee212e4ec5178982b52f00171f50a1338cc9806629957d5cf1f8ba8ac8213b6bfaaa16418ca6fbef5262c3a7baf415391e32c&ascene=1&uin=MjIwODk2NDgxNw%3D%3D&devicetype=Windows+10+x64&version=6300002f&lang=zh_TW&exportkey=AruObyHMbqRk6LKXcLoq%2FuQ%3D&pass_ticket=t%2FFvv00hkdjp%2FtO4r1IZknmhrhvEXHNdJjMJVCYhKrN21PC96wCAiLvQ5Yrc7qZb&wx_header=0


00.API介紹

cv.getTickCount,
返回CPU執行的時間週期數,

cv.getTickFrequency
每秒CPU時間週期總數

01.計算秒/毫秒/FPS(運算時間差)

e1 = cv.getTickCount()
# your code execution
e2 = cv.getTickCount()
## 计算秒
time = (e2 - e1)/ cv.getTickFrequency()


## 计算毫秒
mt =((e2 - e1)/ cv.getTickFrequency())*1000


## 计算FPS
fps = cv.getTickFrequency() / (e2 - e1)

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *