Make TV-L1 rescaling flexible and add median filtering#693
Make TV-L1 rescaling flexible and add median filtering#693stefan-w wants to merge 1 commit intoopencv:masterfrom stefan-w:TVL1-updates
Conversation
Previously the pyramid was done with a rescaling factor of 2 (implied by the use of pyrDown). This often leads to inferior results compared to a scale step of e.g. 0.8 (a factor of 2 is obviously faster). This commit makes the scale step configurable and uses a resonable default value. The other change in this commit is that median filtering is added. This is not described in this paper but it is done in the author's implementation. (See e.g. "Secrets of optical flow estimation and their principles", Sun et al., CVPR 2010) This serves as periodic outlier removal during optimization, leading to smoother flow fields while preserving motion edges. This includes splitting the optimization loop into two loops.
|
@vpisarev Vadim, please, review this request. |
|
Vlad, can I reassign the pull request to you? You seem to be a better candidate for reviewing it |
|
👍 |
|
One thing I am not sure about here is that this takes a parameter away from the algorithm and introduces two new ones, which breaks compatibility. But I don't know if there's a nicer way to do it - if backwards compatibility is a high priority one could keep the "iterations" parameter, add a "filteringInterval" parameter that controls the interval of median filtering. But then you'd need to ensure that iterations % filteringInterval == 0 so that median filtering does not happen at or near the end of optimization, so an algorithm that sets iterations only also breaks. The only way to keep compatibility that I can think of would be to do the above and disable filtering by default, however then by default you get not-so-nice results ... |
|
master branch is not binary compatible with 2.4 version. So I think it's not a problem. |
|
Thanks for your update. I created new pull request with your commit and updated test data. I also updated GPU version. |
|
Closed coz #724 is in a good shape now. |
Previously the pyramid was done with a rescaling factor of 2 (implied by the
use of pyrDown). This often leads to inferior results compared to a scale step
of e.g. 0.8 (a factor of 2 is obviously faster). This commit makes the scale
step configurable and uses a resonable default value.
The other change in this commit is that median filtering is added. This is not
described in this paper but it is done in the author's implementation. (See
e.g. "Secrets of optical flow estimation and their principles", Sun et al.,
CVPR 2010) This serves as periodic outlier removal during optimization, leading
to smoother flow fields while preserving motion edges. This includes splitting
the optimization loop into two loops.