spmallick / learnopencv

Learn OpenCV : C++ and Python Examples
https://www.learnopencv.com/
21.11k stars 11.58k forks source link

Contrib: CMake example #139

Open paulocoutinhox opened 6 years ago

paulocoutinhox commented 6 years ago

Hi,

This is a simple CMake example if anyone want:

File: /CMakeLists.txt

cmake_minimum_required(VERSION 3.0)
project(mask_rcnn)

set(FILES_SRC
    mask_rcnn.cpp
)

find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(mask_rcnn ${FILES_SRC})
target_link_libraries(mask_rcnn ${OpenCV_LIBS})

How to use:

rm -rf build/ && mkdir build && cd build && cmake ../ && make && cp mask_rcnn ../ && cd .. && ./mask_rcnn

Or separate if you want:

rm -rf build/  
mkdir build  
cd build  
cmake ../  
make  
cp mask_rcnn ../  
cd ..  
./mask_rcnn  

If you are using macOS, you can install "brew" and use "brew" to install "cmake" and "opencv" with commands:

brew install cmake  
brew install opencv  

Thanks.

sakshiseth commented 4 years ago

@vikasgupta-github This can be added in our document for reference. This issue can be closed. Thank you @prsolucoes for this example.