Go to Post We use the engines of our imagination on the robot all the time. FIRST being an engine of change after all. - Mark McLeod [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 22-01-2016, 19:56
Cobra Commander's Avatar
Cobra Commander Cobra Commander is offline
Registered User
FRC #0498 (Cobra Commanders)
Team Role: Leadership
 
Join Date: Jan 2015
Rookie Year: 2001
Location: Glendale, AZ
Posts: 30
Cobra Commander is on a distinguished road
Re: GRIP with USB Camera

I found my own problem. I should have read the error more carefully.

Code:
INFO: Loading file /home/lvuser/project.grip
VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV
VIDEOIO ERROR: V4L: setting property #16 is not supported
VIDIOC_STREAMON: Bad file descriptor
VIDIOC_STREAMON: Bad file descriptor
Jan 23, 2016 12:57:05 AM edu.wpi.grip.core.Source initializeSafely
WARNING: Failed to initialize CameraSource
java.io.IOException: A problem occurred trying to start the frame grabber for Webcam 0
The webcam I am using's pixel format is unsupported by OpenCV
  #2   Spotlight this post!  
Unread 22-01-2016, 20:33
nollchr nollchr is offline
Registered User
FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Glastonbury, CT
Posts: 28
nollchr is an unknown quantity at this point
Re: GRIP with USB Camera

Quote:
Originally Posted by Cobra Commander View Post
I found my own problem. I should have read the error more carefully.

Code:
INFO: Loading file /home/lvuser/project.grip
VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV
VIDEOIO ERROR: V4L: setting property #16 is not supported
VIDIOC_STREAMON: Bad file descriptor
VIDIOC_STREAMON: Bad file descriptor
Jan 23, 2016 12:57:05 AM edu.wpi.grip.core.Source initializeSafely
WARNING: Failed to initialize CameraSource
java.io.IOException: A problem occurred trying to start the frame grabber for Webcam 0
The webcam I am using's pixel format is unsupported by OpenCV
We are getting the same problem with the USB Microsoft LifeCam 3000-HD
  #3   Spotlight this post!  
Unread 22-01-2016, 23:11
NickB NickB is offline
Registered User
FRC #2002
 
Join Date: Jan 2016
Location: Oregon
Posts: 5
NickB is an unknown quantity at this point
Re: GRIP with USB Camera

I am also trying to get my Microsoft LifeCam 3000-HD to work, but using RoboRealm. After using the FRC_CameraClient module, I get the error "Invalid Jpeg Format". It works fine when connecting directly to the PC. The only other discussion I have found about this is in this (http://www.roborealm.com/forum/index.php?thread_id=5472) RoboRealm thread:

"It seems that they are using jpeg images but with a couple bytes at the beginning of the stream that indicate size, fps, etc. Its not a standard stream format so we'll have to create something specific to handle these kinds of streams."

Perhaps the RoboRio is formatting USB Webcam images specifically for the dashboard? Even if not, it seems to be an issue with the RoboRio, since other webcams are having this same issue. Later in that thread, however, the guy who was having issues said he was able to successfully get the image to come in right, but he doesn't really explain how.

Edit: This (http://www.chiefdelphi.com/forums/sh...d.php?t=134404) thread details how the RoboRio handles USB Webcams. According to it, the images extracted from the webcam is missing a part of the normal JPEG header. While his modified camera viewer may not be useful, he also explains that the Intermediate Vision template will re-encode the images locally.

Last edited by NickB : 22-01-2016 at 23:55. Reason: Found possible solution?
  #4   Spotlight this post!  
Unread 23-01-2016, 11:48
Cobra Commander's Avatar
Cobra Commander Cobra Commander is offline
Registered User
FRC #0498 (Cobra Commanders)
Team Role: Leadership
 
Join Date: Jan 2015
Rookie Year: 2001
Location: Glendale, AZ
Posts: 30
Cobra Commander is on a distinguished road
Re: GRIP with USB Camera

This defiantly seems to be the problem.

It seems to get closer if you don't start the camera in the code. It can at least find the camera this way but, it has extraneous data.

Code:
VIDEOIO ERROR: V4L/V4L2: VIDIOC_S_CROP
VIDEOIO ERROR: V4L: setting property #16 is not supported
Corrupt JPEG data: 2 extraneous bytes before marker 0xd6
Corrupt JPEG data: 4 extraneous bytes before marker 0xd
How would we go about implementing such a solution?
  #5   Spotlight this post!  
Unread 23-01-2016, 12:28
NickB NickB is offline
Registered User
FRC #2002
 
Join Date: Jan 2016
Location: Oregon
Posts: 5
NickB is an unknown quantity at this point
Re: GRIP with USB Camera

Just got RoboRealm to pick up the USB Webcam image using the Intermediate Vision example program.
  #6   Spotlight this post!  
Unread 23-01-2016, 12:44
Cobra Commander's Avatar
Cobra Commander Cobra Commander is offline
Registered User
FRC #0498 (Cobra Commanders)
Team Role: Leadership
 
Join Date: Jan 2015
Rookie Year: 2001
Location: Glendale, AZ
Posts: 30
Cobra Commander is on a distinguished road
Re: GRIP with USB Camera

GRIP has loads of potential to be a very powerful tool, I'd like to see if we (being the users of chief delphi) can get it working.
  #7   Spotlight this post!  
Unread 26-01-2016, 09:33
nollchr nollchr is offline
Registered User
FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Glastonbury, CT
Posts: 28
nollchr is an unknown quantity at this point
Question Re: GRIP with USB Camera

Just curious if anyone has gotten GRIP to work on the RoboRIO using a USB camera. We have it running with the Axis IP camera, but the two MS lifecams we tried both throw that same error.
  #8   Spotlight this post!  
Unread 26-01-2016, 12:06
SLAB-Mr.Thomas SLAB-Mr.Thomas is offline
Registered User
FRC #4237
 
Join Date: Jan 2015
Location: USA
Posts: 12
SLAB-Mr.Thomas is an unknown quantity at this point
Re: GRIP with USB Camera

GRIP on the roboRIO with our USB Lifecam 3000-HD works without camera error but an old Logitech USB camera from the junk box throws those same errors of a bad couple of bytes in each frame. An Axis M1011 IP camera with GRIP running on the driver station PC runs for about a minute then the image freezes. We might guess the setup of the camera isn't right but the documentation on how to set it up is sparse and there aren't really very many choices to be made anyway.

We are having severe startup problems but if GRIP can make it past the first few seconds after starting on the roboRIO it runs fine albeit a little slow.
  #9   Spotlight this post!  
Unread 26-01-2016, 20:18
Cobra Commander's Avatar
Cobra Commander Cobra Commander is offline
Registered User
FRC #0498 (Cobra Commanders)
Team Role: Leadership
 
Join Date: Jan 2015
Rookie Year: 2001
Location: Glendale, AZ
Posts: 30
Cobra Commander is on a distinguished road
Re: GRIP with USB Camera

Quote:
Originally Posted by SLAB-Mr.Thomas View Post
GRIP on the roboRIO with our USB Lifecam 3000-HD works without camera error...

Do I still initialize the camera server when trying to use it with grip?

Code:
CameraServer server = CameraServer.getInstance();
		server.setQuality(50);
		server.startAutomaticCapture("cam1");
  #10   Spotlight this post!  
Unread 26-01-2016, 20:36
ThomasClark's Avatar
ThomasClark ThomasClark is offline
Registered User
FRC #0237
 
Join Date: Dec 2012
Location: Watertown, CT
Posts: 146
ThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud of
Re: GRIP with USB Camera

If you initialize the cameraserver in your robot program GRIP probably won't be able to access it. Usually only one application can access a camera at a time on Linux.

To get similar functionality as CameraServer, you can use the "Publish Video" operation in GRIP.
__________________
GRIP (Graphically Represented Image Processing) - rapidly develop computer vision algorithms for FRC
  #11   Spotlight this post!  
Unread 26-01-2016, 20:52
Cobra Commander's Avatar
Cobra Commander Cobra Commander is offline
Registered User
FRC #0498 (Cobra Commanders)
Team Role: Leadership
 
Join Date: Jan 2015
Rookie Year: 2001
Location: Glendale, AZ
Posts: 30
Cobra Commander is on a distinguished road
Re: GRIP with USB Camera

I think we are really close to getting this working!

What is setting property #16?

We are getting this error on our deploy:

Code:
Jan 27, 2016 1:53:36 AM edu.wpi.grip.core.Main start
INFO: Loading file /home/lvuser/project.grip
VIDEOIO ERROR: V4L/V4L2: VIDIOC_S_CROP
VIDEOIO ERROR: V4L: setting property #16 is not supported
Jan 27, 2016 1:53:40 AM edu.wpi.grip.core.Main start
INFO: SUCCESS! The project is running in headless mode!
  #12   Spotlight this post!  
Unread 27-01-2016, 00:54
ThomasClark's Avatar
ThomasClark ThomasClark is offline
Registered User
FRC #0237
 
Join Date: Dec 2012
Location: Watertown, CT
Posts: 146
ThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud of
Re: GRIP with USB Camera

Quote:
Originally Posted by Cobra Commander View Post
I think we are really close to getting this working!

What is setting property #16?

We are getting this error on our deploy:

Code:
Jan 27, 2016 1:53:36 AM edu.wpi.grip.core.Main start
INFO: Loading file /home/lvuser/project.grip
VIDEOIO ERROR: V4L/V4L2: VIDIOC_S_CROP
VIDEOIO ERROR: V4L: setting property #16 is not supported
Jan 27, 2016 1:53:40 AM edu.wpi.grip.core.Main start
INFO: SUCCESS! The project is running in headless mode!
Looking at the OpenCV source code, it seems like it has a lot of video capture properties available for V4L (the Linux video capture API), but most of them are only supported with V4L 2. If you're using V4L 1 and you try to set any property besides the few that are supported, OpenCV prints an error message

This is completely harmless. Since we don't do anything to manually configure camera settings in GRIP, any properties that get set are just by OpenCV trying to set up some defaults.

Is the project working otherwise? I noticed you have a SUCCESS message and no exceptions.
__________________
GRIP (Graphically Represented Image Processing) - rapidly develop computer vision algorithms for FRC
  #13   Spotlight this post!  
Unread 28-01-2016, 12:20
Crossle86's Avatar
Crossle86 Crossle86 is offline
Software Engineer
AKA: Richard Corn
FRC #4450 (Olympia Robotics Federation)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Olympia, WA.
Posts: 92
Crossle86 is an unknown quantity at this point
Re: GRIP with USB Camera

Quote:
Originally Posted by ThomasClark View Post
If you initialize the cameraserver in your robot program GRIP probably won't be able to access it. Usually only one application can access a camera at a time on Linux.

To get similar functionality as CameraServer, you can use the "Publish Video" operation in GRIP.
We did this but the feed to the DS was very slow, too slow to be useful.

Also, we have code that uses the NI camera support to switch the DS feed between multiple USB cameras...but we can't use it if GRIP is running. Is there some way or could a way be added for the robot code to feed images to GRIP instead of GRIP commandeering the camera? We are interested in GRIP but do not want to give up our existing camera server code.
  #14   Spotlight this post!  
Unread 28-01-2016, 16:14
joeojazz joeojazz is offline
Registered User
FRC #5712
 
Join Date: Jan 2016
Location: Hemlock
Posts: 42
joeojazz is an unknown quantity at this point
Re: GRIP with USB Camera

Figured it out that the drivers of the camera had not been fully downloaded. Thanks for your help.
  #15   Spotlight this post!  
Unread 26-01-2016, 15:23
vScourge's Avatar
vScourge vScourge is offline
Videogame Developer
AKA: Adam Pletcher
FRC #4096 (Ctrl-Z)
Team Role: Coach
 
Join Date: Jan 2014
Rookie Year: 2012
Location: Champaign, IL
Posts: 34
vScourge is on a distinguished road
Re: GRIP with USB Camera

Quote:
Originally Posted by nollchr View Post
Just curious if anyone has gotten GRIP to work on the RoboRIO using a USB camera. We have it running with the Axis IP camera, but the two MS lifecams we tried both throw that same error.
We haven't tried a USB camera with GRIP on the RoboRio. However, we've been going through some contortions to get it running on the Raspberry Pi 2, and that's also Linux and may share some problems/solutions?

We're using a Logitech C920 USB, and were initially unable to get it directly working with GRIP running on a RPi2. Not too surprising, since that platform isn't not officially supported by GRIP. However, there's an awesome thread on Github with a lot of great community activity getting GRIP onto RPi2.

With the info in that thread we were able to get that USB camera's feed published as an IP camera using mjpeg-streamer, which GRIP was then able to find and use on the RPi2, running Linux Arm. Might be something to try on the RoboRio?

We haven't yet verified GRIP is publishing stuff to NetworkTables, we hope to verify that tonight.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 04:17.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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