|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello fellow robotics comrades!
Our team is programming in Java this year and we decided to utilize Vision Processing our camera (Axis M1011). We have our green LED ring hook up on our camera and we got the code for Vision Processing from the Sample Project found in this years java sources. We adjusted the HSV using NI Vision and our camera is able to find the reflective tape that we measured precisely to what the reflective tape is going to be like in the competition. We confirmed this by putting a smartDashboard out for the method hotOrNot() since it returns a boolean whether the target is found. So tl;dr our code works. So basically, how do I get rectangles to show around the reflective tape our driverstation? Kinda like this. Do we need to download some sort of dashboard ti download or add code for it to be able to? Please guide us the way!! Go US First!! ![]() |
|
#2
|
|||
|
|||
|
Re: How to get rectangles to display on Camera Dashboard
One possibility (what we did last year) - in your image processing code, push the information about rectangles (position, size) into a NetworkTable. Then, write a SmartDashboard widget with a transparent background that reads this information and draws rectangles. Manually drag this overlay to align with the camera feed.
|
|
#3
|
|||
|
|||
|
Thanks! I was able to make a widget that creates the rectangle but I don't know the variable from the camera code that determines the width and height of the reflective tape as seen by the camera. I also don't know the variable that returns the x and y coordinates of the where the reflective tape is located as seen from the camera. Any help is greatly appreciated!
![]() |
|
#4
|
|||
|
|||
|
Re: How to get rectangles to display on Camera Dashboard
So we are hosting a practice scrimmage and we attempted using tape from other years. The new could be picked up immediately, but the old did not even register. We are wondering if it was the spray adhesive we used to attached to the board or if it is a different makeup from the new tape.
|
|
#5
|
|||
|
|||
|
Re: How to get rectangles to display on Camera Dashboard
Quote:
Looking at the sample vision project, you can do this in the conditional where it checks for a hot target. Something along the lines of: Code:
if(target.Hot)
{
System.out.println("Hot target located");
System.out.println("Distance: " + distance);
NetworkTable table = NetworkTable.getTable("VisionTarget");
ParticleAnalysisReport verticalReport = filteredImage.getParticleAnalysisReport(target.verticalIndex);
ParticleAnalysisReport horizontalReport = filteredImage.getParticleAnalysisReport(target.horizontalIndex);
table.putNumber("vertTop", verticalReport.boundingRectTop);
table.putNumber("vertLeft", verticalReport.boundingRectLeft);
table.putNumber("vertHeight", verticalReport.boundingRectHeight);
table.putNumber("vertWidth", verticalReport.boundingRectWidth);
table.putNumber("horzTop", horizontalReport.boundingRectTop);
table.putNumber("horzLeft", horizontalReport.boundingRectLeft);
table.putNumber("horzHeight", horizontalReport.boundingRectHeight);
table.putNumber("horzWidth", horizontalReport.boundingRectWidth);
} else {
System.out.println("No hot target present");
System.out.println("Distance: " + distance);
}
Code:
ITable table = table = (NetworkTable) Robot.getTable("VisionTarget");
int top = (int) table.getNumber("vertTop");
int left = (int) table.getNumber("vertLeft");
int width = (int) table.getNumber("vertWidth");
int height = (int) table.getNumber("vertHeight");
|
|
#6
|
|||
|
|||
|
Re: How to get rectangles to display on Camera Dashboard
If you want to verify the tape's retro-reflectivity, a cell phone with the flash turned on works quite well. I use this at events to identify if any other materials in the arena are retroreflective and need to be covered.
You can put the two types of tape near one another and verify whether the tape is the issue. They should shine super-bright. Technically, they should be about 300 times brighter than a white paint sample, but that will be hard to verify. Similarly, an image of the two tapes near one another using the ring light and the Axis camera is an even better test for what the robots will measure. Greg McKaskle |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|