简体   繁体   English

特定时间后如何在cv2,python中拍照

[英]How to take picture in cv2,python after a specific period of time

With cv2 and python, to take picture every specific amount of time eg: 5 mins使用 cv2 和 python,每隔特定时间拍照,例如:5 分钟

Check the timeloop library.检查时间循环库。 If you can already take a picture, it should enable you to run the task periodically.如果您已经可以拍照,它应该使您能够定期运行任务。

Installation is straightforward using pip使用 pip 安装非常简单

pip install timeloop

See the sample code in the documentation请参阅文档中的示例代码



import time
from timeloop import Timeloop
from datetime import timedelta

tl = Timeloop()

@tl.job(interval=timedelta(seconds=2))
def sample_job_every_2s():
    print "2s job current time : {}".format(time.ctime())

In case you need help taking a picture using cv2 there are some great answers on this platform already showing how to do that, this one for example如果您需要帮助使用 cv2 拍照,这个平台上有一些很好的答案已经展示了如何做到这一点,例如这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM