In the past the Imaginghub already referred to a number of projects (e.g. the Raspberry Pi Face Detection), which made use of a Python wrapper around the pylon camera SDK called pypylon. This wrapper however was a kind of alpha version and closed source. Now, pypylon has been approved by Basler and was published as an Open Source project on GitHub - a number of programming samples included.
The advantages of a python wrapper around the camera SDK are obvious: it lets new and experienced Python programmers quickly and conveniently develop prototype applications and test Basler cameras without needing to set up a complex development environment. This not only speeds up the camera evaluation process significantly, but also increases the productivity and lowers the total project costs. In addition, it can be used with interactive rapid prototyping tools like Jupyter Notebook etc.
Python is a dynamic, object-oriented and multipurpose programming language designed to be quick to understand, learn and use. The syntax in Python helps programmers do coding in fewer steps, as compared to Java, VB, C, C++ or C#. Python's extensive library of open-source image processing libraries (e.g. Open CV), data analysis tools, web frameworks, and testing instruments makes its ecosystem one of the largest of any programming community.
How to get started?
Getting started with pypylon is very easy. Of course, Python needs to be installed. It is recommend to always use Python 3 in its newest version. In addition, you simply need to download the pylon Camera Software Suite, which suits your operating system from the Basler website. After this you need to install pypylon with
$ pip install pypylon
for python 2.x or
$ pip3 install pypylon
for python 3.x
This will automatically download the pypylon binary (wheel) which fits to your OS, Python, and your pylon version from pypi. You may alternatively also download pypylon wheels from GitHub and install the downloaded wheel with pip or pip3 respectively:
$ pip3 install<pypylon_wheel_file_name>
In this case, you must make sure by yourself that you download a wheel, which suits your OS, pylon and Python version.
Right after performing these actions, you can immediately write and run Python applications making use of Basler cameras:
from pypylon import pylon
from pypylon import genicam
# Create an instant camera object with the camera device found first.
camera = pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateFirstDevice())
camera.Open()
# etc…
System Requirements
If you want to use pypylon the following system requirements must be fulfilled:
- Windows, Linux x86 or Linux ARM
- Latest version of the Basler pylon 5 Camera Software Suite
- Python 3.4 or newer (older Python versions starting with Python 2.7 may also work fine, but are not explicitly tested or recommended)
- Latest pypylon version
pypylon is "community-supported"
pypylon is available as an open source project and hosted on https://github.com/basler/pypylon. This is also the place, where you find a nice collection of sample Python programs, which demonstrate all common camera use cases.
Offering pypylon in source code, results in a high degree of flexibility, since you can modify and build pypylon exactly to your needs. With this project everyone is encouraged to integrate own ideas and actively participate in the further development of pypylon.
You are welcome to post any questions or issues in the comment box below. Just log in or register and leave a comment here.
Comments
Report comment