## Writing simple optical flow in python. Part 3

December 21, 2014 · SergeM

## Writing simple optical flow in python. Part 2

After fixing some errors, it seems my OF is working. [](https://www.blogger.com/blogger.g?blogID=636453477220885924" imageanchor=“1” style=“clear: right; float: right; margin-bottom: 1em; margin-left: 1em;) [](https://www.blogger.com/blogger.g?blogID=636453477220885924" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;)Image I0Image I1 [](https://www.blogger.com/blogger.g?blogID=636453477220885924" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;)first iteration OF 1st iteration of warped I1 Second Iteration OF Second iteration of warped I1 3 iteration Of 3rd iteration of warped I1 Last iteration Some strange results for another image pair:...

December 20, 2014 · SergeM

## Writing simple optical flow in python

First of all we need a couple of test images: # import numpy from StringIO import StringIO I0 = numpy.loadtxt(StringIO(""" 0 0 0 0 0 0 0 0.5000 0 0 0 0 1.0000 0 0 0 0 0.5000 0 0 0 0 0 0 0""") ) I1 = numpy.loadtxt(StringIO(""" 0 0 0 0 0 0 0.5 0 0 0 0 1.0 0 0 0 0 0.5 0 0 0 0 0 0 0 0 "...

November 30, 2014 · SergeM

## Quiver for optical flow

Standard matlab’s quiver function has axis origin in left bottom corner, however, images have origin in top left corner. To display optical flow vector field consistenly i use the following fucntion: function [ output ] = quiver_flow( u, v ) %QUIVER_FLOW Displays quiver for optical flow % SMatyunin2014 output = quiver( u, v, 0); axis ij; end

November 6, 2014 · SergeM

## Simple tests of classic OF methods

BA method, simple synthetic images For simple synthetic images: I0 = 0 0.5000 0 0 1.0000 0 0 0.5000 0 0.1000 0 0 0.0500 0 0 0.0500 0.1000 0 I1 = 0.5000 0 0 1.0000 0 0 0.5000 0 0 0 0.1000 0 0 0.0500 0 0 0.0500 0.1000 Running code by D.Sun. Disabled texture decomposition, disabled multiscale processing. uv = estimate_flow_interface(I0, I1, 'classic-c-brightness', [], {'display', 1, 'pyramid_levels', 1, 'gnc_pyramid_levels', 1}); After first iteration ( loop for ignc = 1:this....

November 5, 2014 · SergeM

## Graduated non convexity scheme (GNC)

Optimization of energy terms can be difficult in OF, because of non-convexity and local optima. Construct a series of energy functions EQ is convex, quadratic alpha changes from 1 to 0, so Energy Ec changes from quadratic to original. for each alpha they find optimum through setting derivatives of Ec to 0. Solution on each stage becomes initialization on the next one. Proposed in: D. Sun, S. Roth, J. Lewis, and M....

November 5, 2014 · SergeM

## Investigating optical flow by D. Sun (Secrets of optical flow)

Personal page of the author: http://cs.brown.edu/~dqsun/research/index.html Original paper: http://cs.brown.edu/~dqsun/pubs/cvpr_2010_flow.pdf Newer paper: Deqing Sun, Stefan Roth, and Michael J. Black. “A Quantitative Analysis of Current Practices in Optical Flow Estimation and the Principles Behind Them”. International Journal of Computer Vision (IJCV), 2013 [ pdf] [Source code] Look inside the sources: @alt_ba_optical_flow\ @ba_optical_flow\ ... compute_flow_base.m itarates: Iterate flow computation Linearization update, for j = 1:this.max_linear. In the simple case max_linear==1, when I use x = A\b solver for linear system....

November 5, 2014 · SergeM

## То, что вы хотели знать про оптический поток, но стеснялись спросить

Взято с http://habrahabr.ru/post/201406/ see also Deep Learning в вычислении оптического потока Объяснение оптического потока из OpenCV для тех, кто не в теме и не очень хочет разобраться. Обработка изображений*, Алгоритмы*Оптический поток (Optical flow) – технология, использующаяся в различных областях computer vision для определения сдвигов, сегментации, выделения объектов, компрессии видео. Однако если мы захотим его по-быстрому реализовать в своем проекте, прочитав про него на википедии или где-нибудь еще, то, скорее всего, очень быстро наткнемся на то, что он работает очень плохо и сбоит при определении сдвигов уже порядка 1-2 пикселей (по крайней мере так было у меня)....

November 12, 2013 · SergeM