updated program to use camera index 0 not 1 and 2 for MAC M1/M2
parent
181144ce33
commit
c67afc1033
|
@ -797,7 +797,6 @@ def webcam_preview(root: ctk.CTk, camera_index: int):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_available_cameras():
|
def get_available_cameras():
|
||||||
"""Returns a list of available camera names and indices."""
|
"""Returns a list of available camera names and indices."""
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
|
@ -845,14 +844,6 @@ def get_available_cameras():
|
||||||
camera_indices.append(0)
|
camera_indices.append(0)
|
||||||
camera_names.append("FaceTime Camera")
|
camera_names.append("FaceTime Camera")
|
||||||
cap.release()
|
cap.release()
|
||||||
|
|
||||||
# On macOS, additional cameras typically use indices 1 and 2
|
|
||||||
for i in [1, 2]:
|
|
||||||
cap = cv2.VideoCapture(i)
|
|
||||||
if cap.isOpened():
|
|
||||||
camera_indices.append(i)
|
|
||||||
camera_names.append(f"Camera {i}")
|
|
||||||
cap.release()
|
|
||||||
else:
|
else:
|
||||||
# Linux camera detection - test first 10 indices
|
# Linux camera detection - test first 10 indices
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
|
@ -1003,7 +994,6 @@ def create_source_target_popup_for_webcam(
|
||||||
close_button.place(relx=0.7, rely=0.92, relwidth=0.2, relheight=0.05)
|
close_button.place(relx=0.7, rely=0.92, relwidth=0.2, relheight=0.05)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def clear_source_target_images(map: list):
|
def clear_source_target_images(map: list):
|
||||||
global source_label_dict_live, target_label_dict_live
|
global source_label_dict_live, target_label_dict_live
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue