"capturing-video-from-two-cameras-in-opencv-at-once" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "capturing-video-from-two-cameras-in-opencv-at-once" answered properly. Developers are finding an appropriate answer about capturing-video-from-two-cameras-in-opencv-at-once related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like capturing-video-from-two-cameras-in-opencv-at-once. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on capturing-video-from-two-cameras-in-opencv-at-once.
capturing-video-from-two-cameras-in-opencv-at-once
import cv2
import threading
class camThread(threading.Thread):
def __init__(self, previewName, camID):
threading.Thread.__init__(self)
self.previewName = previewName
self.camID = camID
def run(self):
print("Starting " + self.previewName)
camPreview(self.previewName, self.camID)
def camPreview(previewName, camID):
cv2.namedWindow(previewName)
cam = cv2.VideoCapture(camID)
if cam.isOpened():
rval, frame = cam.read()
else:
rval = False
while rval:
cv2.imshow(previewName, frame)
rval, frame = cam.read()
key = cv2.waitKey(20)
if key == 27: # exit on ESC
break
cv2.destroyWindow(previewName)
# Create threads as follows
thread1 = camThread("Camera 1", 0)
thread2 = camThread("Camera 2", 1)
thread3 = camThread("Camera 3", 2)
thread1.start()
thread2.start()
thread3.start()
print()
print("Active threads", threading.activeCount())
Source: stackoverflow.com
All those coders who are working on the Whatever based application and are stuck on capturing-video-from-two-cameras-in-opencv-at-once can get a collection of related answers to their query. Programmers need to enter their query on capturing-video-from-two-cameras-in-opencv-at-once related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about capturing-video-from-two-cameras-in-opencv-at-once for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of capturing-video-from-two-cameras-in-opencv-at-once while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "capturing-video-from-two-cameras-in-opencv-at-once". Visit this developer's friendly online web community, CodeProZone, and get your queries like capturing-video-from-two-cameras-in-opencv-at-once resolved professionally and stay updated to the latest Whatever updates.