1 | initial version |
Some of the ELP cameras that are b/w are not true B/W (monochrome) and have Bayer sensors still and are, as you've noticed, sending in RGB. I'm curious if the camera is actually in the proper FPS/Mode. Have you verified that it is? The "get" functions report some incorrect information sometimes it seems. I have noticed that my ELP camera refuses to change to MJPG with 640x480. As a result I am unable to set my FPS to the 120fps needed for my application and it was defaulting to the 30fps for YUY2 at that resolution. I can however set the stream to MJPG when using the resolution 320x240, and setting the Frames Per Second to 120. Have you tried that resolution yet? 800x600 lets me get mjpg @ 60fps After I set the values and the camera actual comes online I've printed the "fourcc" to see if it is in YUY2 or MJPG. (Opencv 3 and Python 3 on windows)
camera = cv2.VideoCapture(cv2.CAP_DSHOW + 0)
camera.set(cv2.CAP_PROP_FPS, 120)
camera.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter.fourcc('M','J','P','G'))
camera.set(cv2.CAP_PROP_SETTINGS, 1)
camera.set(cv2.CAP_PROP_EXPOSURE, -12)
camera.set(cv2.CAP_PROP_FRAME_WIDTH, 320)
camera.set(cv2.CAP_PROP_FRAME_HEIGHT, 240)
return_value, image = camera.read()
cv2.imshow('Camera View',image)
print(decode_fourcc(camera.get(6)))
while True:
return_value, image = camera.read()
cv2.imshow('Camera View',image)
if cv2.waitKey(1) == 27:
break
For me this shows mjpg for 320x240 @ 120fps but YUY2 for 640x480, even though in AMCAP MJPG w/ 640x480@120 works and the specs state it should as well. I've tried moving declaration orders in the code, initializing the camera up before setting properties, setting properties before initialization, setting before&after, setting multiple times after other properties, and every other strange thing as a "just in case." I can't get 640x480 to work no matter what.
I've also found that camera.get(cv2.CAP_PROP_FPS)
shows the 120 fps when the camera is in YUY2 at 640x480 (an impossible FPS for the camera in that mode), but I'm using a PWM light and can very much tell the difference in 120fps, 60fps and 30fps that the camera is actually running.