Quote:
Originally Posted by Acheron-X
I am testing with two different HD cameras; not sure if this could cause a problem. One is a Microsoft HD-3000 camera, the other is a Genius WideCam F100. The tests are performed in a brightly-lit room, so it seems like the main problem is the delay from the cameras having to go to the roboRIO first then going to the computer.
As for CvSink and CameraServer, I will try to use both your suggestions. Thanks!
EDIT: I'd like to ask if and how CameraServer/CvSink can switch between cameras. It seems like the code you had posted displays both cameras at once, although I haven't tested it yet. Since we will be sending and receiving over a radio/wifi connection, our team wants to minimize the bandwidth usage.
|
Sorry if my message above wasn't clear.. just add the CvSink lines to your existing code (which uses SetSource to switch cameras). All the CvSink lines do is keep the camera connection open so that SetSource can instantly switch rather than being delayed due to taking a while to reconnect to the disconnected camera. It also makes both streams available simultaneously, but you can use SetSource to switch between them the way you were already doing.
I tested with both a HD3000 and a Logitech C210 with your code plus the CvSink lines and could switch instantly. I was getting 30 fps from the HD3000 in a brightly lit environment; the C210 wasn't quite as fast but I didn't spend the time to tweak settings.
In terms of delays/latency, if the client is not requesting a different resolution than the camera is set to (the default case for SmartDashboard or viewing the stream via a web browser), the roboRio is performing minimal processing on the image--basically it just gets the JPEG image from the camera (via the Linux video layer) and forwards it via the HTTP connection; it's about as fast as you can get for a USB camera. Again, it's most likely slower FPS is due to the camera trying to compensate for lighting conditions; I highly recommend you try fixed exposure etc settings on the camera.
__________________
Author of
cscore - WPILib CameraServer for 2017+
Author of
ntcore - WPILib NetworkTables for 2016+
Creator of
RobotPy - Python for FRC
2010 FRC World Champions (
294, 67, 177)
2007 FTC World Champions (30, 74,
23)
2001 FRC National Champions (71,
294, 125, 365, 279)