Go to Post Thanks everyone for being so positive- this just reaffirms why I love F.I.R.S.T. and volunteer my time to this program and the awesome students involved! - Weightmn [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
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 18-01-2016, 18:57
MaxKelton MaxKelton is offline
Registered User
FRC #3070
 
Join Date: Jan 2016
Location: Shoreline
Posts: 2
MaxKelton is an unknown quantity at this point
Question Camera in Grayscale

How can I set my camera to output as a grayscale? I need to do this to reduce the bandwidth it uses for transmitting. if it makes a difference I am using a Microsoft LifeCam HD-3000
  #2   Spotlight this post!  
Unread 18-01-2016, 20:00
Ozuru's Avatar
Ozuru Ozuru is offline
It's always the programmer's fault.
no team
 
Join Date: May 2013
Rookie Year: 2010
Location: Earth
Posts: 268
Ozuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to behold
Re: Camera in Grayscale

I'm not an expert, but how would this decrease bandwidth usage? You're still sending the same information, except this time instead of a pixel being red it's just black.

If you're worried about bandwidth, I would look into capping the frames per second the camera transmits or the resolution. I know the Axis cameras had a configuration utility page that allowed this sort of customization.
  #3   Spotlight this post!  
Unread 18-01-2016, 20:09
vladtheimpaled's Avatar
vladtheimpaled vladtheimpaled is offline
Registered User
FRC #0810 (The Mechanical Bulls)
Team Role: Electrical
 
Join Date: Mar 2014
Rookie Year: 2014
Location: smithown
Posts: 40
vladtheimpaled is an unknown quantity at this point
Re: Camera in Grayscale

Quote:
Originally Posted by Ozuru View Post
I'm not an expert, but how would this decrease bandwidth usage? You're still sending the same information, except this time instead of a pixel being red it's just black.

If you're worried about bandwidth, I would look into capping the frames per second the camera transmits or the resolution. I know the Axis cameras had a configuration utility page that allowed this sort of customization.
If I'm not mistaken converting to grayscale reduces bandwidth because of the number of channels it transmits. With a standard rgb image, you have three channels per pixel. Each of these channels has value. For a grayscale image however you only have one channel. Now two extra channels on one pixel would not do much in terms of performance but once you have a few hundred extra it can especially when you try to get that image to send almost instantaneously .
  #4   Spotlight this post!  
Unread 18-01-2016, 20:23
Turing'sEgo Turing'sEgo is offline
Registered User
no team
 
Join Date: Jan 2016
Rookie Year: 2010
Location: Boulder
Posts: 47
Turing'sEgo can only hope to improve
Re: Camera in Grayscale

Quote:
Originally Posted by vladtheimpaled View Post
If I'm not mistaken converting to grayscale reduces bandwidth because of the number of channels it transmits. With a standard rgb image, you have three channels per pixel. Each of these channels has value. For a grayscale image however you only have one channel. Now two extra channels on one pixel would not do much in terms of performance but once you have a few hundred extra it can especially when you try to get that image to send almost instantaneously .
You are absolutely right. Converting to grayscale would reduce the amount of data being sent over the network by a factor of 3 if you are sending raw data.

There are a number of ways to convert from rgb to grayscale, what language/computer vision library are you using?
  #5   Spotlight this post!  
Unread 18-01-2016, 20:49
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Camera in Grayscale

The LabVIEW WPILib has a function to set the Color Enable Property. True means color is enabled. False means the camera is grayscale. But the property is only supported for Axis cameras. JPEGs have a special encoding for grayscale images, and they are indeed smaller than color, but it isn't as simple as a threeX ratio.

As mentioned by others, there are other effective ways to reduce bandwidth. Image resolution reduces by X squared. Framerate by X.

Greg McKaskle
  #6   Spotlight this post!  
Unread 19-01-2016, 17:21
Ozuru's Avatar
Ozuru Ozuru is offline
It's always the programmer's fault.
no team
 
Join Date: May 2013
Rookie Year: 2010
Location: Earth
Posts: 268
Ozuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to behold
Re: Camera in Grayscale

Quote:
Originally Posted by vladtheimpaled View Post
If I'm not mistaken converting to grayscale reduces bandwidth because of the number of channels it transmits. With a standard rgb image, you have three channels per pixel. Each of these channels has value. For a grayscale image however you only have one channel. Now two extra channels on one pixel would not do much in terms of performance but once you have a few hundred extra it can especially when you try to get that image to send almost instantaneously .
Yes, that is what I am saying. You are assuming that whoever wrote the firmware chose the most logical option and decided to only transmit one channel instead of three. How do you know that instead of transmitting (255, 255, 255) they are transmitting (0) and not (0, 0, 0)? While the image may appear grey, they is still a probable chance that they are just transmitting information the same way, this time with more zeroes.
  #7   Spotlight this post!  
Unread 19-01-2016, 20:53
adciv adciv is offline
One Eyed Man
FRC #0836 (RoboBees)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Southern Maryland
Posts: 478
adciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to all
Re: Camera in Grayscale

It's compressing to JPG before transmission across the network. That said, this will still reduce bandwidth requirement (although how much would require testing).

Before going this route, I'd recommend looking at reducing the resoultion & framerate if possible. I'm curious as to what is currently being used and what is required.
__________________
Quote:
Originally Posted by texarkana View Post
I would not want the task of devising a system that 50,000 very smart people try to outwit.
  #8   Spotlight this post!  
Unread 20-01-2016, 00:46
Turing'sEgo Turing'sEgo is offline
Registered User
no team
 
Join Date: Jan 2016
Rookie Year: 2010
Location: Boulder
Posts: 47
Turing'sEgo can only hope to improve
Re: Camera in Grayscale

Quote:
Originally Posted by adciv View Post
Before going this route, I'd recommend looking at reducing the resoultion & framerate if possible. I'm curious as to what is currently being used and what is required.
Another option would be to convert to HSV and then select which channel you want to process. That way you are still retaining information from RGB at 1/3 the data.
  #9   Spotlight this post!  
Unread 20-01-2016, 07:41
adciv adciv is offline
One Eyed Man
FRC #0836 (RoboBees)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Southern Maryland
Posts: 478
adciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to all
Re: Camera in Grayscale

I'd still be leery about that. The HD3000 can output images in JPG directly and use internal hardware compression. Any sort of post processing on the roboRIO would require compressing the image on the roboRIO and this will use up significant processor resources.
__________________
Quote:
Originally Posted by texarkana View Post
I would not want the task of devising a system that 50,000 very smart people try to outwit.
  #10   Spotlight this post!  
Unread 20-01-2016, 07:45
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Camera in Grayscale

To echo adciv. Potential options are great. But test them, as the real world isn't obliged to work the way you expected.

Greg McKaskle
  #11   Spotlight this post!  
Unread 20-01-2016, 08:49
James Juncker's Avatar
James Juncker James Juncker is offline
Broken Robot Fixer
FRC #2834 (Bionic Black Hawks)
Team Role: Driver
 
Join Date: Jan 2016
Rookie Year: 2012
Location: United States
Posts: 44
James Juncker will become famous soon enough
Re: Camera in Grayscale

If you are trying to use a camera for vision tracking I don't know that this will be able to still vision track across a gray scale as it may confuse similar objects for the reflected light. If this is for a drive camera for driver vision going around obstacles, I would highly recommend keeping the camera in color so that you know what exactly you are looking at. the best option to reduce bandwidth would be dropping the frames to about 15 FPS and lowering the resolution to about half of the area the camera will take up on your screen. this way you are still able to visually use and see with the camera as well as being able to tell whether that is a blue or red robot charging at you and whether or not they will stop. If it still becomes a bandwidth issue you can always reduce the FPS or resolution further to make the FTA's and Others happy.

Feel free to try grayscale though if you can figure it out, but I don't think it will be as effective as reducing frames and resolution.
__________________
The FRC season has 3 steps
Eat
Build
Play

It is important to note that sleep is not included in these steps.
  #12   Spotlight this post!  
Unread 20-01-2016, 09:42
dubiousSwain's Avatar
dubiousSwain dubiousSwain is offline
The ride never ends
AKA: Christian Steward
FRC #5420 (Velocity)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2011
Location: USA
Posts: 304
dubiousSwain has a reputation beyond reputedubiousSwain has a reputation beyond reputedubiousSwain has a reputation beyond reputedubiousSwain has a reputation beyond reputedubiousSwain has a reputation beyond reputedubiousSwain has a reputation beyond reputedubiousSwain has a reputation beyond reputedubiousSwain has a reputation beyond reputedubiousSwain has a reputation beyond reputedubiousSwain has a reputation beyond reputedubiousSwain has a reputation beyond repute
Re: Camera in Grayscale

Quote:
Originally Posted by Turing'sEgo View Post
You are absolutely right. Converting to grayscale would reduce the amount of data being sent over the network by a factor of 3 if you are sending raw data.
But you're not sending raw data, you're sending an MJPG. Its lossy compression, and the difference between color and grayscale will be negligible compared to bumping up the compression a bit
__________________
2015 MAR District Champions




  #13   Spotlight this post!  
Unread 22-01-2016, 16:47
Ozuru's Avatar
Ozuru Ozuru is offline
It's always the programmer's fault.
no team
 
Join Date: May 2013
Rookie Year: 2010
Location: Earth
Posts: 268
Ozuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to behold
Re: Camera in Grayscale

Quote:
Originally Posted by dubiousSwain View Post
But you're not sending raw data, you're sending an MJPG. Its lossy compression, and the difference between color and grayscale will be negligible compared to bumping up the compression a bit
Exactly.
  #14   Spotlight this post!  
Unread 22-01-2016, 17:07
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Camera in Grayscale

I don't have time to do the side-by-side compare, but if you use an IP camera such as Axis and flip between color enable of true and false, you will see the difference. JPEG has a special definition for encoding Y only images and it is another way to reduce size. You are deciding whether you lose color and retain detail or lose color and detail by lowering compression. The other lever you can pull is the resolution or size of the image. The final lever is the framerate.

Experiment and make sure the drivers understand how to pull the levers for themselves. The default dashboard gives an LED indicator showing how their usage compares to the field limits. Also, I personally don't have much experience with the new radio and bandwidth limiting, but I expect that the radio will cause the equivalent of framerate limiting if you don't pull the levers to get your usage under the limit. I don't expect the cameras to hog bandwidth the way they were able to in past years.

Greg McKaskle
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 13:43.

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