View Full Version : USB Camera not working
Hi, after updating all of the FRC java libraries, we're getting this error when we call the startAutomaticCapture() method on an instance of a CameraServer:
found mode 12: 320 x 240 JPEG 30.00 fps
Error when getting image from the camera: invalid image: could not find jpeg end 199999 at edu.wpi.first.wpilibj.CameraServer.capture(CameraS erver.java:212)
edu.wpi.first.wpilibj.CameraServer$2.run(CameraSer ver.java:182)
Apparently it can't find the end of the jpeg images the camera is sending? The camera worked perfectly before we updated the libraries. We're using a logitech USB camera.
The error isn't fatal but it prevents us from opening up the java smart dashboard. Any ideas?
usbCam = CameraServer.getInstance();
usbCam.setQuality(100); //full-quality JPEG images. 100 is full quality
usbCam.startAutomaticCapture("cam1");
smarthimandrew
03-02-2016, 19:53
We just encountered this identical error with a new COTS USB camera we would like to use for this season.
The roboRIO sends a single image to the smart dashboard when the code starts. Then the above error is spammed on the driver's station until the robot is shut off. The error is in the capture() method of the CameraServer class in the wpi library.
This (http://www.amazon.com/180degree-Fisheye-1080p-Angle-Camera/dp/B00LQ854AG) is the camera we're attempting to use.
Is there a way to contact the wpilib team to report this bug?
We really want to use this camera in particular because of its fisheye lens. Is there an alternate way to display a USB camera on the driver's computer?
We just encountered this identical error with a new COTS USB camera we would like to use for this season.
The roboRIO sends a single image to the smart dashboard when the code starts. Then the above error is spammed on the driver's station until the robot is shut off. The error is in the capture() method of the CameraServer class in the wpi library.
This (http://www.amazon.com/180degree-Fisheye-1080p-Angle-Camera/dp/B00LQ854AG) is the camera we're attempting to use.
Is there a way to contact the wpilib team to report this bug?
We really want to use this camera in particular because of its fisheye lens. Is there an alternate way to display a USB camera on the driver's computer?
This is kind of an old thread but from what I remember from last year, we found the old CameraServer.java and put it into our java project. This seemed to fix that issue. As far as the 2016 library, who knows.
Hopefully I will find time to test it in the near future. We just bought that camera today so hopefully I can find a fix.
Joe Ross
05-02-2016, 16:03
Is there a way to contact the wpilib team to report this bug?
http://wpilib.screenstepslive.com/s/4485/m/24193/l/144990-support-resources
smarthimandrew
09-02-2016, 06:27
Hopefully I will find time to test it in the near future. We just bought that camera today so hopefully I can find a fix.
Any progress?
The code that I wrote for it but I still haven't tested it because we are getting ready to reassemble the electronics on our robot. Otherwise try this:
Make sure you name the usb cam in the roboRio web panel to the appropriate name ("cam1")
public void robotInit()
{
usbCam = CameraServer.getInstance();
usbCam.setQuality(50);
usbCam.startAutomaticCapture("cam1");
}
It seems like they added the camera server class back into the library so hopefully it is functional. I'll try to let you know before the end of this week.
smarthimandrew
10-02-2016, 13:21
The code that I wrote for it but I still haven't tested it because we are getting ready to reassemble the electronics on our robot. Otherwise try this:
Make sure you name the usb cam in the roboRio web panel to the appropriate name ("cam1")
public void robotInit()
{
usbCam = CameraServer.getInstance();
usbCam.setQuality(50);
usbCam.startAutomaticCapture("cam1");
}
It seems like they added the camera server class back into the library so hopefully it is functional. I'll try to let you know before the end of this week.
This won't work. The bug is in the CameraServer class itself. This is exactly what I've tried. My original post describes the bug...
smarthimandrew
10-02-2016, 14:51
http://wpilib.screenstepslive.com/s/4485/m/24193/l/144990-support-resources
Thanks. I filed a bug report here:
https://usfirst.collab.net/sf/go/artf4819?returnUrlKey=1455129586145
I don't know if you heard back from the WPI developers but I got my camera to work again. It was throwing that error temporarily but by putting the quality down a bit and restarting the dashboard, it works perfectly again. I might suggest putting the FPS to 20 or 25 instead.
smarthimandrew
18-02-2016, 11:45
Interesting... We decided to stream the camera through a Raspberry Pi instead. I'll try reducing the quality and framerate to see if we can replicate your results though.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.