I have a problem while installing opencv in m1 Mac:
Undefined symbol: cv::Mat::Mat(int, int, int)
Undefined symbol: cv::Mat::~Mat()
Undefined symbol: cv::imshow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cv::_InputArray const&)
Undefined symbol: cv::waitKey(int)
Linker command failed with exit code 1 (use -v to see invocation)
I get this error when I try to run normal code with opencv:
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
int main(){
cv::Mat imMat(400,400, CV_8UC3);
for(int y = 0 ; y < imMat.rows; y++){
for(int x = 0 ; x < imMat.cols; x++){
cv::Vec3b &p = imMat.at<cv::Vec3b>( y, x);
p[0] = x;
p[1] = y;
p[2] = (int)((x+y)/2);
}
}
imshow("openCVTest",imMat);
waitKey(0);
return 0;
}
To install OpenCV in Xcode through Homebrew, I followed these steps:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
brew install opencv
pkg-config --modversion opencv4
And finally I added the installation in Header Search Paths (Xcode) with c++ Language Dialect C++-11.
Aucun commentaire:
Enregistrer un commentaire