Go to Post You will "generously donate" your game pieces into your opponent's goal. - johnr [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 28-01-2017, 11:02
wwalcher wwalcher is offline
Registered User
FRC #4511
 
Join Date: Jan 2017
Location: Minnesota
Posts: 5
wwalcher is an unknown quantity at this point
How do you draw a bounding box using GRIP?

Hey there!

I've managed get my GRIP pipeline working, and have successfully manipulated the data from NetworkTables in our Java program to detect the distance from the targets on the sides of the gear hook.
However, I now want to actually use the vision data to determine how the robot drives. Since there are two targets being detected, I felt it would make sense to draw a bounding box around the two and use the center of the bounding box as my target for the hook (as it should be approximately in the middle of the bounding rectangle). I figured that GRIP would have the ability to draw a bounding box, but lo and behold, it does not. So, I figure I can use OpenCV to do this using the boundingRect() method, but my question is: How do I do this? Is there a way for me to access the actual OpenCV code being generated by GRIP and add in the boundingRect() method?
Any help would be greatly appreciated!

Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 28-01-2017, 12:05
Sl3dman's Avatar
Sl3dman Sl3dman is offline
Registered User
FRC #1339 (Angelbots)
Team Role: Programmer
 
Join Date: Nov 2014
Rookie Year: 2015
Location: Colorado
Posts: 6
Sl3dman is an unknown quantity at this point
Re: How do you draw a bounding box using GRIP?

So we are using the GRIP generated code on our roboRIO and we encountered the same problem. We tried blurring the image to turn what we detected into one large blob, but that didn't work as well as we had hoped. What we settled on was looking at each of the contours and then averaging the x values of both in order to find the x coordinates between the pieces of tape.
__________________
"It works when its not broken."
Reply With Quote
  #3   Spotlight this post!  
Unread 28-01-2017, 12: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: 149
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: How do you draw a bounding box using GRIP?

NTPublish ContoursReport publishes based on the contour bounding boxes
__________________
WPILib
GRIP, RobotBuilder
Reply With Quote
  #4   Spotlight this post!  
Unread 28-01-2017, 13:10
Storcky's Avatar
Storcky Storcky is offline
Registered User
FRC #3634 (Hard Botties)
Team Role: Mentor
 
Join Date: Apr 2005
Rookie Year: 2005
Location: Oakland, MD
Posts: 128
Storcky is on a distinguished road
Re: How do you draw a bounding box using GRIP?

The wpilib vision tutorial uses a bounding box: https://wpilib.screenstepslive.com/s...-robot-program

Is that what you're looking for?
__________________
Alum of 1629 - GaCo [2005-2008]
Mentor for 3634 - Hard Botties [2013-2015]
Mentor for 230 - Gaelhawks [2013-2015]
Pittsburgh Regional Planning Committee [2016-?]
Reply With Quote
  #5   Spotlight this post!  
Unread 28-01-2017, 15:22
wwalcher wwalcher is offline
Registered User
FRC #4511
 
Join Date: Jan 2017
Location: Minnesota
Posts: 5
wwalcher is an unknown quantity at this point
Re: How do you draw a bounding box using GRIP?

Yeah, this was sort of what I was thinking, but I was hoping I would be able to draw a big bounding rectangle around the two contours. Guess I'll have to give this a go instead. Thanks!
Reply With Quote
  #6   Spotlight this post!  
Unread 28-01-2017, 15:29
Bradley Boxer's Avatar
Bradley Boxer Bradley Boxer is offline
Registered User
AKA: Bradley Boxer
FRC #0303 (TEST Team 303)
Team Role: Programmer
 
Join Date: May 2015
Rookie Year: 2015
Location: United States
Posts: 26
Bradley Boxer is an unknown quantity at this point
Re: How do you draw a bounding box using GRIP?

To draw a bounding box between two contours, you would just have to pick points on the contours and feed them into the boundingRect() method. Alternatively, you can draw it onto an existing Mat with the Imgproc.Rectangle() method. My team did this in our GRIP Camera code, however it is generated and not deployed to the Rio. Feel free to take a look at it here.
__________________
The opinions expressed in this post are mine and do not necessarily reflect those of my team.

Last edited by Bradley Boxer : 28-01-2017 at 15:32. Reason: grammar
Reply With Quote
  #7   Spotlight this post!  
Unread 28-01-2017, 20:20
cad321 cad321 is offline
Jack of all trades, Master of none
AKA: Brian Wagg
FRC #2386 (Trojans)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Burlington, Ontario
Posts: 350
cad321 is just really nicecad321 is just really nicecad321 is just really nicecad321 is just really nice
Re: How do you draw a bounding box using GRIP?

Is there anyway one could do this directly in GRIP? We are using a mini windows PC on the robot this year running grip (so no auto gen code). I've looked but have yet to been able to find a way to do this directly in GRIP.
Reply With Quote
  #8   Spotlight this post!  
Unread 28-01-2017, 20:23
ollien ollien is offline
Registered User
FRC #5202
 
Join Date: Feb 2015
Location: United States
Posts: 341
ollien is just really niceollien is just really niceollien is just really niceollien is just really nice
Re: How do you draw a bounding box using GRIP?

Quote:
Originally Posted by cad321 View Post
Is there anyway one could do this directly in GRIP? We are using a mini windows PC on the robot this year running grip (so no auto gen code). I've looked but have yet to been able to find a way to do this directly in GRIP.
Why no auto gen code? It's an option in GRIP.
Reply With Quote
  #9   Spotlight this post!  
Unread 28-01-2017, 20:28
cad321 cad321 is offline
Jack of all trades, Master of none
AKA: Brian Wagg
FRC #2386 (Trojans)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Burlington, Ontario
Posts: 350
cad321 is just really nicecad321 is just really nicecad321 is just really nicecad321 is just really nice
Re: How do you draw a bounding box using GRIP?

Quote:
Originally Posted by ollien View Post
Why no auto gen code? It's an option in GRIP.
If I auto Gen code, how would I go about running it in a windows environment. I am not overly familiar with programming and vision in particular, hence why I ask.
Reply With Quote
  #10   Spotlight this post!  
Unread 28-01-2017, 21:07
ollien ollien is offline
Registered User
FRC #5202
 
Join Date: Feb 2015
Location: United States
Posts: 341
ollien is just really niceollien is just really niceollien is just really niceollien is just really nice
Re: How do you draw a bounding box using GRIP?

Quote:
Originally Posted by cad321 View Post
If I auto Gen code, how would I go about running it in a windows environment. I am not overly familiar with programming and vision in particular, hence why I ask.
You don't. You run it on your roborio/on a co-processor.
Reply With Quote
  #11   Spotlight this post!  
Unread 28-01-2017, 21:31
cad321 cad321 is offline
Jack of all trades, Master of none
AKA: Brian Wagg
FRC #2386 (Trojans)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Burlington, Ontario
Posts: 350
cad321 is just really nicecad321 is just really nicecad321 is just really nicecad321 is just really nice
Re: How do you draw a bounding box using GRIP?

Quote:
Originally Posted by ollien View Post
You don't. You run it on your roborio/on a co-processor.
My co-processor is running a Windows enviroment though... Directly on the robot, not the driver station. So back to the original question of, Is there anyway one could do this directly in GRIP in a Windows environment? At this point I'm guessing the answer is no.
Reply With Quote
  #12   Spotlight this post!  
Unread 29-01-2017, 10:31
wlogeais wlogeais is offline
Registered User
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2016
Rookie Year: 2011
Location: Minnesota
Posts: 18
wlogeais is an unknown quantity at this point
Re: How do you draw a bounding box using GRIP?

Quote:
Originally Posted by cad321 View Post
My co-processor is running a Windows enviroment though... Directly on the robot, not the driver station. So back to the original question of, Is there anyway one could do this directly in GRIP in a Windows environment? At this point I'm guessing the answer is no.
Our team worked with this last year - I'd expect it is still perfectly valid.
http://github.com/WPIRoboticsProject...board/releases

This year the team is well on its way to a generated-code based autonomous, with the grip-pipeline running on the rio - so no extra weight, nor space. And the improvement over last year is potential for thread/input control for 2 cameras. The generate-code instructions are all there in screensteps.
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 14:51.

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