
열심히 강의 듣는 중...
cmake는 여전히 어렵다...! 헤더 파일을 만들어서 사용하는 경우 cmake를 어떻게 작성해야하는지 헷갈렸다.
파일 구조는 아래와 같다. mycanny 라이브러리를 만들어서 canny에서 실행한다.
detect_edge
┣ include
┃ ┗ mycanny.hpp
┣ CMakeLists.txt
┣ canny.cpp
┗ mycanny.cpp
add_library(detect_edge mycanny.cpp)
target_include_directories(detect_edge PUBLIC
include
${OpenCV_INCLUDE_DIRS}
)
target_link_libraries(detect_edge ${OpenCV_LIBS})
add_executable(canny canny.cpp)
target_link_libraries(canny
detect_edge
)
add_library(detect_edge mycanny.cpp) : mycanny.cpp파일을 detect_edge라는 라이브러리로 만든다.target_include_directories(detect_edge PUBLIC include ${OpenCV_INCLUDE_DIRS} ) : detect_edge에 include 폴더 안의 hpp와 opencv 헤더 파일을 연결해준다.target_link_libraries(detect_edge ${OpenCV_LIBS}) : detect_edge에 opencv라이브러리를 링킹해준다.HoughLines() : 직선 검출, 결과 vector<Vec2f>HoughLinesP() : 직선의 시작, 끝점 검출, 결과 vector<Vec4i>HoughCircles() : HOUGH_GRADIENT 보다 HOUGH_GRADIENT_ALT 방법이 더 좋다cornerHarris()goodFeaturesToTrack() : 코너점 좌표 결과 vector<Point2f> FAST() : 키포인트 검출 vector<KeyPoint>threshold()THRESHOLD_BINARY, THRESHOLD_BINARY_INV, THRESH_OTSUadaptiveThreshold()erode()dilate() getStructuringElement()morphologyEx()에서 MORPH_OPEN, MORPH_CLOSE 사용