I ran into a very strange problem that appeared out of nowhere, the same code did not cause this problem before.
The following code, the first time I ran it, it read the frame from my connected external camera; the second time I ran it, it read the frame from my MacBook's built-in camera; the third time it read the frame from the external camera.
It just keeps switching and I don't know how to fix it, I want cameraCapture = cv2.VideoCapture(0)
to always get the frame from the external camera.
import cv2
cameraCapture = cv2.VideoCapture(1)
# read
success, frame = cameraCapture.read()
while success and cv2.waitKey(1) == -1:
img = frame
cv2.imshow("Mine", img)
success, frame = cameraCapture.read()
Is there any way I can get the data of a certain numbered camera, such as name, resolution, etc.?