【Pylon/OvenCV/Python】Use the pylon Camera Software Suite interface “pypylon”

Programming

1.Purpose

I tried using the Python-compatible pylon Camera Software Suite interface “pypylon” published on the Basler homepage.
In this post, I will introduce an example of environment construction for camera capture using pypylon.

2.Background

Until now, developing applications for Windows platform using Basler cameras required programming in C ++ or C #. With the advent of pypylon, it is possible to control Basler cameras on Python.

This makes it possible to complete everything from capturing images by controlling your camera to image processing using OpenCV, numerical computation using Numpy, image display and graph display using matplotlib on Python.

Although it may be inferior to C ++ or C # in terms of processing speed and stability, in the development phase involving trial and error, it seems that there is a great merit that the application development can be completed on Python.

3.Environment

OS : Windows 10 64bit

Python : 3.3.6

Pylon for windows : 6.0.1

Pypylon : pypylon-1.5.1-cp36-cp36m-win_amd64.whl

4.Environment building procedure

4.1.Install Pylon for windows

You need the latest version 6 of Pylon, so download and install the latest version.

You can downdload Pylon? from Basler Official Website

To download, you must register as a member on the Basler website.

 4.2.Install “pypylon”

(1)Download binary wheel

Releases · basler/pypylon
The official python wrapper for the pylon Camera Software Suite - basler/pypylon

As of April 6, 2020, the latest version is 1.5.1.

By the way, there are many versions of the binary wheel, so be careful.
“Cp36” indicates the version of pyhon.
My environment is a Windows 64bit environment, and Python 3.6.3 has been installed, so download the version of the binary wheel (pypylon-1.5.1-cp36-cp36m-win_amd64.whl) marked with “cp36”. did.
Note that if you try to install a binary wheel that does not match your environment, you will get an error.

(2)Install binary wheel

From the command prompt, type pip3 install <your downloaded wheel> .whl and execute. If there is no problem, the installation is now complete.

 4.3. Execute sample code

Let’s try to run the sample code.

Of course, you need a camera one of the Basler camera. I use “puA1280-54um” of USB3 interface.

You can fined the sample codes on Github, so use one of them.

pypylon/samples at master · basler/pypylon
The official python wrapper for the pylon Camera Software Suite - pypylon/samples at master · basler/pypylon

With the camera connected, execute grab.py or startup.py on your Python environment, and if the image is displayed successfully, the environment construction is completed.

* This topic of running sample code will be introduced later. Keep in touch.

コメント

タイトルとURLをコピーしました