OpenCV is a library of programming functions mainly aimed at real-time computer vision, originally developed by Intel. It is free for use under the open source BSD license.
The library is cross-platform and focuses mainly on real-time image processing.
If the library finds Intel's Integrated Performance Primitives on the system, it will use these commercial optimized routines to accelerate itself.
Our cameras support this Vision Library by usage of XIMEA xiApiPlusOcv.
The XIMEA xiApiPlusOcv is an application interface which allows to easily create applications in CPP capable to get images from a camera and use them together with standard OpenCV library.
The sample application for OpenCV Library requires the headers and binaries to be installed before it can be successfully built.
Please follow these guidelines depending on your OS:
XIMEA OpenCV sample application captures a sequence of images and displays it on the screen using OpenCV Mat format.
OpenCV sample code - See this section with various OpenCV examples.
If XIMEA API Software Package is installed, sample applications with XIMEA OpenCV Library are located:
$(OPENCV_DIR)
as path where OpenCV is built (e.g. C:\opencv\build\x64\vc12).The Sample application uses the OpenCV xiApiPlusOcv.hpp library interface to capture series of frames from the camera and converts each frame to the OpenCV Mat format and shows it on the display.
It uses a xiAPIplusCameraOcv class to handle the camera and its features.
When compiling on 64-bit Windows systems the Solution platform in Visual Studio should be set to x64.
#include <stdio.h>
#include "xiApiPlusOcv.hpp"
using namespace cv;
using namespace std;
int main (void)
{
try
{
xiAPIplusCameraOcv cam;
cam.OpenFirst();
cam.SetExposureTime(10000); //10000 us = 10 ms
cam.StartAcquisition();
// Read and convert a frame from the camera
Mat cv_mat_image = cam.GetNextImageOcvMat();
// Show image on display
cv::imshow("Image from camera",cv_mat_image);
cam.StopAcquisition();
cam.Close();
}
catch(xiAPIplus_Exception& exp)
{
exp.PrintError(); // report error if some call fails
}
}
The xiAPIplusCameraOcv class is used to handle the camera.
In an application, an instance of this class has to be created.
Then the class should be initialized by calling an opening method (e.g. OpenFirst()).
Camera parameters can be set by calling set methods or read by calling get methods.
The camera acquisition starts after StartAcquisition() is called.
The captured frames can be read by calling GetNextImageOcvMat() - a method that reads a frame from the camera and converts it into OpenCV Mat format that can be directly used for OpenCV processing.
xiApiPlusOcv allows to process already captured and stored images using Offline Processing. Please read more at xiApiPlusOcv Offline Processing.