Made displaying video optional
This commit is contained in:
parent
1c6613b206
commit
5c87752526
15
main.py
15
main.py
|
@ -15,6 +15,7 @@ VIEW_SCALE = os.getenv("VIEW_SCALE")
|
||||||
DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
|
DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
|
||||||
# RUN_SCALE = 0.25
|
# RUN_SCALE = 0.25
|
||||||
# VIEW_SCALE = 0.75
|
# VIEW_SCALE = 0.75
|
||||||
|
DISPLAY = False
|
||||||
|
|
||||||
|
|
||||||
def find_face_from_name(name):
|
def find_face_from_name(name):
|
||||||
|
@ -40,12 +41,13 @@ process_this_frame = True
|
||||||
# Load the config file, if it does not exist or is blank, create it
|
# Load the config file, if it does not exist or is blank, create it
|
||||||
config = {
|
config = {
|
||||||
"URL": "rtsp://localhost:8554/example",
|
"URL": "rtsp://localhost:8554/example",
|
||||||
"RUN_SCALE": "0.25",
|
"run_scale": "0.25",
|
||||||
"VIEW_SCALE": "0.75",
|
"view_scale": "0.75",
|
||||||
"faces": {
|
"faces": {
|
||||||
"example1": {"image": "example1.jpg", "last_seen": ""},
|
"example1": {"image": "example1.jpg", "last_seen": ""},
|
||||||
"example2": {"image": "example2.jpg", "last_seen": ""},
|
"example2": {"image": "example2.jpg", "last_seen": ""},
|
||||||
},
|
},
|
||||||
|
"display": True
|
||||||
}
|
}
|
||||||
config_path = pathlib.Path("config.json")
|
config_path = pathlib.Path("config.json")
|
||||||
if config_path.exists():
|
if config_path.exists():
|
||||||
|
@ -70,6 +72,12 @@ if VIEW_SCALE:
|
||||||
config["VIEW_SCALE"] = VIEW_SCALE
|
config["VIEW_SCALE"] = VIEW_SCALE
|
||||||
else:
|
else:
|
||||||
VIEW_SCALE = float(config["VIEW_SCALE"])
|
VIEW_SCALE = float(config["VIEW_SCALE"])
|
||||||
|
if DISPLAY:
|
||||||
|
config["DISPLAY"] = DISPLAY
|
||||||
|
else:
|
||||||
|
DISPLAY = config["display"]
|
||||||
|
|
||||||
|
print(f"Current config: {config}")
|
||||||
|
|
||||||
for face in config["faces"]:
|
for face in config["faces"]:
|
||||||
# Load a sample picture and learn how to recognize it.
|
# Load a sample picture and learn how to recognize it.
|
||||||
|
@ -165,7 +173,8 @@ while True:
|
||||||
view_frame, name, (left + 6, bottom - 6), font, 1.0, (255, 255, 255), 1
|
view_frame, name, (left + 6, bottom - 6), font, 1.0, (255, 255, 255), 1
|
||||||
)
|
)
|
||||||
|
|
||||||
# Display the resulting image
|
# Display the resulting image if DISPLAY is set to true
|
||||||
|
if DISPLAY:
|
||||||
cv2.imshow("Scaled View", view_frame)
|
cv2.imshow("Scaled View", view_frame)
|
||||||
|
|
||||||
# Hit 'q' on the keyboard to quit!
|
# Hit 'q' on the keyboard to quit!
|
||||||
|
|
Loading…
Reference in New Issue