목록OpenCV(C++) (11)
Creative Code
※Chapter6.cpp파일 #pragma once #include using namespace std; using namespace cv; //영상을 합성하는 함수 (사이즈가 같아야함) void arithmetic1() { Mat src1 = imread("lenna256.bmp",IMREAD_GRAYSCALE); Mat src2 = imread("square.bmp", IMREAD_GRAYSCALE); if (src1.empty() || src2.empty()) return; cout
※Chapter5.cpp 파일 #pragma once #include using namespace std; using namespace cv; void on_brightness(int pos, void* userdata); static Mat calcGrayHist(const Mat&); static Mat getGrayHistImage(const Mat&); //이미지를 BGR -> GRAYSCALE 또는 GRAYSCALE을 BGR로 바꾸는 함수 void example() { Mat img1 = imread("lenna.bmp"); Mat img2; cvtColor(img1, img2, COLOR_BGR2GRAY); // BGR->GRAYSCALE로 바꾸는 함수 imshow("IMG1", img1); ..
※Chapter4.cpp파일 #pragma once #include using namespace std; using namespace cv; static void on_mouse(int, int, int, int, void*);//함수의 원형 static void on_level_changed(int, void*); // 함수의 원형 static Mat img; Point pt_old; //카메라 연결 함수 void show_camera() { VideoCapture cap(0); // index 0 = 첫번째, 1 -> 두번째 (컴퓨터는 0, 노트북은 1) if (cap.isOpened()) { // 카메라가 연결되었는지 체크 cout
※chapter3.cpp파일 #pragma once #include using namespace std; using namespace cv; //Point 클래스와 Rec클래스, Size클래스 함수 void show_code_3() { Point pt1; // default 생성자 pt1.x = 5; pt1.y = 10; Point pt2(pt1); // 복사 생성자 Point p3 = pt1 + pt2; // 연산자 오버로드 int dot1 = pt1.dot(pt2); // 벡터 내적 cout