Sometimes in a project, we need to maintain different version of OpenCV and link to it in organised way. This can be template for your cmake project.

cmake_minimum_required(VERSION 3.1)

project( DisplayImage )

# Enable C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

# For OpenCV 4
SET(OpenCV_DIR <current-path>/OpenCV-master/lib/cmake/opencv4)

# For OpenCV 3
# SET(OpenCV_DIR "<current-path>/opencv3.4.8/installation/OpenCV-3.4.8/share/OpenCV/")

# If the package has been found, several variables will
# be set, you can find the full list with descriptions
# in the OpenCVConfig.cmake file.
# Print some message showing some of them
message(STATUS "OpenCV library status:")
message(STATUS " version: ${OpenCV_VERSION}")
message(STATUS " libraries: ${OpenCV_LIBS}")
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")

find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable( DisplayImage main.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )

I have detailed explained the instalation and running an example using OpenCV C++ here.

If you like it, please give it a clap.

References:


Yes, but in order to install it, you need

Thanks to Satya Mallik and Opencv.org, they have written customised bash script to install opencv without any hasel. We will add more to it in this blog.

>> wget https://raw.githubusercontent.com/spmallick/learnopencv/master/InstallScripts/installOpenCV-4-on-Ubuntu-18-04.sh
>>…


Do you know Raspberry Pi? If not, please explore here and come back after sometimes, but if you have worked on it, you might have experienced how important is to process maximum images coming from Pi Camera. …


Road to Edge AI

In this series of blogs, I am gonna show how we can bring model intelligence from CPU to small Raspberry Pi devices using the Intel OpenVino toolkit. You can observe the power of this toolkit on CPU as well. This is a tutorial to know more about OpenVino and Tensorflow…

Saurav Solanki

Open to Edge AI Opportunity

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store