Go to Post "And we will transform our schools and colleges and universities to meet the demands of a new age. All this we can do. And all this we will do." - OScubed [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 10-02-2014, 20:18
Crzycoco Crzycoco is offline
Co-Capt.
no team
 
Join Date: Dec 2012
Rookie Year: 1234
Location: C-Burg
Posts: 4
Crzycoco is an unknown quantity at this point
Unhappy How to get rectangles to display on Camera Dashboard

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!!
Reply With Quote
  #2   Spotlight this post!  
Unread 11-02-2014, 02:07
irvingc irvingc is offline
Registered User
FRC #0948 (Newport Robotics Group)
Team Role: Leadership
 
Join Date: Jan 2014
Rookie Year: 2011
Location: Bellevue, WA
Posts: 31
irvingc is on a distinguished road
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 11-02-2014, 12:58
Crzycoco Crzycoco is offline
Co-Capt.
no team
 
Join Date: Dec 2012
Rookie Year: 1234
Location: C-Burg
Posts: 4
Crzycoco is an unknown quantity at this point
Talking Re: How to get rectangles to display on Camera Dashboard

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!
Reply With Quote
  #4   Spotlight this post!  
Unread 11-02-2014, 17:01
Doctor Doctor is offline
Registered User
FRC #4011 (Pirhobotics)
Team Role: Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: wisconsin
Posts: 2
Doctor is an unknown quantity at this point
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.
Reply With Quote
  #5   Spotlight this post!  
Unread 11-02-2014, 18:24
irvingc irvingc is offline
Registered User
FRC #0948 (Newport Robotics Group)
Team Role: Leadership
 
Join Date: Jan 2014
Rookie Year: 2011
Location: Bellevue, WA
Posts: 31
irvingc is on a distinguished road
Re: How to get rectangles to display on Camera Dashboard

Quote:
Originally Posted by Crzycoco View Post
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!
The information about rectangle size and position is contained in the corresponding ParticleAnalysisReport object - there are four members we are interested in: boundingRectTop, boundingRectLeft, boundingRectHeight, and boundingRectWidth.

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);
}
Then, you can use this pattern in your widget to read from the same NetworkTable:
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");
Reply With Quote
  #6   Spotlight this post!  
Unread 11-02-2014, 21:12
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,748
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: 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
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 09:33.

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