This project contains sample OpenCV application code as well as V4L2 helper library to access camera devices in OpenCV. This code helps to achieve high framerates from cameras in OpenCV. This project gives better results than the VideoCapture class in OpenCV. This source code is only compatible in Linux.
A set of applications (and helper library) used to assess the performance of a camera when OpenCV is used to display/process the camera stream.
This repository also consists of a script and it’s related files that automatically fetches, builds and installs OpenCV with various features and optimization flags enabled. The script also installs the required dependencies. Further, it automatically tries to patch a header as it’s required for a successful build.
To install optimized OpenCV:
cd opencv
bash opencv_install_script.bash
This would have installed OpenCV successfully. To build the sample applications and helper library:
cd ..
mkdir build && cd build
cmake ..
make
sudo make install
The above commands would generate multiple binaries with different characteristics as specified below:
opencv-main
: This application uses the VideoCapture API of OpenCV to fetch
frames but doesn’t render the frames on display. It just prints the framerate achieved.
The application can be killed by pressing Ctrl+C.
opencv-main-display
: This application is similar to opencv-main
with the only addition that
it uses imshow
to display the camera stream in a window.
This application can be killed by pressing the ESC key with the display window in focus.
opencv-main-gl-display
: This application is similar to opencv-main-display
with the only addition that
it uses an OpenGL rendered window to display the camera stream.
This application can be killed by pressing the ESC key with the display window in focus.
opencv-main-gpu-display
: This application is similar to opencv-main-gl-display
with the only
addition that, the image data is copied to a GpuMat first before getting displayed.
This application can be killed by pressing the ESC key with the display window in focus.
opencv-v4l2
: This application uses V4L2 to grab frame data from the camera and encapsulate it in
an OpenCV Mat. This data is then explicitly colorspace converted using cvtColor
. The application only
prints the framerate achieved.
This application can be killed by pressing Ctrl+C.
opencv-v4l2-display
: This application is similar to opencv-v4l2
with the only addition that
it uses imshow
to display the camera stream in a window.
This application can be killed by pressing the ESC key with the display window in focus.
opencv-v4l2-gl-display
: This application is similar to opencv-v4l2-display
with the only addition that
it uses an OpenGL rendered window to display the camera stream.
This application can be killed by pressing the ESC key with the display window in focus.
opencv-v4l2-gpu-display
: This application is similar to opencv-v4l2-gl-display
with the only
addition that, the image data is copied to a GpuMat first before getting displayed.
This application can be killed by pressing the ESC key with the display window in focus.
opencv-buildinfo
: Sample application that prints the build information of the OpenCV library
being used. This application can be used to verify that the options selected during compilation were
really enabled.