Skip to content

Commit

Permalink
perf: default camera index
Browse files Browse the repository at this point in the history
  • Loading branch information
rise0chen committed Dec 6, 2024
1 parent e7fccda commit 66ef0e6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion camera/bin/src/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def search_camera():
camera_list.append(i)
cap.release()
lebai.set_item("plugin_camera_indexs", json.dumps(camera_list))
return camera_list

def init_camera():
index = (lebai.get_item("plugin_camera_index"))['value']
Expand All @@ -67,7 +68,9 @@ def init_camera():
def main():
cap = init_camera()
if not cap.isOpened():
search_camera()
cameras = search_camera()
if len(cameras) == 1:
lebai.set_item("plugin_camera_index", str(cameras[0]))
exit(1)

images_dir = os.path.join(current_dir, "../../images")
Expand Down

0 comments on commit 66ef0e6

Please sign in to comment.