Skip to content

A basic application to use as a starting point for applications using Ximea cameras and OpenCV

Notifications You must be signed in to change notification settings

ExpertOfNil/ximea_opencv_quickstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ximea and OpenCV Quickstart

This repository is meant to aid in getting up and running with computer vision projects using Ximea cameras and OpenCV.

Prerequisites

sudo apt update
sudo apt install build-essential linux-headers-"$(uname -r)"

Install OpenCV

Unless you need a custom build of OpenCV, you can install it via:

sudo apt install libopencv-dev

Install the Ximea API

Download the XIMEA Linux Software Package:

wget https://www.ximea.com/downloads/recent/XIMEA_Linux_SP.tgz

Untar:

tar xzf XIMEA_Linux_SP.tgz
cd package

Start install script:

./install

Note: For PCIe cameras, start the script with option -pcie

xiAPI will be compiled into /usr/lib/libm3api.so. Examples, including xiApiPlusOcv sources can be found in /opt/XIMEA.

Note: Linux has a really small (16MB) usb buffer limit by default. This may cause crashes during camera use.

Increase the USB Buffer Size in Linux:

sudo tee /sys/module/usbcore/parameters/usbfs_memory_mb >/dev/null <<<0

Alternatively, you can change it using xiApi:

Change the buffer commit count to 32:

xiSetParamInt(handle, XI_PRM_ACQ_TRANSPORT_BUFFER_COMMIT, 32);

Change the buffer size to the maximum:

xiGetParamInt(handle, XI_PRM_ACQ_TRANSPORT_BUFFER_SIZE XI_PRM_INFO_MAX, &buffer_size);
xiSetParamInt(handle, XI_PRM_ACQ_TRANSPORT_BUFFER_SIZE, buffer_size);

Build and Compile

Note: This was created for the monochrome xiC cameras. If a color camera is being used, some adjustments will need to be made.

From the root directory:

mkdir build
cd build
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=1
make

Executables are placed in the bin folder.

About

A basic application to use as a starting point for applications using Ximea cameras and OpenCV

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published