Go to Post FIRST competitions ARE holidays, or they should be at least. - Kel D [more]
Home
Go Back   Chief Delphi > Technical > Programming > Python
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 07-05-2016, 11:15
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 490
tomy has a spectacular aura abouttomy has a spectacular aura about
OpenCV Python! Where to start?

I have openCV installed with python but all the tutorials I am finding expect you to know a bunch of prior knowledge. Anyone have a good spot for a newbie to start. I have no prior knowledge of vision tracking or how it works. Thanks for you help.

Tomy
Reply With Quote
  #2   Spotlight this post!  
Unread 07-05-2016, 12:50
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,032
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: OpenCV Python! Where to start?

There's a lot to learn about image processing in general.

I recommend the OpenCV tutorials/walkthroughs. Additionally, there are a bunch of examples distributed in the OpenCV source tree -- try to run them locally and see what they do, and then modify them in small ways.

Once you've done that, then I recommend reading various FIRST-related image processing whitepapers and related code (search ChiefDelphi for these), to get a feel for what types of techniques you can use to accomplish the tasks you need to accomplish.

You may find that GRIP is a useful tool (I haven't used it, but it looks promising) to experiment with image processing techniques and such. In particular, screensteps has a walkthrough on how to do image processing for the 2016 game using GRIP.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #3   Spotlight this post!  
Unread 07-05-2016, 12:53
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 490
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: OpenCV Python! Where to start?

Quote:
Originally Posted by virtuald View Post
There's a lot to learn about image processing in general.

I recommend the OpenCV tutorials/walkthroughs. Additionally, there are a bunch of examples distributed in the OpenCV source tree -- try to run them locally and see what they do, and then modify them in small ways.

Once you've done that, then I recommend reading various FIRST-related image processing whitepapers and related code (search ChiefDelphi for these), to get a feel for what types of techniques you can use to accomplish the tasks you need to accomplish.

You may find that GRIP is a useful tool (I haven't used it, but it looks promising) to experiment with image processing techniques and such. In particular, screensteps has a walkthrough on how to do image processing for the 2016 game using GRIP.

Thank you. I've poked around with grip would you do the same processes as grip pip line? (Resize -> HSV/HSL -> Find Contours -> Filter Controus -> Pusblish to network table)

What is the difference between HSV and HSL?
Reply With Quote
  #4   Spotlight this post!  
Unread 07-05-2016, 12:56
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,032
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: OpenCV Python! Where to start?

Quote:
Originally Posted by tomy View Post
Thank you. I've poked around with grip would you do the same processes as grip pip line? (Resize -> HSV/HSL -> Find Contours -> Filter Controus -> Pusblish to network table)
Yes, GRIP uses OpenCV underneath the hood, so a lot of the things that you can do with GRIP will easily map to OpenCV operations of some kind -- it just might add some extra magic to make it easier to use.

Quote:
What is the difference between HSV and HSL?
https://en.wikipedia.org/wiki/HSL_and_HSV
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #5   Spotlight this post!  
Unread 07-05-2016, 13:04
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 490
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: OpenCV Python! Where to start?

Quote:
Originally Posted by virtuald View Post
Yes, GRIP uses OpenCV underneath the hood, so a lot of the things that you can do with GRIP will easily map to OpenCV operations of some kind -- it just might add some extra magic to make it easier to use.



https://en.wikipedia.org/wiki/HSL_and_HSV

Thanks for the in - site. Is the method I described before the best way to do vision tracking with openCV?

-(Resize -> HSV/HSL -> Find Contours -> Filter Controus -> Pusblish to network table)
Reply With Quote
  #6   Spotlight this post!  
Unread 07-05-2016, 13:06
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,032
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: OpenCV Python! Where to start?

Quote:
Originally Posted by tomy View Post
Thanks for the in - site. Is the method I described before the best way to do vision tracking with openCV?

-(Resize -> HSV/HSL -> Find Contours -> Filter Controus -> Pusblish to network table)
Generally speaking, that is the methodology we've used for image processing the last few years.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #7   Spotlight this post!  
Unread 07-05-2016, 13:08
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 542
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: OpenCV Python! Where to start?

Here's our OpenCV Python code... The numbers it gave me were always wrong but I think thats just because it wasn't tuned...

https://github.com/1684Chimeras/VEX_...a.py#L109-L207

note that line 150 doesn't error out but doesn't do anything either for some reason

and lines 126-143 are specific for grabbing an axis camera image
__________________
FRC Team 1684 - Head Programmer (2013-2016)
FRC Team 5460 - Programming Mentor (2015-2016)

FIRST in Michigan - Technical Crew (2015-continuing)

Last edited by Arhowk : 07-05-2016 at 13:11.
Reply With Quote
  #8   Spotlight this post!  
Unread 08-05-2016, 10:51
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 490
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: OpenCV Python! Where to start?

Quote:
Originally Posted by Arhowk View Post
Here's our OpenCV Python code... The numbers it gave me were always wrong but I think thats just because it wasn't tuned...

https://github.com/1684Chimeras/VEX_...a.py#L109-L207

note that line 150 doesn't error out but doesn't do anything either for some reason

and lines 126-143 are specific for grabbing an axis camera image
Are you guys using grip with that code?
Reply With Quote
  #9   Spotlight this post!  
Unread 09-05-2016, 12:11
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 542
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: OpenCV Python! Where to start?

Quote:
Originally Posted by tomy View Post
Are you guys using grip with that code?
Both. The top section (unhighlighted) is for GRIP. The bottom (highlighted) section uses raw openCV
__________________
FRC Team 1684 - Head Programmer (2013-2016)
FRC Team 5460 - Programming Mentor (2015-2016)

FIRST in Michigan - Technical Crew (2015-continuing)
Reply With Quote
  #10   Spotlight this post!  
Unread 09-05-2016, 18:16
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 490
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: OpenCV Python! Where to start?

Quote:
Originally Posted by Arhowk View Post
Both. The top section (unhighlighted) is for GRIP. The bottom (highlighted) section uses raw openCV
Interesting. Thank you for the code by the way it has helped me a lot. Do you use GRIP and open-CV in tandem??
Reply With Quote
  #11   Spotlight this post!  
Unread 09-05-2016, 18:53
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 542
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: OpenCV Python! Where to start?

Quote:
Originally Posted by tomy View Post
Interesting. Thank you for the code by the way it has helped me a lot. Do you use GRIP and open-CV in tandem??


We calibrate with the GRIP than transpose those values over to OpenCV. Since the grip is already calibrated, there's a GRIP fallback option in case OpenCV failed
__________________
FRC Team 1684 - Head Programmer (2013-2016)
FRC Team 5460 - Programming Mentor (2015-2016)

FIRST in Michigan - Technical Crew (2015-continuing)
Reply With Quote
  #12   Spotlight this post!  
Unread 10-05-2016, 22:08
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 490
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: OpenCV Python! Where to start?

Quote:
Originally Posted by Arhowk View Post
Here's our OpenCV Python code... The numbers it gave me were always wrong but I think thats just because it wasn't tuned...

https://github.com/1684Chimeras/VEX_...a.py#L109-L207

note that line 150 doesn't error out but doesn't do anything either for some reason

and lines 126-143 are specific for grabbing an axis camera image
I just finished up my simple vision tracking and it is sole based off your code. Thank you. Also if you could let me know what you think.

http://pastebin.com/h4kjdz0W
Reply With Quote
  #13   Spotlight this post!  
Unread 13-09-2016, 18:48
RadhikaTheFish's Avatar
RadhikaTheFish RadhikaTheFish is offline
Registered User
FRC #3815
 
Join Date: Jan 2016
Location: Georgia
Posts: 26
RadhikaTheFish is an unknown quantity at this point
Re: OpenCV Python! Where to start?

Thanks,
Reply With Quote
  #14   Spotlight this post!  
Unread 07-05-2016, 13:10
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 490
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: OpenCV Python! Where to start?

Do you have any other tips? How to deal with lag or with blurry images? I've heard that has been a problem.
Reply With Quote
  #15   Spotlight this post!  
Unread 07-05-2016, 14:31
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,032
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: OpenCV Python! Where to start?

Quote:
Originally Posted by tomy View Post
Do you have any other tips? How to deal with lag or with blurry images? I've heard that has been a problem.
See this thread (presentation by team 254 at championship conferences).
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
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 21:35.

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