0
我在相對較小(288 x 360)的交通視頻上使用光流,並且出現問題。我無法獲得幀中某些地方的光流向量。 此圖像顯示中檢測到如由opencv光流不檢測大部分矢量
goodFeaturesToTrack()
函數這樣的 「好特徵以跟蹤」 的點:
vector<Point2f> features1;
vector<Point2f> features2;
int number_of_features = 2000;
goodFeaturesToTrack(frame1, features1 ,number_of_features,0.01,0.01);
和你看到很多點被發現在後面,但是當我使用
calcOpticalFlowPyrLK()
獲得光流矢量是這樣的:
TermCriteria optical_flow_termination_criteria= TermCriteria(CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, 10, .001);
calcOpticalFlowPyrLK(
frame1, frame2, features1, features2,
optical_flow_found_feature,optical_flow_feature_error,
Size(21,21),5,optical_flow_termination_criteria
);
它僅在前返回點作爲在圖像吹塑:
但我需要所有視頻的載體。那麼我怎樣才能從後面獲得載體呢?
編輯:
我做錯了什麼是我過濾小向量。
你可以顯示'calcOpticalFlowPyrLK'和繪製矢量之間的步驟嗎? –
謝謝!問題是一個單行過濾器,我注意到我的函數使用有問題。如果您添加答案,我會將其標記爲正確 –