CMakeLists.txt 예시

cmake_minimum_required (VERSION 3.1)

project (OpenCV_Lecture)
find_package(OpenCV REQUIRED)

add_executable (OpenCV_Lecture main.cpp)

include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(OpenCV_Lecture ${OpenCV_LIBS})

imread 예시

#include <iostream>
#include <string>

#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"

using namespace std;
using namespace cv;

int main() {
    string rP = "owl.png";
    string aP = "C:\\\\Project\\\\OpenCV_Lecture\\\\owl.png";

    Mat imgColor = imread(aP, IMREAD_COLOR);
    Mat imgGray = imread(aP, IMREAD_GRAYSCALE);
    imshow("color", imgColor);
    imshow("gray", imgGray);
    waitKey(5000);
}