我在 OpenCV 2.4.2 上遇到了这个错误。
我正在使用这行代码:
cv::calcOpticalFlowPyrLK(prev, next, prev_pts, next_pts, status, error);
并在编译时显示此错误:
testopticalflow.cpp:75:4: error: ‘calcOpticalFlowPyrLK’ is not a member of ‘cv’
这是我使用 pkg-config 的结果
pkg-config opencv --libs
/usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_ts.so /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so
抱歉,在 Linux 环境方面我还是个新手,所以我不知道我哪里出错了。