On Mon, Aug 09, 2021 at 11:56:36AM -0600, Jeff Ross wrote: > > Hi, > > I'm porting a python3 program I wrote for capturing jpegs from a USB based > webcam, using OpenCV for capture and post-processing.?? I was running this > on a RaspberryPi 3B+ under linux but I'm sick of battling crappy hardware > and linux so I bought a Mini PC stick and installed 6.9.?? (dmesg follows) > > OpenCV (installed from the package) doesn't seem to be able to open the > camera. The camera (in this case for testing a Logitech C910) can be > accessed no problem with ffplay, fswebcam and video(1).?? I also opened the > kern sysctls for both audio and video and chowned /dev/video to my user. > > jross@aurora-cam:/home/jross $ fswebcam?? -d v4l2:/dev/video0 -F3 --save > test2.jpg > --- Opening v4l2:/dev/video0... > /dev/video0 opened. > No input was specified, using the first. > Adjusting resolution from 384x288 to 432x240. > --- Capturing 3 frames... > Captured 3 frames in 0.06 seconds. (46 fps) > --- Processing captured image... > Writing JPEG image to 'test2.jpg'. > > OpenCV not so much though: > > jross@aurora-cam:/home/jross $ cat open_test.py > import cv2 as cv > import subprocess > > cap = cv.VideoCapture(0, cv.CAP_V4L2) > print(cap) > if not cap.isOpened(): > ?????? print("Open Failed!") > elif cap.isOpened(): > ?????? print("Open Succeeded!") > > height = cap.get(cv.CAP_PROP_FRAME_HEIGHT) > width = cap.get(cv.CAP_PROP_FRAME_WIDTH) > exposure = cap.get(cv.CAP_PROP_AUTO_EXPOSURE) > > print(height,width,exposure) > frame = [] > try: > ?????? ret, temp_frame = cap.read() > ?????? print(ret) > except Exception as e: > ?????? print(e) > ?????? #kill anything else using the camera > ?????? pid = subprocess.check_output("fuser -k > /dev/video0",stderr=subprocess.STDOUT, shell=True)[:-1].decode('utf-8') > ?????? print("Exception caught! %s" % (e)) > frame.append(temp_frame) > print(frame) > > jross@aurora-cam:/home/jross $ python3 open_test.py > <VideoCapture 0x6ead5ca5570> > Open Failed! > 0.0 0.0 0.0 > False > [None] > > I'd appreciate anyone's thoughts on fixing this!
Hi, I encountered the same problem. Just committed a fix: https://marc.info/?l=openbsd-ports-cvs&m=162857744213080&w=2 > Jeff Ross Kevin