diff --git a/VideoStabilization/video_stabilization.py b/VideoStabilization/video_stabilization.py index 8eee1f47f..692442074 100644 --- a/VideoStabilization/video_stabilization.py +++ b/VideoStabilization/video_stabilization.py @@ -91,7 +91,11 @@ def fixBorder(frame): curr_pts = curr_pts[idx] #Find transformation matrix - m = cv2.estimateRigidTransform(prev_pts, curr_pts, fullAffine=False) #will only work with OpenCV-3 or less + if int((cv2.__version__).split('.')[0]) <= 3: + m = cv2.estimateRigidTransform(prev_pts, curr_pts, fullAffine=False) #will only work with OpenCV-3 or less + + else: + m,_ = cv2.estimateAffine2D(prev_pts, curr_pts)# will work with OpenCV>3.0 # Extract traslation dx = m[0,2] @@ -165,4 +169,4 @@ def fixBorder(frame): cap.release() out.release() # Close windows -cv2.destroyAllWindows() \ No newline at end of file +cv2.destroyAllWindows()