Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   USB Camera not working (http://www.chiefdelphi.com/forums/showthread.php?t=135424)

JacobD 03-03-2015 05:36 PM

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:

Code:

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(CameraServer.java:212)
edu.wpi.first.wpilibj.CameraServer$2.run(CameraServer.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?

Code:

                usbCam = CameraServer.getInstance();
                usbCam.setQuality(100); //full-quality JPEG images. 100 is full quality
                usbCam.startAutomaticCapture("cam1");


smarthimandrew 02-03-2016 07:53 PM

Re: USB Camera not working
 
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 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?

JacobD 02-03-2016 09:01 PM

Re: USB Camera not working
 
Quote:

Originally Posted by smarthimandrew (Post 1534680)
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 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 02-05-2016 04:03 PM

Re: USB Camera not working
 
Quote:

Originally Posted by smarthimandrew (Post 1534680)
Is there a way to contact the wpilib team to report this bug?

http://wpilib.screenstepslive.com/s/...port-resources

smarthimandrew 02-09-2016 06:27 AM

Re: USB Camera not working
 
Quote:

Originally Posted by JacobD (Post 1534724)
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?

JacobD 02-09-2016 10:59 AM

Re: USB Camera not working
 
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")
Code:

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 02-10-2016 01:21 PM

Re: USB Camera not working
 
Quote:

Originally Posted by JacobD (Post 1537533)
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")
Code:

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 02-10-2016 02:51 PM

Re: USB Camera not working
 
Quote:

Originally Posted by Joe Ross (Post 1535636)

Thanks. I filed a bug report here:

https://usfirst.collab.net/sf/go/art...=1455129586145

JacobD 02-17-2016 10:21 PM

Re: USB Camera not working
 
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 02-18-2016 11:45 AM

Re: USB Camera not working
 
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.


All times are GMT -5. The time now is 08:06 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi