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

For the Impatient

  • Install pylon.
  • Download a binary wheel from the releases page.
  • Install the wheel using pip3 install <your downloaded wheel>.whl
  • Look at samples/grab.py in this repository

Installation

Prerequisites

  • Installed pylon.
  • Installed python (python 3 recommended).
  • Installed pip.

Binary Installation

The easiest way to get pypylon is to install a prebuild wheel.

Binary releases are available on the releases page.

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)
  • swig >= 3.0.12

To build pypylon from source:

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

Getting Started

Hello World

See the grab sample in the samples directory.

Excerpt:

from pypylon import pylon

camera = pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateFirstDevice())

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()

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 an official pylon package from http://www.baslerweb.com/pylon.

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.4.0-cp37-cp37m-win_amd64.whl (4.4 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

pypylon-1.4.0-cp37-cp37m-win32.whl (3.7 MB view hashes)

Uploaded CPython 3.7m Windows x86

pypylon-1.4.0-cp36-cp36m-win_amd64.whl (4.4 MB view hashes)

Uploaded CPython 3.6m Windows x86-64

pypylon-1.4.0-cp35-cp35m-win_amd64.whl (4.4 MB view hashes)

Uploaded CPython 3.5m Windows x86-64

pypylon-1.4.0-cp35-cp35m-win32.whl (3.7 MB view hashes)

Uploaded CPython 3.5m Windows x86

pypylon-1.4.0-cp34-cp34m-win_amd64.whl (4.4 MB view hashes)

Uploaded CPython 3.4m Windows x86-64

pypylon-1.4.0-cp34-cp34m-win32.whl (3.7 MB view hashes)

Uploaded CPython 3.4m Windows x86

pypylon-1.4.0-cp33-cp33m-win_amd64.whl (4.4 MB view hashes)

Uploaded CPython 3.3m Windows x86-64

pypylon-1.4.0-cp33-cp33m-win32.whl (3.7 MB view hashes)

Uploaded CPython 3.3m Windows x86

pypylon-1.4.0-cp27-cp27m-win_amd64.whl (4.4 MB view hashes)

Uploaded CPython 2.7m Windows x86-64

pypylon-1.4.0-cp27-cp27m-win32.whl (3.7 MB view hashes)

Uploaded CPython 2.7m 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