View Full Version : opencv a place to start
cpapplefamily
28-05-2015, 22:49
I wish to start learning opencv. In the end does all the code in a frc environment run on the roborio. I have a raspberrypi and thought i would run some test with that only the RPI traditionally runs python. Our team is Java. Maybe i could just run the code on my window pc using my web cam to closely emulate what would be on the rio come next season. What suggestions do you have for me without a rio all summer.
faust1706
28-05-2015, 22:54
Put opencv on a computer, preferably a similar OS that you will be running on (looks like a linux distro, I prefer ubuntu), then install opencv. I find that 2.4.10 is more friendly that their 3.0 release, but that is just me.
Here is a presentation that my team gives to others who are interested. If you have any questions, don't hesistate to ask. I have a bunch of c++ code with opencv that I'd be willing to port over to java for you if you're interested. These codes would be our team's award winning vision solutions along with plenty of data for you to explore with.
Presentation with the just the functions:
https://www.dropbox.com/s/0fa2ctzibu6c4wi/vision%20presentation.ppt?dl=0
Presentation with explainations of what is happening:
https://www.dropbox.com/s/8652pai3epv9bdu/presentation%20for%20research.ppt?dl=0
cpapplefamily
28-05-2015, 23:09
If I'm reading your suggestion i should test the opencv programming on my Ubuntu partitioned laptop This way i can stay in the java language. I have seen loads of code to procces through i just want to be sure as I'm teaching my self how to use it that I'm not ....hate to say waist..... a bunch of time in a language i will not be using. My trouble is i don't spend enough time in one language to GREAT. Arduino C, Raspberrypi Python, now FRC Java. Do teams often offload the vision to other processors like pi's? Will the gearsbot simulator run vision?
Thank for the start.
TheHolyHades1
28-05-2015, 23:45
If I'm reading your suggestion i should test the opencv programming on my Ubuntu partitioned laptop This way i can stay in the java language. I have seen loads of code to procces through i just want to be sure as I'm teaching my self how to use it that I'm not ....hate to say waist..... a bunch of time in a language i will not be using. My trouble is i don't spend enough time in one language to GREAT. Arduino C, Raspberrypi Python, now FRC Java. Do teams often offload the vision to other processors like pi's? Will the gearsbot simulator run vision?
Thank for the start.
Hey,
It really depends on what your team is using, and what you're feeling comfortable with. I know it's *possible* to run vision code on the roborio, but as the system is new, you'll likely be able to find greater support if you offload the computation to a coprocessor, like a raspi as you mentioned.
The raspi is a linux system, so writing your code on an Ubuntu partition is recommended for similarity of the systems. That, and it's *significantly* easier to get all of the dependencies installed in the Ubuntu system vs the windows one. As for language, there exist openCV ports for a variety of languages. The "primary" one is the C++ version, but there exist C and Python versions at the very least, and I'm sure ports exist for Java and others. The nice thing about these ports is that the functions are essentially the same among the languages - the Python and C++ version, for example, have the same function names with slightly differing parameters (by type). So, learning opencv in a particular language should let you port your code to another language quite quickly, and your effort won't really be wasted by any means.
So, my recommendation would be to pick the language that your team uses for their overall code (that is, pick between Java and C++). If you choose the other, you still can't really go wrong.
EDIT: Just read that your team runs Java. So choose Java.
If you are using the RPi I would suggest staying away from Java/Python, the overhead would make vision processing a pain. Try C++. A few years ago, MORT stripped down a laptop and put it on the robot, it's surprisingly straight forward and not as heavy as one might think. I believe there is a way to use network tables and actually do all your processing on the driver station itself. Just send the data from the robot to a client program on your DS, analyze it there, and send it back.
Feel free to message me about questions or if you want to see code!
F22Rapture
03-06-2015, 16:27
If you are using the RPi I would suggest staying away from Java/Python, the overhead would make vision processing a pain. Try C++. A few years ago, MORT stripped down a laptop and put it on the robot, it's surprisingly straight forward and not as heavy as one might think. I believe there is a way to use network tables and actually do all your processing on the driver station itself. Just send the data from the robot to a client program on your DS, analyze it there, and send it back.
Feel free to message me about questions or if you want to see code!
Not really true. I'm not sure about the Java bindings for OpenCV, but the Python bindings only have an overhead of something like 15%. All of the work is still being done in the same native code.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.