Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cv2 optflow attributes part of main module in newest version #15

Open
RubenImhoff opened this issue Nov 17, 2020 · 1 comment
Open

cv2 optflow attributes part of main module in newest version #15

RubenImhoff opened this issue Nov 17, 2020 · 1 comment

Comments

@RubenImhoff
Copy link

RubenImhoff commented Nov 17, 2020

Hi Georgy,

I found out that in the latest version(s) of cv2, the creatOptFlow attributes are no longer part of cv2.optflow, but of the main branch of cv2, so:

    # calculate dense flow
    if method == "Farneback":
        of_instance = cv2.optflow.createOptFlow_Farneback()
    elif method == "DIS":
        of_instance = cv2.optflow.createOptFlow_DIS()
    elif method == "DeepFlow":
        of_instance = cv2.optflow.createOptFlow_DeepFlow()
    elif method == "PCAFlow":
        of_instance = cv2.optflow.createOptFlow_PCAFlow()
    elif method == "SimpleFlow":
        of_instance = cv2.optflow.createOptFlow_SimpleFlow()
    elif method == "SparseToDense":
        of_instance = cv2.optflow.createOptFlow_SparseToDense()

will become (e.g.):

    # calculate dense flow
    elif method == "DIS":
        of_instance = cv2.DISOpticalFlow_create()

For robustness, perhaps an idea to check for the cv2-version and adjust this part of the code to that?

@hydrogo
Copy link
Owner

hydrogo commented Nov 26, 2020

Hi @RubenImhoff,
Thanks for pointing that out. I will definitely do that in the next release (sad frog).
At the moment, rainymotion explicitly requires OpenCV of version 3.4.* (in .yml file). I hope this solution will work further until a more elegant solution comes.

All the best,
Georgy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants