Tutorials  /  Linux Basics

Install OpenCV 3.3.0 on CentOS 7: Step-by-Step Guide

Ccentron Redaktion · April 2025 ·3 min read ·Linux Basics, Tutorial

The Open Source Computer Vision Library, commonly referred to as OpenCV, is a versatile and cross-platform library designed for computer vision applications. It is extensively adopted in various visual processing fields such as facial recognition, gesture tracking, interaction between humans and computers, object detection, motion analysis, and more.

OpenCV supports multiple operating systems including Windows, Linux, Android, and iOS. This guide explains the process of compiling and installing OpenCV version 3.3.0 — the most current stable release at the time of writing — on a CentOS 7 x64 system.

Requirements

  • An active CentOS 7 x64 server instance.
  • Access to the server as the root user.
  • The server should be fully updated with the latest stable packages.
VM

Matching infrastructure at centron

No hardware needed to follow along: ccloud³ VMs with full root access start at €3.12 per month, billed by the hour and ready in seconds. Rent a cloud server →

Step 1: Installing the Required Dependencies

Execute the following commands to install all necessary packages for compiling OpenCV:

Console
yum groupinstall "Development Tools" -y
yum install cmake gcc gtk2-devel numpy pkconfig -y

Step 2: Fetching the OpenCV 3.3.0 Archive

Download and extract the OpenCV 3.3.0 source archive using these commands:

Console
cd
wget https://github.com/opencv/opencv/archive/3.3.0.zip
unzip 3.3.0.zip

Step 3: Compiling and Installing OpenCV

Use the instructions below to build and install OpenCV. The resulting files will be stored in the /usr/local directory:

Console
cd opencv-3.3.0
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=DEBUG -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
make install

Step 4: Setting Up Environment Variables

After installation, some environment variables must be configured for pkgconfig and OpenCV to work correctly:

Console
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig/
echo '/usr/local/lib/' >> /etc/ld.so.conf.d/opencv.conf
ldconfig

Step 5 (Optional): Running Validation Tests

To verify your OpenCV setup, you can retrieve supplementary test data from the OpenCV extras repository and run the test binaries:

Console
cd
git clone https://github.com/opencv/opencv_extra.git
export OPENCV_TEST_DATA_PATH=/root/opencv_extra/testdata

Navigate to the bin directory inside the OpenCV build folder and execute one of the available test binaries, such as:

Console
cd /root/opencv-3.3.0/build/bin
ls
./opencv_test_photo

Conclusion

By following this guide, you have successfully compiled and installed OpenCV 3.3.0 on a CentOS 7 system. With the required dependencies in place and environment variables properly configured, your system is now ready for a wide range of computer vision applications. Whether you are working on facial recognition, object tracking, or gesture detection, this setup provides a stable foundation to build and test OpenCV-powered projects. You can now confidently begin developing visual processing solutions tailored to your specific needs on a robust Linux platform.

Jetzt 200 € Guthaben sichern

Testen Sie Ihr Setup auf ccloud³

Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.

centron Redaktion Technische Redaktion

Das Redaktionsteam von centron schreibt Anleitungen aus dem Betriebsalltag: getestet auf unserer eigenen Plattform, betrieben im Rechenzentrum in Hallstadt bei Bamberg.

Kategorie Linux Basics
Teilen
Noch offene Fragen?

Our team will help you with your specific setup - in German or English, by people who run the platform themselves.

War dieses Tutorial hilfreich?

Your answer is stored anonymously and helps us improve our tutorials.

Kommentare

No comments yet - be the first to ask a question about this tutorial.

Sign in to comment

Comments are open to centron customers. Sign in to your account to ask a question about this tutorial.

Weiterlesen

Das könnte Sie auch interessieren

Jetzt kostenlos anfangen

Melden Sie sich an und erhalten Sie in den ersten 60 Tagen ein Guthaben von 200 € bei centron.

Dieses Werbeangebot gilt nur für neue Konten. Angebot ausschließlich für Gewerbetreibende.

Jetzt loslegen Sales kontaktieren