def choose_capturecard(): # print OpenCV version print("OpenCV version: " + cv2.__version__) # Get camera list device_list = device.getDeviceList() etiqueta = 0 for name in device_list: print(str(etiqueta) + ': ' + name) etiqueta += 1 recuento = etiqueta - 1 if recuento < 0: print("No device is connected") return mensaje = "Select a camera (0 to " + str(recuento) + "): " try: capture_number = int(input(mensaje)) except Exception: print("It's not a number!") print() return choose_capturecard() if (capture_number > recuento) or capture_number < 0: print("Invalid number! Retry!") print() return choose_capturecard() return capture_number
def run(self): global __device__ while self._available: try: __device__ = device.getDeviceList() except Exception: __device__ = []
def find_camera(): # print OpenCV version print("OpenCV version: " + cv2.__version__) # Get camera list device_list = device.getDeviceList() index = 0 for name in device_list: print(str(index) + ': ' + name) index += 1 last_index = index - 1 if last_index < 0: print("No device is connected") return # Select a camera camera_number = select_camera(last_index) # Open camera cap = open_camera(camera_number) if cap.isOpened(): width = cap.get(3) # Frame Width height = cap.get(4) # Frame Height print('Default width: ' + str(width) + ', height: ' + str(height)) return cap
def __init__(self): QMainWindow.__init__(self) self.setupUi(self) self.startButton.clicked.connect(self.start_clicked) self.captureButton.clicked.connect(self.capture_clicked) self.captureButton.setEnabled(False) self.window_width = self.ImgWidget.frameSize().width() self.window_height = self.ImgWidget.frameSize().height() self.ImgWidget = OwnImageWidget(self.ImgWidget) self.timer = QtCore.QTimer(self) self.timer.timeout.connect(self.update_frame) self.timer.start(1) # Get camera list self.device_list = device.getDeviceList() print(self.device_list) index = 0 for name in self.device_list: print(str(index) + ': ' + name) self.comboBox.insertItem(index, name) index += 1 self.last_index = index - 1 if self.last_index < 0: print("No device is connected") self.startButton.setEnabled(False)
def camera_list(print_list=True): # Fetch device list dev_list = [] try: dev_list = device.getDeviceList() except: pass # Print device list if print_list: if len(dev_list): for index, name in enumerate(dev_list): print(f'{index}: {name}') else: print('No device is connected') return dev_list
def main(): # print OpenCV version print("OpenCV version: " + cv2.__version__) # Get camera list device_list = device.getDeviceList() index = 0 for name in device_list: print(str(index) + ': ' + name) index += 1 last_index = index - 1 if last_index < 0: print("No device is connected") return # Select a camera camera_number = select_camera(last_index) # Open camera cap = open_camera(camera_number) if cap.isOpened(): width = cap.get(3) # Frame Width height = cap.get(4) # Frame Height print('Default width: ' + str(width) + ', height: ' + str(height)) while True: ret, frame = cap.read(); cv2.imshow("frame", frame) # key: 'ESC' key = cv2.waitKey(20) if key == 27: break cap.release() cv2.destroyAllWindows()
def main(): # print OpenCV version print("OpenCV version: " + cv2.__version__) # Get camera list device_list = device.getDeviceList() etiqueta = 0 for name in device_list: print(str(etiqueta) + ': ' + name) etiqueta += 1 recuento = etiqueta - 1 if recuento < 0: print("No device is connected") return # Select a camera NumeroCapturadora = SeleccionarCapturadora(recuento) return NumeroCapturadora
def get_device(): return device.getDeviceList()
import device camera_list = device.getDeviceList()