Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
@@ -133,9 +133,9 @@ Dense Optical Flow in OpenCV.js
|
||||
|
||||
Lucas-Kanade method computes optical flow for a sparse feature set (in our example, corners detected
|
||||
using Shi-Tomasi algorithm). OpenCV.js provides another algorithm to find the dense optical flow. It
|
||||
computes the optical flow for all the points in the frame. It is based on Gunner Farneback's
|
||||
computes the optical flow for all the points in the frame. It is based on Gunnar Farneback's
|
||||
algorithm which is explained in "Two-Frame Motion Estimation Based on Polynomial Expansion" by
|
||||
Gunner Farneback in 2003.
|
||||
Gunnar Farneback in 2003.
|
||||
|
||||
We use the function: **cv.calcOpticalFlowFarneback (prev, next, flow, pyrScale, levels, winsize,
|
||||
iterations, polyN, polySigma, flags)**
|
||||
|
||||
@@ -78,7 +78,7 @@ if len(good)>MIN_MATCH_COUNT:
|
||||
M, mask = cv.findHomography(src_pts, dst_pts, cv.RANSAC,5.0)
|
||||
matchesMask = mask.ravel().tolist()
|
||||
|
||||
h,w,d = img1.shape
|
||||
h,w = img1.shape
|
||||
pts = np.float32([ [0,0],[0,h-1],[w-1,h-1],[w-1,0] ]).reshape(-1,1,2)
|
||||
dst = cv.perspectiveTransform(pts,M)
|
||||
|
||||
|
||||
@@ -139,9 +139,9 @@ Dense Optical Flow in OpenCV
|
||||
|
||||
Lucas-Kanade method computes optical flow for a sparse feature set (in our example, corners detected
|
||||
using Shi-Tomasi algorithm). OpenCV provides another algorithm to find the dense optical flow. It
|
||||
computes the optical flow for all the points in the frame. It is based on Gunner Farneback's
|
||||
computes the optical flow for all the points in the frame. It is based on Gunnar Farneback's
|
||||
algorithm which is explained in "Two-Frame Motion Estimation Based on Polynomial Expansion" by
|
||||
Gunner Farneback in 2003.
|
||||
Gunnar Farneback in 2003.
|
||||
|
||||
Below sample shows how to find the dense optical flow using above algorithm. We get a 2-channel
|
||||
array with optical flow vectors, \f$(u,v)\f$. We find their magnitude and direction. We color code the
|
||||
|
||||
Reference in New Issue
Block a user