DEV Community

kevq
kevq

Posted on • Edited on

[c++] using opencv on windows with clion

  1. download windows version

    OpenCV - Open Computer Vision Library

    OpenCV provides a real-time optimized Computer Vision library, tools, and hardware. It also supports model execution for Machine Learning (ML) and Artificial Intelligence (AI).

    favicon opencv.org
  2. cd new build folder
  3. run cmake cmake -G "MinGW Makefiles" -S <source>
  4. build opencv mingw32-make -j8
  5. install opencv mingw32-make install
  6. update cmakelists


# include opencv library
set(OpenCV_DIR "C:/Program Files (x86)/opencv/mingw_build/install")
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})

target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})


Enter fullscreen mode Exit fullscreen mode

7, edit configuration, add environment variables:
Image description

if not work, add the path in #7 to system environment path

Top comments (0)