我在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环境,我还是个新手,所以我不知道哪里出错了。
答案 0 :(得分:3)
#include <opencv2/video/tracking.hpp>