-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils_114.py
More file actions
43 lines (30 loc) · 918 Bytes
/
utils_114.py
File metadata and controls
43 lines (30 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import serial
import time
import random
import os
import torch
from pathlib import Path
import cv2
import numpy as np
from room_camera import my_camera
# 还剩个函数不知道干啥的就放这了
# 检测指定目录下有没有新文件
def check_new_file():
path_to_watch = "imageCapture"
before = dict([(f, None) for f in os.listdir(path_to_watch)])
while True:
time.sleep(1)
after = dict([(f, None) for f in os.listdir(path_to_watch)])
added = [f for f in after if not f in before]
if added:
print("New file detected:", added[0])
os.system("run.sh")
else:
print("No new file")
before = after
# 拍摄图片,同时 修改程序,检测并删除30s前拍摄的图片,将结果输出
# 拍照
# while True:
# cv2.imshow('result', take_photo()[0])
# k = cv2.waitKey(1)
# time.sleep(0.125)