|
|
|
| You may possess me without penalty. |
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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. |
|
#3
|
|||
|
|||
|
Re: HSV Value Of Green from Reflectant Tape
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.
|
|
#4
|
||||
|
||||
|
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. |
|
#5
|
|||
|
|||
|
Re: HSV Value Of Green from Reflectant Tape
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.
|
|
#6
|
||||
|
||||
|
Re: HSV Value Of Green from Reflectant Tape
Quote:
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). |
|
#7
|
|||
|
|||
|
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. |
|
#8
|
||||
|
||||
|
Re: HSV Value Of Green from Reflectant Tape
Quote:
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). |
|
#9
|
|||
|
|||
|
Re: HSV Value Of Green from Reflectant Tape
Quote:
|
|
#10
|
||||
|
||||
|
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.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|