-
Notifications
You must be signed in to change notification settings - Fork 17
Using the Camera Emulator
Beside the interfaces to real cameras, pylonsrc can access an emulated camera. This allows to develop with pylonsrc without a real camera. The emulator is documented in the Basler Product Documentation
In the pylonsrc plugin, the emulator is normally disabled. This allows to open a single real camera without always selecting between the emulator and the real.
To enable the emulator, set the environment variable PYLON_CAMEMU to the number of emulated cameras required.
As an example:
export PYLON_CAMEMU=8This gst-launch-1.0 call will activate eight emulated cameras and arrange them on a 2x4 grid.
#!/bin/bash
export PYLON_CAMEMU=8
gst-launch-1.0 -e compositor name=comp \
sink_0::alpha=1 sink_0::xpos=0 sink_0::ypos=0 \
sink_1::alpha=1 sink_1::xpos=640 sink_1::ypos=0 \
sink_2::alpha=1 sink_2::xpos=1280 sink_2::ypos=0 \
sink_3::alpha=1 sink_3::xpos=1920 sink_3::ypos=0 \
sink_4::alpha=1 sink_4::xpos=0 sink_4::ypos=360 \
sink_5::alpha=1 sink_5::xpos=640 sink_5::ypos=360 \
sink_6::alpha=1 sink_6::xpos=1280 sink_6::ypos=360 \
sink_7::alpha=1 sink_7::xpos=1920 sink_7::ypos=360 \
! autovideosink \
pylonsrc device-serial-number=0815-0000 ! video/x-raw,format=RGB,width=640,height=360,fps=25 ! videoconvert ! comp.sink_0 \
pylonsrc device-serial-number=0815-0001 ! video/x-raw,format=RGB,width=640,height=360,fps=25 ! videoconvert ! comp.sink_1 \
pylonsrc device-serial-number=0815-0002 ! video/x-raw,format=RGB,width=640,height=360,fps=25 ! videoconvert ! comp.sink_2 \
pylonsrc device-serial-number=0815-0003 ! video/x-raw,format=RGB,width=640,height=360,fps=25 ! videoconvert ! comp.sink_3 \
pylonsrc device-serial-number=0815-0004 ! video/x-raw,format=RGB,width=640,height=360,fps=25 ! videoconvert ! comp.sink_4 \
pylonsrc device-serial-number=0815-0005 ! video/x-raw,format=RGB,width=640,height=360,fps=25 ! videoconvert ! comp.sink_5 \
pylonsrc device-serial-number=0815-0006 ! video/x-raw,format=RGB,width=640,height=360,fps=25 ! videoconvert ! comp.sink_6 \
pylonsrc device-serial-number=0815-0007 ! video/x-raw,format=RGB,width=640,height=360,fps=25 ! videoconvert ! comp.sink_7 !
The camera emulator can use customer supplied images instead of the standard moving gray gradient. Details also in the section about displaying custom test images in the Basler Product Documentation
A single image, or a folder with images, can be used. Formats are:
Windows: BMP, JPG, PNG, and TIF.
Linux: PNG and TIF
The output size of the pylonsrc has to be set to the size of the images.
Example:
check size of images:
file test_images/image0001.png
test_images/image0001.png: PNG image data, 640 x 360, 8-bit/color RGB, non-interlacedThe relevant camera features are:
- ImageFileMode
- ImageFilename
- TestImageSelector
Example pipeline with multiple 640x360 images in a folder test_images in the current working directory
PYLON_CAMEMU=1 gst-launch-1.0 pylonsrc \
device-index=1 \
cam::ImageFileMode=On \
cam::ImageFilename=$PWD/test_images \
cam::TestImageSelector=Off \
! video/x-raw,format=RGB,width=640,height=360 \
! videoconvert ! autovideosink