Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Python (http://www.chiefdelphi.com/forums/forumdisplay.php?f=187)
-   -   OpenCV Python! Where to start? (http://www.chiefdelphi.com/forums/showthread.php?t=148297)

tomy 07-05-2016 11:15

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

virtuald 07-05-2016 12:50

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.

tomy 07-05-2016 12:53

Re: OpenCV Python! Where to start?
 
Quote:

Originally Posted by virtuald (Post 1584799)
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?

virtuald 07-05-2016 12:56

Re: OpenCV Python! Where to start?
 
Quote:

Originally Posted by tomy (Post 1584800)
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

tomy 07-05-2016 13:04

Re: OpenCV Python! Where to start?
 
Quote:

Originally Posted by virtuald (Post 1584801)
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)

virtuald 07-05-2016 13:06

Re: OpenCV Python! Where to start?
 
Quote:

Originally Posted by tomy (Post 1584802)
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.

Arhowk 07-05-2016 13:08

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

tomy 07-05-2016 13:10

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.

virtuald 07-05-2016 14:31

Re: OpenCV Python! Where to start?
 
Quote:

Originally Posted by tomy (Post 1584806)
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).

tomy 08-05-2016 10:51

Re: OpenCV Python! Where to start?
 
Quote:

Originally Posted by Arhowk (Post 1584805)
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?

Arhowk 09-05-2016 12:11

Re: OpenCV Python! Where to start?
 
Quote:

Originally Posted by tomy (Post 1584976)
Are you guys using grip with that code?

Both. The top section (unhighlighted) is for GRIP. The bottom (highlighted) section uses raw openCV

tomy 09-05-2016 18:16

Re: OpenCV Python! Where to start?
 
Quote:

Originally Posted by Arhowk (Post 1585257)
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??

Arhowk 09-05-2016 18:53

Re: OpenCV Python! Where to start?
 
Quote:

Originally Posted by tomy (Post 1585405)
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

tomy 09-05-2016 19:27

Re: OpenCV Python! Where to start?
 
Quote:

Originally Posted by Arhowk (Post 1585415)
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

I wrote some simple code to calibrate the camera in openCV using Track-bars. Would you like a copy of it? I haven't had time to implement it into working code yet I'm just using it to get the values for HSV and manually putting them into another part of code.

Arhowk 10-05-2016 08:08

Re: OpenCV Python! Where to start?
 
Quote:

Originally Posted by tomy (Post 1585421)
I wrote some simple code to calibrate the camera in openCV using Track-bars. Would you like a copy of it? I haven't had time to implement it into working code yet I'm just using it to get the values for HSV and manually putting them into another part of code.

This was my last year so I doubt I'll be able to make use of it. You can always post it on this sub forum if you think it merits use.


All times are GMT -5. The time now is 21:35.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi