Create a CMake file, known as CMakeLists.txt
https://docs.opencv.org/4.6.0/db/df5/tutorial_linux_gcc_cmake.html
cmake_minimum_required(VERSION 2.8)
project(DisplayImage)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(DisplayImage DisplayImage.cpp)
target_link_libraries(DisplayImage ${OpenCV_LIBS})
Build the executable file
https://docs.opencv.org/4.6.0/db/df5/tutorial_linux_gcc_cmake.html
cd <DisplayImage_directory>
cmake .
make
Display the image
Key 's' to save it