Implementing your own Vision System
If you would like to explore vision from the lower-level, and you would like to keep it tighty integrated with Python, then this section will show you how. You might want to read the section PythonAndC at some point.
If you don't need it to be tightly integrated with Python, then you just need to make your code callable from Python. The Phission vision system (see Pyro Vision Functions using Phission) is an example of this style, although it is tied to the Video4Linux subsystem. All you need do for this method is wrap your C or C++ code using SWIG. See PythonAndC for more details.
The rest of this section describes an example template for the integrated Python vision system. It is designed to work with any camera type in Pyro, including: Video4Linux, FakeCamera (simulated camera from image files), BlobCamera (simulated camera in the Stage simulator), GazeboCamera (OpenGL camera in the Gazebo simulator), and RobocupCamera (simulated camera for the Robocup simulator).
Example Vision System
There is a simple C++ based vision system (image processing) template that comes with Pyro. To build it:
export PYROBOT=/usr/local/pyrobot cp -r $PYROBOT/vision/example myexample cd myexample make
In Pyro versions prior to 3.2.1, you may need to remove the unneeded PYTHON_INCLUDE line in the Makefile in that subdirectory. It is not necessary. There is another in the $PYROBOT/Makefile. You may also want to get the latest version of myVision.cpp. You can get it here.
To make changes, edit myVision.cpp and then rerun make to rebuild. You can add any kind of image processing code here.
To use from inside Pyro, start a robot (the Test robot is useful for this---you can also start it up on the command line pyro -r Test), and simply select this device from the Load menu under Devices.... You'll need to change directories (select Home in the upper right-hand corner of the load window, then select myexample).
You'll see a window popup, and the Filters menu is filled-in with the functions from your myexample/myVision.cpp.
You'll see the functions getMenu() and applyFilter() in myVision.cpp. They are the functions that add items to the menu, and execute their selection, respectively.
TODO: We'll try to add more detail here. Please add comments or questions.
Pyro Modules Table of Contents