我正在尝试为 ARM 目标编译 OpenCV 应用程序。
我交叉编译了所有库,但是当我尝试编译我的代码时:
#include<opencv2/imgcodecs.hpp>
#include<opencv2/highgui.hpp>
#include<opencv2/imgproc.hpp>
#include<opencv2/objdetect.hpp>
#include<iostream>
using namespace std;
using namespace cv;
int main(int argc, char **argv) {
VideoCapture video(0);
CascadeClassifier facedetect;
Mat img;
facedetect.load("haarcascade_frontalface_default.xml");
while (true) {
video.read(img);
vector<Rect> faces;
facedetect.detectMultiScale(img, faces, 1.3, 5);
cout << faces.size() << endl;
for (int i = 0; i < faces.size(); i++) {
rectangle(img, faces[i].tl(), faces[i].br(), Scalar(50, 50, 255), 3);
rectangle(img, Point(0,0), Point(250,70), Scalar(50, 50, 255), FILLED);
putText(img, to_string(faces.size())+" Face Found", Point(10, 40), FONT_HERSHEY_DUPLEX, 1, Scalar(255, 255, 255), 1);
}
imshow("Frame", img);
waitKey(1);
}
return 0;
}
使用此命令 →
/home/apc1wi/Documents/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-g++ test.cpp -o test_EVAL -I /usr/local/include/opencv4 -L/home/apc1wi/Documents/opencv_crosscompile/opencv-4.x/build/lib/ -lopencv_core -lopencv_highgui -lopencv_imgproc.so
我收到这个错误
找不到 -lopencv_imgproc.so collect2:错误:ld 返回 1 退出状态
注意:库就在那里,还有 highui 和它似乎找到的核心。有什么建议吗?