Go to Post Ahhh. The Grammar Fairy strikes again! - Cynette [more]
Home
Go Back   Chief Delphi > Technical > Programming
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 Yesterday, 16:55
Hibiki Hibiki is offline
Registered User
FRC #2659
 
Join Date: Feb 2017
Location: LA
Posts: 1
Hibiki is an unknown quantity at this point
Need help with running GRIP on roboRIO

This is the first time for me to do vision process on our robot.

So far I figured out how to generate C++ code from GRIP. However, I don't know how can I get the values from the contours report without publishing the report to a network table. Are there methods that return those values or are they stored somewhere after the process?

Appreciation for any help!
Reply With Quote
  #2   Spotlight this post!  
Unread Yesterday, 18:53
SamCarlberg's Avatar
SamCarlberg SamCarlberg is offline
GRIP, WPILib. 2084 alum
FRC #2084
Team Role: Mentor
 
Join Date: Nov 2015
Rookie Year: 2009
Location: MA
Posts: 164
SamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to behold
Re: Need help with running GRIP on roboRIO

The class that GRIP generates has methods for getting the outputs of every step. The last step (probably findContours or filterContours) is probably the one you want. You can get that output with GetFindContoursOutput or GetFilterContoursOutput, if you have it. This'll give you a std::vector of the contours. If you want to get the positions of each contour like GRIP does, you need to loop over them and call boundingRect on each one that you can use to find the centers.


Here's a little code snippet that can help. I haven't compiled or run this, but it should get you going.

Code:
auto contours = myGripPipeline.GetFilterContoursOutput();
std::vector<cv::Point> centers;

for (int i = 0; i < contours.size(); i++) {
  cv::Rect r = cv::boundingRect(contours[i]);
  int centerX = r.x + r.width / 2;
  int centerY = r.y + r.height / 2;
  centers.push_back(cv::Point(centerX, centerY));
}
__________________
WPILib
GRIP, RobotBuilder
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 06:15.

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