Rapid prototyping camera applications

Interactive programming with IDS peak and uEye+ cameras

Python is a very common programming language in the Internet of Things (IoT). It allows writing and testing short code snippets without the time-consuming setup of a complete development environment. The possibility of interactive programming makes it the ideal interface for the testing and trial phase. Especially in combination with embedded systems, Python is a winner, as no time-consuming cross-compiling is necessary.

With IDS peak 1.2 you can also use the advantages of Python for programming your uEye+ camera applications. The numerous camera features of IDS industrial cameras can be tested quickly, analysed and prepared for later use in a larger software project. With this tech tip, we would therefore like to explain the programming of uEye+ cameras via the IDS peak python interface in more detail.

The Python source code examples used illustrate the basic handling of the cameras and the interface. They are designed as "Jupyter notebooks". This allows them to be tested and reproduced live in the open source web application with your uEye+ cameras.

We describe the installation and use of the Jupyter notebooks as an example for a Windows 10 PC. Since Python is available for several platforms and Jupyter Notebooks is a platform-independent web application, you can of course also run and test the source code examples under Linux.

Requirements

Python installation dialogue - Advanced options
Python installation dialogue - Advanced options

Make sure that Python is installed for "all users" and that Python is added to the "path" variable. Then you can also use Python via the command prompt.

pip install Pillow
pip install matplotlib
pip install opencv-python
pip install torch
python -m pip install --upgrade pip
pip install "C:\Program Files\IDS\ids_peak\sdk\api\binding\python\wheel\x86_64\ids_peak-1.2.0.5-cp38-cp38-win_amd64.whl"
pip install "C:\Program Files\IDS\ids_peak\sdk\ipl\binding\python\wheel\x86_64\ids_peak_ipl-1.2.2.1-cp38-cp38-win_amd64.whl"

Jupyter Notebook

The installation of the open source web application is also very simple with pip:

pip install notebook

If you need more info about Jupyter Notebook:

Notebook Server

Open a Powershell window (user rights are sufficient) and start the Jupyter Notebook Server.

Open Powershell in folder
Start the server directly in the installation folder of the sample notebook, then the notebooks are directly available to you.
To open a PowerShell window directly in a specific folder, first navigate to this directory in the Explorer, type "powershell" in the path bar at the top and confirm with "Enter".

PS C:\Users\ids\ids-peak-jupyter-notebooks> jupyter notebook
[I 12:12:45.115 NotebookApp] Serving notebooks from local directory: C:\Users\ids\ids-peak-jupyter-notebooks
[I 12:12:45.115 NotebookApp] The Jupyter Notebook is running at:
[I 12:12:45.115 NotebookApp] http://localhost:8888/?token=f8baad4df16a4b1436c59723cfcba540c4b5a923b3352120
[I 12:12:45.115 NotebookApp]  or http://127.0.0.1:8888/?token=f8baad4df16a4b1436c59723cfcba540c4b5a923b3352120
[I 12:12:45.115 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

The Notebook server opens in your default web browser at start-up and outputs a bit of information in the shell, including the URL of the web application (http://localhost:8888 by default). When the server is opened in your browser, you will see the Notebook dashboard, which displays a list of notebooks, files and subdirectories in the directory where the Notebook server was started.

Use Notebook

Now simply open the notebook "ids-peak-python-sample-jupyter.jpynb" in the server.