You've stolen the 128-bit encryption key to my heart.
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread Today, 10:33
ryan.mitchell ryan.mitchell is offline
Registered User
FRC #1512 (Big Red)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2015
Location: Middletown, Delaware
Posts: 18
ryan.mitchell is an unknown quantity at this point
HSV Value Of Green from Reflectant Tape

Hi everyone,

We are trying to set up our image analysis so that only the green from the light bouncing off the reflectant tape is shown, so the code(roughly) is:

Core.inRange(inputimage, scalar(h,s,v), scalar(h,s,v), hsv(output))

So does anyone happen to know what would be a good min scalar and max scalar hsv value to set so that only that particular colour would be revealed?

Also, while Im asking, anyone know how to do noise removal with openCV(java)?

Thanks,
Ryan
Reply With Quote
  #2   Spotlight this post!  
Unread Today, 10:36
SenorZ's Avatar
SenorZ SenorZ is online now
Physics Teacher
AKA: Tom Zook
FRC #4276 (Surf City Vikings)
Team Role: Teacher
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Huntington Beach, California
Posts: 962
SenorZ has a reputation beyond reputeSenorZ has a reputation beyond reputeSenorZ has a reputation beyond reputeSenorZ has a reputation beyond reputeSenorZ has a reputation beyond reputeSenorZ has a reputation beyond reputeSenorZ has a reputation beyond reputeSenorZ has a reputation beyond reputeSenorZ has a reputation beyond reputeSenorZ has a reputation beyond reputeSenorZ has a reputation beyond repute
Re: HSV Value Of Green from Reflectant Tape

I didn't personally handle this for our team, but we've used Grip to isolate the color from the video stream.
The color depends on what LED you're using so each team's might be a little different.
__________________
2013-present: FRC Team 4276, Surf City Vikings
2011-2012: FRC Team 3677, The Don Bots
Reply With Quote
  #3   Spotlight this post!  
Unread Today, 10:41
ryan.mitchell ryan.mitchell is offline
Registered User
FRC #1512 (Big Red)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2015
Location: Middletown, Delaware
Posts: 18
ryan.mitchell is an unknown quantity at this point
Re: HSV Value Of Green from Reflectant Tape

Quote:
Originally Posted by SenorZ View Post
I didn't personally handle this for our team, but we've used Grip to isolate the color from the video stream.
The color depends on what LED you're using so each team's might be a little different.
If you could go into the pipeline and see if it says the hsv value of the color that would be amazing. We are using a raspberry pi and so we are using the openCV library.
Reply With Quote
  #4   Spotlight this post!  
Unread Today, 10:43
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,390
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: HSV Value Of Green from Reflectant Tape

Your values will be dependent on multiple things specific to your illumination and camera set up. Using values from someone else's set up will leave you with less than desirable performance.
Your best bet is to gather specific values from your system that work.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
Reply With Quote
  #5   Spotlight this post!  
Unread Today, 10:46
ryan.mitchell ryan.mitchell is offline
Registered User
FRC #1512 (Big Red)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2015
Location: Middletown, Delaware
Posts: 18
ryan.mitchell is an unknown quantity at this point
Re: HSV Value Of Green from Reflectant Tape

Quote:
Originally Posted by billbo911 View Post
Your values will be dependent on multiple things specific to your illumination and camera set up. Using values from someone else's set up will leave you with less than desirable performance.
Your best bet is to gather specific values from your system that work.
Ok understood, any idea what the best way to gathering those values would be? Ie is there any software where I can have a webcam plugged in and then be told the hsv value of a color which ive selected? Or I suppose if there is any software which could tell me the hsv(or rgb...its translatable) values of a color in an image that would work also.
Reply With Quote
  #6   Spotlight this post!  
Unread Today, 11:19
virtuald's Avatar
virtuald virtuald is online now
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,117
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: HSV Value Of Green from Reflectant Tape

Quote:
Originally Posted by ryan.mitchell View Post
Ok understood, any idea what the best way to gathering those values would be? Ie is there any software where I can have a webcam plugged in and then be told the hsv value of a color which ive selected? Or I suppose if there is any software which could tell me the hsv(or rgb...its translatable) values of a color in an image that would work also.
You could save the image to a picture, and then use something like GIMP.

Or, make the threshold values tunable via networktables, and then send the video stream via cscore to your browser. Change the values, see the results in real time (just like GRIP).
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #7   Spotlight this post!  
Unread Today, 11:21
David Lame David Lame is offline
Registered User
FRC #0247
 
Join Date: Feb 2015
Location: Berkley, MI
Posts: 91
David Lame is a jewel in the roughDavid Lame is a jewel in the roughDavid Lame is a jewel in the roughDavid Lame is a jewel in the rough
Re: HSV Value Of Green from Reflectant Tape

GRIP is your friend.

Set up grip with your camera as the source, and your LED ring running. Add an HSV color filter, and display the output of those things. Adjust the sliders until you have all of what you want, and none of what you don't.

Well, you might not get to "all" and "none", depending on illumination, background, etc, but you should be able to get to a point where you have a big blob where that tape is, and a few patches of miscellaneous other spots that are not as big as the tape.

ETA: If you can't use your camera as a GRIP source for some reason (like in my case the camera is attached to a Rasp Pi), capture some still photos and import them into GRIP. And there are other ways to do this. I just use GRIP because it is very good, very free, and shared by the FIRST community so there will be lots of advice if you can't get it working.

Last edited by David Lame : Today at 11:25.
Reply With Quote
  #8   Spotlight this post!  
Unread Today, 11:38
jcbaker4050's Avatar
jcbaker4050 jcbaker4050 is offline
Registered User
AKA: John Baker
FRC #4050 (Biohazard)
Team Role: Mentor
 
Join Date: Dec 2016
Rookie Year: 2016
Location: Waynesboro, PA
Posts: 5
jcbaker4050 is an unknown quantity at this point
Re: HSV Value Of Green from Reflectant Tape

Quote:
Originally Posted by ryan.mitchell View Post
Ok understood, any idea what the best way to gathering those values would be? Ie is there any software where I can have a webcam plugged in and then be told the hsv value of a color which ive selected? Or I suppose if there is any software which could tell me the hsv(or rgb...its translatable) values of a color in an image that would work also.
GRIP will do this; however, the gotcha is that you'll need your source to be set to the same exposure that your camera will be when running on your RPi.

Team 4050 is new to vision this year, but what we've got so far seems to work reasonably well. We're using Java and OpenCV.

We wrote a basic program to run on a laptop that turns down the camera exposure (we used -10.0 for our Lifecam) and displays the webcam output to a JFrame. We used Alt-PrtScn hotkey to grab a shot of the window and then pasted it into Paint.NET as a new image. Crop out the window border and save it, and you've got a sample image to bring into GRIP. We did this for different distances and orientations to the gear lift.

Fire up GRIP, select the images as your source, and add the HSV Threshold operation to your pipeline. Adjust the HSV sliders to isolate the reflective tape as much as possible without too much degradation to the tape. At this point, you could simply record the start and end values of each of the sliders to get the HSV values that you'd want to use in your code.

Of course, you'd want to test in a real-world setting and probably make tweaks to the values, but the process I described should get you pretty close from the outset.

What we did was to build a full pipeline to do blurring, thresholding, eroding, and contour finding and then had GRIP generate the Java class for the pipeline (Tools > Generate Code).
Reply With Quote
  #9   Spotlight this post!  
Unread Today, 12:02
ryan.mitchell ryan.mitchell is offline
Registered User
FRC #1512 (Big Red)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2015
Location: Middletown, Delaware
Posts: 18
ryan.mitchell is an unknown quantity at this point
Re: HSV Value Of Green from Reflectant Tape

Quote:
Originally Posted by jcbaker4050 View Post
GRIP will do this; however, the gotcha is that you'll need your source to be set to the same exposure that your camera will be when running on your RPi.

Team 4050 is new to vision this year, but what we've got so far seems to work reasonably well. We're using Java and OpenCV.

We wrote a basic program to run on a laptop that turns down the camera exposure (we used -10.0 for our Lifecam) and displays the webcam output to a JFrame. We used Alt-PrtScn hotkey to grab a shot of the window and then pasted it into Paint.NET as a new image. Crop out the window border and save it, and you've got a sample image to bring into GRIP. We did this for different distances and orientations to the gear lift.

Fire up GRIP, select the images as your source, and add the HSV Threshold operation to your pipeline. Adjust the HSV sliders to isolate the reflective tape as much as possible without too much degradation to the tape. At this point, you could simply record the start and end values of each of the sliders to get the HSV values that you'd want to use in your code.

Of course, you'd want to test in a real-world setting and probably make tweaks to the values, but the process I described should get you pretty close from the outset.

What we did was to build a full pipeline to do blurring, thresholding, eroding, and contour finding and then had GRIP generate the Java class for the pipeline (Tools > Generate Code).
Awesome, ill give it a go!
Reply With Quote
  #10   Spotlight this post!  
Unread Today, 12:45
Classified*'s Avatar
Classified* Classified* is offline
Just grab a hacksaw and go.
AKA: Julia Cecchetti
FRC #0291 (CIA: Creativity in Action)
Team Role: Leadership
 
Join Date: Nov 2015
Rookie Year: 2015
Location: Erie PA
Posts: 63
Classified* will become famous soon enough
Re: HSV Value Of Green from Reflectant Tape

We use NI vision assistant to calibrate the thresholds. You can import the pictures into vision assistant straight from the LabVIEW Data folder, as the images from the robot are constantly temporarily saved in this folder. (I'm not sure if non-LabVIEW teams have something similar or not). Then adjust thresholds accordingly until you are satisfied! Screenshot.
__________________
Team291.com
Work smarter, not harder.
Reply With Quote
Reply


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 15:30.

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