How to use Basler camera

Basler makes industrial cameras. Setting up and using this camera with your own code is quite easy:

  • Download the Pylon 4 camera software for Linux that matches the CPU architecture of your computer from here.

  • Unzip the tar.gz file you downloaded.

  • Install the software:

$ sudo tar -C /opt -xzf pylonSDK*.tar.gz

It was installed to /opt/pylon4 on my computer.

  • Setup permissions for the cameras so that they can be detected by the Linux kernel:
$ sudo ./
  • Screw the lens on to the camera body. Connect the camera using its USB 3.0 cable to a USB 3.0 port on your computer.

  • To test whether the camera is working, try the Pylon Viewer application:

$ /opt/pylon4/bin/PylonViewerApp

You should be able to capture images from your camera using this app and also configure its various settings.

  • Pylon 4 ships with a lot of sample code that shows how to use its cameras with your own code. Build these samples by setting the appropriate environment variables and try them out:
$ cd Samples
$ source /opt/pylon4/bin/ /opt/pylon4
$ make
$ cd Grab
$ ./Grab

The shell script to set environment variables did not work under the Fish shell, so I used a Bash shell for this purpose.

Tried with: Basler acA1600-20uc camera, Pylon 4 for Linux x86 64-bit and Ubuntu 14.04

4 thoughts on “How to use Basler camera”

  1. Hello Ahwin.

    I am trying to grab the images using the sample code given and show it using Opencv Highgui library. If no highgui call is made, the camera is grabbing the frames, but if i include any highgui calls like NamedWindow or imshow or imwrite, camera is not able to grab the images and throwing exception of unknown timeout.

    Do you have any idea about this issue.


    1. Naga: I guess you are trying this on Linux. Pylon library uses multi-threading. OpenCV is single-threaded as long as you do not draw any window. When both of them are multi-threaded in the same program, I have experienced the same problems as you have described.

      I found that this happened only on Linux. So I grabbed from camera on Windows, where their multi-threading seems to work fine.


    2. Hi Ahwin,
      did you find a solution of this issue?
      The issue is related to linking (without calling any functions) the opencv_highgui library.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s