Go to Post It looks like you put a robot through a paper shredder. - Madwolvez [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


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 11:08.

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