Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

global /io/opencv/modules/videoio/src/cap_v4l.cpp (880) open VIDEOIO(V4L2): can't find camera device

$
0
0
I keep getting this error when I run this code on the ubuntu bash 18.04 terminal: Here is my code, the tensorflow part works just fine it's only the opencv part that is giving me an error. import cv2 from darkflow.net.build import TFNet import numpy as np import time options = { 'model': 'cfg/yolo.cfg', 'load': 'bin/yolo.weights', 'threshold': 0.2, 'gpu': 1.0 } tfnet = TFNet(options) colors = [tuple(255 * np.random.rand(3)) for _ in range(10)] capture = cv2.VideoCapture(0) capture.set(cv2.CAP_PROP_FRAME_WIDTH, 1920) capture.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080) while True: stime = time.time() ret, frame = capture.read() if ret: results = tfnet.return_predict(frame) for color, result in zip(colors, results): tl = (result['topleft']['x'], result['topleft']['y']) br = (result['bottomright']['x'], result['bottomright']['y']) label = result['label'] confidence = result['confidence'] text = '{}: {:.0f}%'.format(label, confidence * 100) frame = cv2.rectangle(frame, tl, br, color, 5) frame = cv2.putText( frame, text, tl, cv2.FONT_HERSHEY_COMPLEX, 1, (0, 0, 0), 2) cv2.imshow('frame', frame) print('FPS {:.1f}'.format(1 / (time.time() - stime))) if cv2.waitKey(1) & 0xFF == ord('q'): break capture.release() cv2.destroyAllWindows() python: 3.6.7 ubuntu: 18.04 opencv: 4.3.0.36

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>