我有以下计划:
#include <iostream>
#include <vector>
#include "opencv2/opencv.hpp"
#include <stdio.h>
using namespace std;
using namespace cv;
int main(int argc, const char** argv)
{
Mat A = (Mat_<double>(3,3) << -3,-2,-1, 0,1,2, 3,4,5);
imshow("aa", A);
waitKey(0);
cout << "A = " << endl << " " << A << endl << endl;
Mat B;
threshold(A, B, 0, 255, THRESH_TOZERO);
cout << "B = " << endl << " " << B << endl << endl;
}
编译正好。我正在编译如下:
g ++ a.cpp pkg-config opencv --libs
pkg-config opencv --cflags
但是当我评论两行时,它会给出编译错误:
#include <iostream>
#include <vector>
#include "opencv2/opencv.hpp"
#include <stdio.h>
using namespace std;
using namespace cv;
int main(int argc, const char** argv)
{
Mat A = (Mat_<double>(3,3) << -3,-2,-1, 0,1,2, 3,4,5);
// imshow("aa", A);
// waitKey(0);
cout << "A = " << endl << " " << A << endl << endl;
Mat B;
threshold(A, B, 0, 255, THRESH_TOZERO);
cout << "B = " << endl << " " << B << endl << endl;
}
如下:
...../opencv/lib/libopencv_imgproc.so: undefined reference to `m7_ippiFilterSobelVertBorder_32f_C1R'
...../opencv/lib/libopencv_imgproc.so: undefined reference to `n8_ippiFilterSobelNegVertBorder_32f_C1R'
...../opencv/lib/libopencv_imgproc.so: undefined reference to `k0_ippiFilterSobelVertBorder_32f_C1R'
...../opencv/lib/libopencv_imgproc.so: undefined reference to `mx_ippiFilterSobelVertBorder_8u16s_C1R'
...../opencv/lib/libopencv_imgproc.so: undefined reference to `y8_ippiFilterSobelHorizBorder_32f_C1R'
...../opencv/lib/libopencv_imgproc.so: undefined reference to `e9_ippiFilterSobelVertBorder_32f_C1R'