Skip to main content

OpenCV

How to configure OpenCV C++ dev environment in Ubuntu 22.04

sudo apt install -y g++ cmake make git libgtk2.0-dev pkg-config
git clone https://github.com/opencv/opencv.git
mkdir -p build && cd build
cmake ../opencv
make -j4
sudo make install

Different types of stitching in OpenCV

How to install opencv python

pip install opencv-python

Ref: https://pypi.org/project/opencv-python/#installation-and-usage

python opencv tutorial

K-Means clustering

Stiching

OpenCV Color Detection

How to check opencv version

Hello World OpenCV program

CMakeLists.txt

cmake_minimum_required(VERSION 3.27)
project(opencv_hello_world)

set(CMAKE_CXX_STANDARD 17)

find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})

add_executable(opencv_hello_world main.cpp)
target_link_libraries(opencv_hello_world ${OpenCV_LIBS})

main.cpp

#include <iostream>
#include <opencv4/opencv2/opencv.hpp>
#include <opencv4/opencv2/highgui/highgui.hpp>

using namespace cv;

int main() {
namedWindow("Output", 1);
Mat output = Mat::zeros(120, 350, CV_8UC3);
putText(output, "Hello World :)", Point(15, 70), FONT_HERSHEY_PLAIN, 3, Scalar(0,255, 0), 4);
imshow("Output", output);
waitKey(0);
std::printf("Hello World");
return 0;
}

Ref: https://gist.github.com/EyalAr/3940636