View Single Post
  #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