Skip to content

Instantly share code, notes, and snippets.

@robotsorcerer
Created May 4, 2017 15:59
Show Gist options
  • Save robotsorcerer/21811ae7a7d745ba3f570049e46ed136 to your computer and use it in GitHub Desktop.
Save robotsorcerer/21811ae7a7d745ba3f570049e46ed136 to your computer and use it in GitHub Desktop.
Compiles Opencv.cpp examples. Simply create a build dir within the samples.cpp dir of your opencv clone and build with cmake . && make -j
cmake_minimum_required(VERSION 2.8.3)
project(opencv_examples)
OPTION(ENABLE_CXX11 "Enable C++11 support" ON)
IF(ENABLE_CXX11)
INCLUDE(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
IF(COMPILER_SUPPORTS_CXX11)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ELSEIF(COMPILER_SUPPORTS_CXX0X)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
ELSE()
MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
ENDIF()
ENDIF(ENABLE_CXX11)
find_package(PkgConfig)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
macro(add_example name)
add_executable(${name} ../${name}.cpp)
target_link_libraries(${name} ${OpenCV_LIBS})
endmacro()
link_directories(${OpenCV_LIBS})
add_example(3calibration)
add_example(autofocus)
add_example(bgfg_segm)
add_example(calibration)
add_example(camshiftdemo)
add_example(cloning_demo)
add_example(cloning_gui)
add_example(connected_components)
add_example(contours2)
add_example(convexhull)
add_example(cout_mat)
add_example(create_mask)
add_example(dbt_face_detection)
add_example(delaunay2)
add_example(demhist)
add_example(detect_blob)
add_example(detect_mser)
add_example(dft)
add_example(distrans)
add_example(drawing)
add_example(edge)
add_example(em)
add_example(facedetect)
add_example(facial_features)
add_example(fback)
add_example(ffilldemo)
add_example(filestorage_base64)
add_example(filestorage)
add_example(fitellipse)
add_example(grabcut)
add_example(houghcircles)
add_example(houghlines)
add_example(image_alignment)
add_example(image)
add_example(imagelist_creator)
add_example(image_sequence)
add_example(inpaint)
add_example(intelperc_capture)
add_example(kalman)
add_example(kmeans)
add_example(laplace)
add_example(letter_recog)
add_example(lkdemo)
add_example(logistic_regression)
add_example(lsd_lines)
add_example(mask_tmpl)
add_example(matchmethod_orb_akaze_brisk)
add_example(minarea)
add_example(morphology2)
add_example(neural_network)
add_example(npr_demo)
add_example(opencv_version)
add_example(openni_capture)
add_example(pca)
add_example(peopledetect)
add_example(phase_corr)
add_example(points_classifier)
add_example(polar_transforms)
add_example(segment_objects)
add_example(select3dobj)
add_example(shape_example)
add_example(smiledetect)
add_example(squares)
add_example(starter_imagelist)
add_example(stereo_calib)
add_example(stereo_match)
add_example(stitching)
add_example(stitching_detailed)
add_example(train_HOG)
add_example(train_svmsgd)
add_example(tree_engine)
add_example(tvl1_optical_flow)
add_example(videocapture_basic)
add_example(videocapture_starter)
add_example(videostab)
add_example(videowriter_basic)
add_example(watershed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment