Skip to main content

The python wrapper for the Basler pylon Camera Software Suite.

Project description

pypylon

The official python wrapper for the Basler pylon Camera Software Suite.

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.

Build Status Build Status

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.GetValue() - camera.Width.GetInc()
if new_width >= camera.Width.GetMin():
    camera.Width.SetValue(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()

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

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.4 3.5 3.6 3.6 3.7 3.8 3.9
Windows 32bit x x x x x x x
Windows 64bit x x x x x x x
Linux i686** -* -* x x x x x
Linux x86_64** -* -* x x x x x
Linux armv7l** -* -* x x x x x
Linux aarch64** -* -* x x x x x
Mac OS*** - - x x x x x

Additional Notes on binary packages:

  • (*) The linux wheels for python 3.4 and 3.5 are not available on pypi.
    You can get them from Github Releases.
  • (**) The linux binaries are manylinux_2_24 conformant.
    This is roughly equivalent to a minimum glibc version >= 2.24.
    :warning: You need at least pip 20.3 to install them.
  • (***) MacOS binaries are built for macOS >= 10.14 (Mojave)

Installation from Source

Building the pypylon bindings is supported and tested on Windows and Linux.

You need a few more things to compile pypylon:

  • A compiler for your system (Visual Studio on Windows, gcc on linux)
  • Python development files (e.g. sudo apt install python-dev on linux)
  • swig >= 4.0

To build pypylon from source:

git clone https://github.com/basler/pypylon.git
cd pypylon
pip install .

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.

python -m unittest tests/....
python 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pypylon-1.7.1-cp39-cp39-win_amd64.whl (15.3 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

pypylon-1.7.1-cp39-cp39-win32.whl (13.3 MB view hashes)

Uploaded CPython 3.9 Windows x86

pypylon-1.7.1-cp39-cp39-manylinux_2_24_x86_64.whl (9.7 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.24+ x86-64

pypylon-1.7.1-cp39-cp39-manylinux_2_24_i686.whl (9.4 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.24+ i686

pypylon-1.7.1-cp39-cp39-manylinux_2_24_armv7l.whl (7.5 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.24+ ARMv7l

pypylon-1.7.1-cp39-cp39-manylinux_2_24_aarch64.whl (9.1 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.24+ ARM64

pypylon-1.7.1-cp39-cp39-macosx_10_14_x86_64.whl (16.8 MB view hashes)

Uploaded CPython 3.9 macOS 10.14+ x86-64

pypylon-1.7.1-cp38-cp38-win_amd64.whl (15.3 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

pypylon-1.7.1-cp38-cp38-win32.whl (13.3 MB view hashes)

Uploaded CPython 3.8 Windows x86

pypylon-1.7.1-cp38-cp38-manylinux_2_24_x86_64.whl (9.7 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.24+ x86-64

pypylon-1.7.1-cp38-cp38-manylinux_2_24_i686.whl (9.4 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.24+ i686

pypylon-1.7.1-cp38-cp38-manylinux_2_24_armv7l.whl (7.5 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.24+ ARMv7l

pypylon-1.7.1-cp38-cp38-manylinux_2_24_aarch64.whl (9.1 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.24+ ARM64

pypylon-1.7.1-cp38-cp38-macosx_10_14_x86_64.whl (16.8 MB view hashes)

Uploaded CPython 3.8 macOS 10.14+ x86-64

pypylon-1.7.1-cp37-cp37m-win_amd64.whl (15.3 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

pypylon-1.7.1-cp37-cp37m-win32.whl (13.3 MB view hashes)

Uploaded CPython 3.7m Windows x86

pypylon-1.7.1-cp37-cp37m-manylinux_2_24_x86_64.whl (9.7 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.24+ x86-64

pypylon-1.7.1-cp37-cp37m-manylinux_2_24_i686.whl (9.3 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.24+ i686

pypylon-1.7.1-cp37-cp37m-manylinux_2_24_armv7l.whl (7.5 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.24+ ARMv7l

pypylon-1.7.1-cp37-cp37m-manylinux_2_24_aarch64.whl (9.1 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.24+ ARM64

pypylon-1.7.1-cp37-cp37m-macosx_10_14_x86_64.whl (16.8 MB view hashes)

Uploaded CPython 3.7m macOS 10.14+ x86-64

pypylon-1.7.1-cp36-cp36m-win_amd64.whl (15.3 MB view hashes)

Uploaded CPython 3.6m Windows x86-64

pypylon-1.7.1-cp36-cp36m-win32.whl (13.3 MB view hashes)

Uploaded CPython 3.6m Windows x86

pypylon-1.7.1-cp36-cp36m-manylinux_2_24_x86_64.whl (9.7 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.24+ x86-64

pypylon-1.7.1-cp36-cp36m-manylinux_2_24_i686.whl (9.3 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.24+ i686

pypylon-1.7.1-cp36-cp36m-manylinux_2_24_armv7l.whl (7.5 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.24+ ARMv7l

pypylon-1.7.1-cp36-cp36m-manylinux_2_24_aarch64.whl (9.1 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.24+ ARM64

pypylon-1.7.1-cp36-cp36m-macosx_10_14_x86_64.whl (16.8 MB view hashes)

Uploaded CPython 3.6m macOS 10.14+ x86-64

pypylon-1.7.1-cp35-cp35m-win_amd64.whl (15.3 MB view hashes)

Uploaded CPython 3.5m Windows x86-64

pypylon-1.7.1-cp35-cp35m-win32.whl (13.3 MB view hashes)

Uploaded CPython 3.5m Windows x86

pypylon-1.7.1-cp34-cp34m-win_amd64.whl (15.3 MB view hashes)

Uploaded CPython 3.4m Windows x86-64

pypylon-1.7.1-cp34-cp34m-win32.whl (13.2 MB view hashes)

Uploaded CPython 3.4m Windows x86

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page