Start by installing OpenCV4.0.1 with Homebrew
$ brew install opencv
If Open3.4.5 is installed
brew install [email protected]
** If you need –with OpenGL ** you need to [download] to [email protected] and change the compilation configuration.
brew install ./[email protected]
Update if you find any updates;
Then configure it in the CLion project cmMakelists.txt as follows:
cmake_minimum_required(VERSION 3.9)
project(untitled1)
set(CMAKE_CXX_STANDARD 11)
#find_library(OpenCV)
find_package(OpenCV)
include_directories(${OpenCV_INCLUDE_DIRS})
set(CMAKE_CXX_STANDARD 11)
add_executable(untitled1 main.cpp)
target_link_libraries(untitled1 ${OpenCV_LIBS})
Then you can write main.cpp to verify that:
#include <iostream>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main() {
Mat srcImage = imread("your_img_path.jpg");
if (!srcImage.data) {
std::cout << "Image not loaded";
return -1;
}
imshow("[img]", srcImage);
waitKey(0);
return 0;
}
You can display the photo, but if you can’t find the photo, change the path to the absolute path.
the original: https://blog.csdn.net/u010319740/article/details/79012810
Read More:
- error C2065: ‘cout’ : undeclared identifier
- Environment configuration at the beginning of OpenCV + vs2015
- error: `cout’ was not declared in this scope
- “Error: ` cout ‘was not declared in this scope”
- Project files may be invalid appears when cmake compiles opencv3.1, and the debug additional dependency of the compiled opencv3.1 is at the end
- Remove array duplicate elements
- CIN in C + + cin.get ()、 cin.getline (), getline(), gets() function
- P – Random Teams
- Undeclared identifier CV in opencv4.2.0_ WINDOW_ AUTOSIZE
- Problem solving – vs debugging window flash solution
- VS2010 debugging window flash solution
- Vector delete pop of element_ back(),erase(),remove()
- “Error in configuration process project files may be invalid” appears during cmake compilation
- 1143 Lowest Common Ancestor
- C++ foundation — clear/erase/pop of string class_back
- The use of C + + template function and lambda expression
- error LNK2038: mismatch detected for ‘RuntimeLibrary’: value ‘MTd_StaticDebug’ doesn’t match value ‘
- Finding the longest connection path of a string
- Error resolution-“Error in configuration process, project files may be invalid” appears when Cmake compiles openCV
- error: ‘::main’ must return ‘int’