Skip to content

Repository files navigation

Basler pypylon banner

Sample applications, Jupyter notebooks, and contrib utilities using pypylon, the official Python language binding for the Basler pylon C++ APIs.

This is a companion repository to pypylon. The examples cover camera configuration, image acquisition, triggering, sequencers, and serial communication.

Build Status

Getting Started

The pypylon Programmer's Guide is available in the Basler Product Documentation and on GitHub.

  1. Install Python with pip. Installing the pylon Software Suite is also recommended; some camera interfaces require additional drivers. See the pypylon installation instructions for platform and camera requirements.

  2. Clone this repository and install the notebook dependencies:

    git clone https://github.com/basler/pypylon-samples.git
    cd pypylon-samples
    python -m pip install -r requirements.txt
  3. For example, start JupyterLab and open a notebook from the overview below:

    jupyter lab

For the contrib examples, also install pypylon-contrib.

Note: Camera features and names vary between models and interfaces. Check the requirements in each notebook before running it. Samples may not always reflect the latest pypylon API or coding style; refer to the pypylon samples and changelog for current guidance.

Overview

  • Some of the content was part of the Basler webinar about pypylon. You can watch this to get more in depth information about pylon SDK and pypylon. Please check for the recording at Basler PyPylon Webinar
  • The Python requirements to run the Jupyter notebooks and samples are listed in requirements.txt.

Basic Examples (pypylon only)

These examples use pypylon directly and do not require pypylon-contrib. Notebook, visualization, and image-processing dependencies are included in requirements.txt.

Notebooks

  1. Device enumeration and configuration basics deviceenumeration_and_configuration

  2. Demonstration of different grab strategies grabstrategies

  3. How to handle multicamera setups in pypylon multicamera

  4. Using hardware trigger and access image chunks ( USB ) hw_trigger_and_chunks

  5. Low overhead image capturing in a virtual line scan setup and display in notebook ( USB ) USB_linescan_performance_demo_opencv_notebook

  6. Exposure bracketing using the sequencer feature of ace devices ( USB) USB_HDR_exposure_sequencer

  7. Exposure bracketing using the sequencer feature of ace2/boost-R devices ( USB) USB_Ace2_BoostR_HDR_exposure_sequencer

  8. Full HDR multi-exposure example full_HDR_multiexposure_example

Contrib Examples (pypylon-contrib required)

These examples require the pypylon-contrib library which provides additional utilities and helper functions. Install it using:

python -m pip install pypylon-contrib

Notebooks

  1. Sequencer utilities - Simplified interface for camera sequencer configuration sequencer

    Demonstrates how to configure camera sequences using the CameraSequence, SinglePathSet, and SequencerTransition classes from pypylon-contrib.

  2. Serial communication - Communication with serial devices connected to Basler cameras serial_communication

    Shows how to use the BaslerSerial class to communicate with serial devices connected to a Basler camera, enabling control of external hardware through the camera's serial interface.

Development

Pull requests to pypylon-samples are very welcome. e.g. generic samples that demonstrate interaction with GUI toolkits, as we typically only use Qt.

To work on the contrib utilities, install the local package with development and notebook dependencies:

python -m pip install -e ".[dev,notebook]"

Run the unit tests with:

python -m pytest tests

Known Issues

  • info table missing that clearly identifies which samples work for which camera model

Support

You are welcome to post any questions or issues on GitHub. For questions or issues related to these samples or the contrib utilities, please use pypylon-samples issues. For issues with pypylon itself, please use pypylon issues. For additional technical support for business customers, please reach out to our official Support team.

About

No description, website, or topics provided.

Resources

Stars

61 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages