Furthermore, you could custom the swappiness value. Swappiness is a Linux kernel property that defines how often the system will use the swap space. Swappiness can have a value between 0 and 100. A low value will make the kernel to try to avoid swapping whenever possible, while a higher value will make the kernel to use the swap space more aggressively.
Set your swappiness, the default is 60
sudo sysctl vm.swappiness=60
To remove swap file, deactivate the swap and delete swapfile
GStreamer is a library for constructing graphs of media-handling components. The applications it supports range from simple Ogg/Vorbis playback, audio/video streaming to complex audio (mixing) and video (non-linear editing) processing.
Threading Building Blocks (Intel® TBB) makes parallel performance and scalability accessible to software developers who are writing loop- and task-based applications. Build robust applications that abstract platform details and threading mechanisms while achieving performance that scales with increasing core count.
sudo apt install libtbb2 libtbb-dev -y
The v4l-utils are a series of packages for handling media devices, libdc1394 is a library that provides a complete high level application programming interface (API) for developers who wish to control IEEE 1394 based cameras that conform to the 1394-based Digital Camera Specifications (also known as the IIDC or DCAM Specifications).
BLAS (Basic Linear Algebra Subroutines) is a set of efficient routines for most of the basic vector and matrix operations. They are widely used as the basis for other high quality linear algebra software, for example lapack and linpack.
Tesseract is an open source Optical Character Recognition (OCR) Engine. It can be used directly, or (for programmers) using an API to extract printed text from images. It supports a wide variety of languages.
CMake is a cross-platform build system generator. Projects specify their build process with platform-independent CMake listfiles included in each directory of a source tree with the name CMakeLists.txt. Users build a project by using CMake to generate a build system for a native tool on their platform.
Here I compile OpenCV with OpenCV Contrib by default:
While the devices has both AArch (ARMv8) CPU and software environment (64bit kernel and 64bit compiler), such as Jetson TX2, Raspberry Pi 4B with 64bit OS, there would be something different for CMake flags.
-D ENABLE_NEON=ON \ -D ENABLE_VFPV3=ON \
-D ENABLE_NEON=ON \
We have noticed that in most scenarios OpenCV utilizes CPU, which doesn’t always guarantee our the desired performance.
Build OpenCV Java API requires Java runtime, make sure jdk is installed first, and then reconfigure CMake flags.
sudo apt install openjdk-11-jdk ant -y
Note: Compile OpenCV with Contrib may require unblocked Internet connection.
Compile and Test
Normally we build from source code by sudo make, but it seems always slow in a more awkward way. Pay attention to -j [N], --jobs[=N], note that sudo make -j 4 means build using 4 threads as 4 cores, then we got this command which makes the build process much faster.
make -j "$(grep -c ^processor /proc/cpuinfo)"
If there’s no errors displayed, it means you compiled OpenCV successfully. Then, we install and linking.
sudo make install sudo ldconfig
For Jetson TX2, Here’s an example to test onboard camera and if Gstreamer works.