Our team is using a Raspberry PI along with a Microsoft USB Cam(the one that comes in the KOP) to track the retro-reflective tapes. We are using the Pi image provided us to by WPILib and a python script (taken mostly from the sample code given). I haven’t figured out a way to adjust the exposure of our camera. Here is a snippet of the python code which we have deployed on the RPI.
Could anyone guide us on how we can change the exposure of the camera?
#Start camera print("Connecting to camera") cs = CameraServer.getInstance() cs.enableLogging() Camera = UsbCamera('Cam 0', 0) Camera.setResolution(160,120) cs.addCamera(Camera) print("connected") CvSink = cs.getVideo() outputStream = cs.putVideo("Processed Frames", 160,120) #buffer to store img data img = np.zeros(shape=(160,120,3), dtype=np.uint8) # loop forever while True: GotFrame, img = CvSink.grabFrame(img) if GotFrame == 0: outputStream.notifyError(CvSink.getError()) continue img = TrackTheBall(img, SmartDashBoardValues) outputStream.putFrame(img)