View Full Version : 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
There's a lot to learn about image processing in general. :)
I recommend the OpenCV tutorials/walkthroughs (http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_tutorials.html). Additionally, there are a bunch of examples distributed in the OpenCV source tree (https://github.com/Itseez/opencv/tree/master/samples/python) -- 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 (https://wpilib.screenstepslive.com/s/4485/m/50711/l/481750-using-grip-for-the-2016-game).
There's a lot to learn about image processing in general. :)
I recommend the OpenCV tutorials/walkthroughs (http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_tutorials.html). Additionally, there are a bunch of examples distributed in the OpenCV source tree (https://github.com/Itseez/opencv/tree/master/samples/python) -- 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 (https://wpilib.screenstepslive.com/s/4485/m/50711/l/481750-using-grip-for-the-2016-game).
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
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.
What is the difference between HSV and HSL?
https://en.wikipedia.org/wiki/HSL_and_HSV
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
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.
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_1684A/blob/master/2016CompetitionRobot/src/modules/camera.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
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
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 (http://www.chiefdelphi.com/forums/showthread.php?t=147568&page=3) (presentation by team 254 at championship conferences).
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_1684A/blob/master/2016CompetitionRobot/src/modules/camera.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?
Are you guys using grip with that code?
Both. The top section (unhighlighted) is for GRIP. The bottom (highlighted) section uses raw openCV
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??
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
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.
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.
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.
I think I will at some point maybe towards the begging of the season such that we can use it next year.
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_1684A/blob/master/2016CompetitionRobot/src/modules/camera.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
RadhikaTheFish
13-09-2016, 18:48
Thanks,
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.