JupyterLab¶
JupyterLab is a web-based user interface for project Jupyter.
Jupyter Notebooks are a new way to work easily with data, text, and code seamlessly together.
You can combine for example Python code with Markdown.
JupyterLab also offers a unified model for viewing and handling various data formats - images, JSON, CSV, Markdown, PDF, etc.
Plus it supports third-party extensions and various kernels for different programming languages.
We will focus on development using the XIMEA's API for Python which must be installed on the user's system.
Installing and running the JupyterLab¶
Simply use the pip
- package installer for Python:
pip install jupyterlab
or for alternative installation go to: https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html
Once installed you can run the JupyterLab from the command prompt:
jupyter-laband JupyterLab will open automatically in your browser:
Open the Python notebook in the JupyterLab launcher.
Getting the image from a XIMEA camera to Jupyter Notebook¶
Type the following code into the Notebook cell's:
from ximea import xiapi import numpy as np import matplotlib.pyplot as plt
cam = xiapi.Camera() cam.open_device() cam.set_exposure(10000) img_buffer = xiapi.Image() cam.start_acquisition()
cam.get_image(img_buffer) image = img_buffer.get_image_data_numpy() plt.imshow(image, cmap='gray') plt.show()
cam.stop_acquisition() cam.close_device()and Run all cells.
The image from a camera should appear in the Notebook.