The python wrapper for the Basler pylon Camera Software Suite.
Project description
The official python wrapper for the Basler pylon Camera Software Suite.
Background information about usage of pypylon, programming samples and jupyter notebooks can also be found at pypylon-samples.
Please Note: This project is offered with no technical support by Basler AG. You are welcome to post any questions or issues on GitHub or on ImagingHub.
Getting Started
- Install pylon This is strongly recommended but not mandatory. See known issues for further details.
- Install pypylon:
pip3 install pypylon
For more installation options and the supported systems please read the Installation paragraph. - Look at samples/grab.py or use the following snippet:
from pypylon import pylon
camera = pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateFirstDevice())
camera.Open()
# demonstrate some feature access
new_width = camera.Width.Value - camera.Width.Inc
if new_width >= camera.Width.Min:
camera.Width.Value = new_width
numberOfImagesToGrab = 100
camera.StartGrabbingMax(numberOfImagesToGrab)
while camera.IsGrabbing():
grabResult = camera.RetrieveResult(5000, pylon.TimeoutHandling_ThrowException)
if grabResult.GrabSucceeded():
# Access the image data.
print("SizeX: ", grabResult.Width)
print("SizeY: ", grabResult.Height)
img = grabResult.Array
print("Gray value of first pixel: ", img[0, 0])
grabResult.Release()
camera.Close()
Getting Started with pylon Data Processing
- pypylon additionally supports the pylon Data Processing API extension.
- The pylon Workbench allows you to create image processing designs using a graphical editor.
- Hint: The pylondataprocessing_tests can optionally be used as a source of information about the syntax of the API.
- Look at samples/dataprocessing_barcode.py or use the following snippet:
from pypylon import pylondataprocessing
import os
resultCollector = pylondataprocessing.GenericOutputObserver()
recipe = pylondataprocessing.Recipe()
recipe.Load('dataprocessing_barcode.precipe')
recipe.RegisterAllOutputsObserver(resultCollector, pylon.RegistrationMode_Append);
recipe.Start()
for i in range(0, 100):
if resultCollector.GetWaitObject().Wait(5000):
result = resultCollector.RetrieveResult()
# Print the barcodes
variant = result["Barcodes"]
if not variant.HasError():
# Print result data
for barcodeIndex in range(0, variant.NumArrayValues):
print(variant.GetArrayValue(barcodeIndex).ToString())
else:
print("Error: " + variant.GetErrorDescription())
else:
print("Result timeout")
break
recipe.Unload()
Update your code to pypylon >= 3.0.0
The current pypylon implementation allows direct feature assignment:
cam.Gain = 42
This assignment style is deprecated with pypylon 3.0.0, as it prevents full typing support for pypylon.
The recommended assignment style is now:
cam.Gain.Value = 42
To identify the locations in your code that have to be updated, run with enabled warnings:
PYTHONWARNINGS=default python script.py
Installation
Prerequisites
- Installed pylon For the binary installation this is not mandatory but strongly recommended. See known issues for further details.
- Installed python with pip
- Installed CodeMeter Runtime when you want to use pylon vTools and the pylon Data Processing API extension on your platform.
pylon OS Versions and Features
Please note that the pylon Camera Software Suite may support different operating system versions and features than pypylon. For latest information on pylon refer to: https://www.baslerweb.com/en/software/pylon/ In addition, check the release notes of your pylon installation. For instance:
- pylon Camera Software Suite 7.5.0 supports Windows 10/11 64 bit, Linux x86_64 and Linux aarch64 with glibc version >= 2.31 or newer.
- pylon vTools are supported on pylon 7.0.0 and newer.
- pylon vTools are supported on pypylon 3.0 and newer only on Windows 10/11 64 bit, Linux x86_64 and Linux aarch64.
- For pylon vTools that require a license refer to: https://www.baslerweb.com/en/software/pylon-vtools/
- CXP-12: To use CXP with pypylon >= 4.0.0 you need to install the CXP GenTL producer and drivers using the pylon Camera Software Suite setup.
- For accessing Basler 3D cameras, e.g. Basler blaze, installation of pylon Camera Software Suite 7.5.0 and the latest pylon Supplementary Package for blaze is required.
Binary Installation
The easiest way to get pypylon is to install a prebuild wheel. Binary releases for most architectures are available on pypi**. To install pypylon open your favourite terminal and run:
pip3 install pypylon
The following versions are available on pypi:
3.9 | 3.10 | 3.11 | 3.12 | |
---|---|---|---|---|
Windows 64bit | x | x | x | x |
Linux x86_64* | x | x | x | x |
Linux aarch64* | x | x | x | x |
macOS x86_64** | x | x | x | x |
macOS arm64** | x | x | x | x |
Additional Notes on binary packages:
- (*) The linux 64bit binaries are manylinux_2_31 conformant. This is roughly equivalent to a minimum glibc version >= 2.31. :warning: You need at least pip 20.3 to install them.
- (**) macOS binaries are built for macOS >= 11.0 (Big-Sur)
Installation from Source
Building the pypylon bindings is supported and tested on Windows, Linux and macOS
You need a few more things to compile pypylon:
- An installation of pylon SDK for your platform
- A compiler for your system (Visual Studio on Windows, gcc on linux, xCode commandline tools on macOS)
- Python development files (e.g.
sudo apt install python-dev
on linux) - swig >= 4.0
- For all 64bit platforms you can install the tool via
pip install swig
- For all 64bit platforms you can install the tool via
To build pypylon from source:
git clone https://github.com/basler/pypylon.git
cd pypylon
pip install .
If pylon SDK is not installed in a default location you have to specify the location from the environment
- on Linux:
export PYLON_ROOT=<installation directory of pylon SDK>
- on macOS:
export PYLON_FRAMEWORK_LOCATION=<framework base folder that contains pylon.framework>
Development
Pull requests to pypylon are very welcome. To help you getting started with pypylon improvements, here are some hints:
Starting Development
python setup.py develop
This will "link" the local pypylon source directory into your python installation. It will not package the pylon libraries and always use the installed pylon.
After changing pypylon, execute python setup.py build
and test...
Running Unit Tests
NOTE: The unit tests try to import
pypylon....
, so they run against the installed version of pypylon.
pytest tests/....
Known Issues
- For USB 3.0 cameras to work on Linux, you need to install appropriate udev rules. The easiest way to get them is to install the official pylon package.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file pypylon-4.0.0-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 65.3 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8bff488240e0e4075ae888aa55e84d5f38561472c58306a98013b6b40b40b34 |
|
MD5 | 3566ebb64e7874d5df5696f2fda491f0 |
|
BLAKE2b-256 | c7d19df5d8591f1571d68a90abe93c82b945eb2954b08a4731de27c271806347 |
File details
Details for the file pypylon-4.0.0-cp312-cp312-manylinux_2_31_x86_64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp312-cp312-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 59.8 MB
- Tags: CPython 3.12, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a083fece3e0193dd1e02d448182921d524fd1b2727c1d0e52374390a082293e6 |
|
MD5 | aa9310c89195a8dd881d9877fd4e94e3 |
|
BLAKE2b-256 | c73ab9f2fbb57fad5e5aa432f07f938ade6c0a30827731ab84f70576c90e499d |
File details
Details for the file pypylon-4.0.0-cp312-cp312-manylinux_2_31_aarch64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp312-cp312-manylinux_2_31_aarch64.whl
- Upload date:
- Size: 53.7 MB
- Tags: CPython 3.12, manylinux: glibc 2.31+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8310370217613cf21b71b134bc7eee5f57d2ed77d7edce4c46bcc7c0d0f12b22 |
|
MD5 | 653df0e0a369dc792567b84dcda9cde5 |
|
BLAKE2b-256 | 703220549af353b1720b69e45387122edbd307f6aecaadb2b2d00dbf6b434d95 |
File details
Details for the file pypylon-4.0.0-cp312-cp312-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp312-cp312-macosx_11_0_x86_64.whl
- Upload date:
- Size: 27.6 MB
- Tags: CPython 3.12, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ef76ed8e2c560f16a66d8a7a8dd4754990d9022af13666635cf365e489f078d |
|
MD5 | 957fa0dd6a3b3db61f28f50a4d088fc8 |
|
BLAKE2b-256 | 5856503702a0aed5d0a5752ef4f5b15ae1b1f2b14d2e53a44492d25041b1e56b |
File details
Details for the file pypylon-4.0.0-cp312-cp312-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 27.6 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcb2fb2d6f82cdfe728a1e44b593b65fd29e2a0548d858a835cd1a0e8c78399f |
|
MD5 | c84779750e99c06edcb43e3baa555642 |
|
BLAKE2b-256 | 4d43adca56f4f576f1f31e6da64e5f78c3f5fd6970893627f8025e03818dfacf |
File details
Details for the file pypylon-4.0.0-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 65.3 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5ef25defca948b7407c164e825f94af2545217deb7475e0262249af1993086e |
|
MD5 | 4b3fd1e313645ca9052a590f2e6090cd |
|
BLAKE2b-256 | 182116bde6be6959a10a26106a2bb613b036dc5179e6789f65f7fc3b081b13a2 |
File details
Details for the file pypylon-4.0.0-cp311-cp311-manylinux_2_31_x86_64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp311-cp311-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 59.8 MB
- Tags: CPython 3.11, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 901d02c83dc6990708109dbd6d9cffa1b205d7d7eb981610887dbbef0659b73b |
|
MD5 | 1bbec442d349b061fd1e3ac2e13dfe6e |
|
BLAKE2b-256 | 7d10b08eb9e5480a9f707465980a055498bcb4d4e89ec31989092e6d6b694711 |
File details
Details for the file pypylon-4.0.0-cp311-cp311-manylinux_2_31_aarch64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp311-cp311-manylinux_2_31_aarch64.whl
- Upload date:
- Size: 53.7 MB
- Tags: CPython 3.11, manylinux: glibc 2.31+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ff102ae337660c659fc5a046eceb0ebbf080e4fbae935af18d890d302e6634e |
|
MD5 | 89282db0957a8cd03c48916458e1083a |
|
BLAKE2b-256 | d298f76eb068345c84a95d429e4c3c345cf93c6d2f84192b7a4b07d31f8d332f |
File details
Details for the file pypylon-4.0.0-cp311-cp311-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp311-cp311-macosx_11_0_x86_64.whl
- Upload date:
- Size: 27.6 MB
- Tags: CPython 3.11, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81b20ad1d0e0309b95217fa0181a7367e13a379e1189f72ad21ba038d96d6db5 |
|
MD5 | 98b530a5e0e76ff3c7947df6bc84196b |
|
BLAKE2b-256 | 392202e5471f56ba73a49baa00cae8b15d41eac0b98de3f8040edd226dd97bc9 |
File details
Details for the file pypylon-4.0.0-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 27.6 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35f7f073a679dd34899da9896e2f5e3d37757f8d52f911bb76db4fb9d10fdb90 |
|
MD5 | ce1710fc884a84a0fd7a652dd71c3dff |
|
BLAKE2b-256 | feefb1f4eff9f1014cd2741b6c10d37eb0648f925067647bdab05c8532031f26 |
File details
Details for the file pypylon-4.0.0-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 65.3 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10cf8ac157625245b3cdb5d427355b0f3755db599f50dba9f0f8285af6bbb38d |
|
MD5 | f494d2200837bada83271eafee4718b1 |
|
BLAKE2b-256 | ff0ba06dcdad57c4f578521554d0091adc597693e2a82497182433f1cffb2834 |
File details
Details for the file pypylon-4.0.0-cp310-cp310-manylinux_2_31_x86_64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp310-cp310-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 59.8 MB
- Tags: CPython 3.10, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 832f4db56691bbedf683379a9715cea2b4e494d14be64fa70b050890b6eb1950 |
|
MD5 | 0a91b4cb33293986993323c9625dfa47 |
|
BLAKE2b-256 | cb14f93c12fb596d917b63283c99d0f84cf16e374d1ea1b24eece2362ef680d0 |
File details
Details for the file pypylon-4.0.0-cp310-cp310-manylinux_2_31_aarch64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp310-cp310-manylinux_2_31_aarch64.whl
- Upload date:
- Size: 53.7 MB
- Tags: CPython 3.10, manylinux: glibc 2.31+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8101a16c35a6124d6d64ea6d8bfc5234a2fee6a73c207c476e1879f37950bacd |
|
MD5 | 8c4f28d7966715e05c99a152828b56d2 |
|
BLAKE2b-256 | b155f3e890826b9a01e04cc47fe0482875bb204b02d440f9a0ef2cf79e45dd5f |
File details
Details for the file pypylon-4.0.0-cp310-cp310-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp310-cp310-macosx_11_0_x86_64.whl
- Upload date:
- Size: 27.6 MB
- Tags: CPython 3.10, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38becbb6825308a7fa2f72beb29b51e265963af8f6623f60c98d9a0fb91d75ec |
|
MD5 | 9d7e2af2529bcf32e4b5e43d98d58178 |
|
BLAKE2b-256 | 8626d180e46633bc22ee7c2becbd5c9cbd31f2a3fccaea79388d10220cdfce28 |
File details
Details for the file pypylon-4.0.0-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 27.6 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84fdd91f9331595ce90a5b020be5a87676fd2ae2228248ab755b16c6091e8b05 |
|
MD5 | 985af3281d28840113338a2b5df5fd16 |
|
BLAKE2b-256 | 8755e089668284761484ae5c51e93b9d72cc365d534fa0ea8c57adca4b82f67b |
File details
Details for the file pypylon-4.0.0-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 65.3 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92eebde24f7b8e946d4b967bbb968d3d3484ff44176526c218d85f9ee0313528 |
|
MD5 | 65174f3999a49cd6e554d791806312ad |
|
BLAKE2b-256 | 99e6a7ec9642274ce8728d32754cfa4539f4df77ff32f2cc45cd2fe57b051583 |
File details
Details for the file pypylon-4.0.0-cp39-cp39-manylinux_2_31_x86_64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp39-cp39-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 59.8 MB
- Tags: CPython 3.9, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ad4a747d26d9dac47d23ea183b6b0d08b03a27844b9dddfd8b94c48b8a681af |
|
MD5 | a139eaea9daaa3dfdb5229d4c60bb7e2 |
|
BLAKE2b-256 | 0a11976e25f7e5605b57a06c8deec4dbfc4a09884240358452bfc968b7471d55 |
File details
Details for the file pypylon-4.0.0-cp39-cp39-manylinux_2_31_aarch64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp39-cp39-manylinux_2_31_aarch64.whl
- Upload date:
- Size: 53.7 MB
- Tags: CPython 3.9, manylinux: glibc 2.31+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a816ed9f461b0ac9335163601605cc25717fee6ac32ab6507c2aadbd7a73fe3 |
|
MD5 | 29bdf73bbf2d92e50dc48dd76573448a |
|
BLAKE2b-256 | b4efd3ae1a980fcfdf07a2ffc45217ca3e6ef8b41f4c24447f4dee259e15ed26 |
File details
Details for the file pypylon-4.0.0-cp39-cp39-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp39-cp39-macosx_11_0_x86_64.whl
- Upload date:
- Size: 27.6 MB
- Tags: CPython 3.9, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35b5b89b30447464cbc7bf26d6ce97bc37a6e0ae836e7eb52c6c7f77aae2cb4f |
|
MD5 | 8d113fc6558b17824d7fa55271c24e5a |
|
BLAKE2b-256 | 93e76993700939825416f75949eaeed10d4837bfdceefad5ff1293e12627883f |
File details
Details for the file pypylon-4.0.0-cp39-cp39-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pypylon-4.0.0-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 27.6 MB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2233368051453ee43cd87386682db122b3801f7dcf88948c3fc32adfef3d076 |
|
MD5 | 8c202d7dc34d83573f709d61e36ff31d |
|
BLAKE2b-256 | e2b7613ead998861758e30b96de672712d90d160a2b2a7c83e7ae129395ed419 |