Ask Your Question
1

has updateMotionHistory been removed from OpenCV 3 python 3?

asked 2015-05-10 10:35:24 -0600

ryanvade gravatar image

I am trying to resurrect some old object tracking code written for opencv2 and python 2. Currently I am using opencv 3 (directly from the git repository) and python 3. Due to the method name changes (WHY is everything renamed? There must be a reason but everything is broken) I am going through everything and replacing the methods with the new ones. I can't seem to find a replacement for updateMotionHistory. Has it been removed completely? I

edit retag flag offensive close merge delete

Comments

hmm,

yes, it was moved to opencv_contrib, into the optflow module there

but yes, it should be wrapped to python (from cv2.optflow) but is not.

hmm.

berak gravatar imageberak ( 2015-05-10 10:52:01 -0600 )edit
1

IS there a good changelog somewhere that has differences between the cv2 and cv3? I wish the wiki had name change information for each of the functions.

ryanvade gravatar imageryanvade ( 2015-05-10 11:06:59 -0600 )edit

so, you already found the wiki (roadmap,activity,issues to watch there).

another good one: http://docs.opencv.org/ref/master/db/...

berak gravatar imageberak ( 2015-05-10 11:38:22 -0600 )edit
1

so , i checked. there's a problem/bug related to namespaces. if you want updateMotionHistory in python:

  • get https://github.com/Itseez/opencv_contrib
  • make a new branch for your hack (keep master clean !)
  • opencv_contrib\modules\optflow\include\opencv2\optflow\motempl.hpp - change namespace from motempl to optflow, same for opencv_contrib\modules\optflow\src\motempl.cpp
  • cmake, make, make install.

then, finally, use: cv2.optflow.updateMotionHistory(...)

berak gravatar imageberak ( 2015-05-10 11:52:42 -0600 )edit

you know this chinese curse ? "may you live in 'interesting' times..."

berak gravatar imageberak ( 2015-05-10 11:57:36 -0600 )edit

Where is this bug?

ryanvade gravatar imageryanvade ( 2015-05-10 12:00:44 -0600 )edit

the bug is, that the generator script (for the python/java wrappers) sees module optflow, and expects things in namespace cv::optflow, but it finds cv::motempl, and gets confused.

(sorry for not being explicit enough here before)

berak gravatar imageberak ( 2015-05-10 12:04:01 -0600 )edit

Slightly off topic but if you have experience with Arch Linux packages, does this pkgbuild look right for building opencv with the contrib repo: http://slexy.org/view/s2zowjaWY3

ryanvade gravatar imageryanvade ( 2015-05-10 12:05:39 -0600 )edit

sorry, no idea about either arch or pkgbuild

berak gravatar imageberak ( 2015-05-10 12:07:05 -0600 )edit

okay thanks. IS the bug just with the git version? Is 3.0.0-rc1 affected as well?

ryanvade gravatar imageryanvade ( 2015-05-10 12:10:56 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-01-15 17:57:51 -0600

marco gravatar image

Using the version 3.1.0 compiled with opencv_contrib in python 2, the method is in the module motempl, so you can use as: cv2.motempl.updateMotionHistory(...)

edit flag offensive delete link more

Comments

Thanks this worked perfect!

PWillaert gravatar imagePWillaert ( 2018-12-02 04:35:59 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-05-10 10:35:24 -0600

Seen: 2,883 times

Last updated: May 10 '15