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

Code highlight in blogger

Source place following code before your <head> tag in the HTML of your blogger template: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 <link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css"></link> <link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css"></link> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js" type="text/javascript"></script> <script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js" type="text/javascript"></script> <script src="http://alexgorbatchev....

November 4, 2014 · SergeM

Save Ipython notebook as script with the same filename

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 # creating a variable theNotebook with the name of notebook # source: http://stackoverflow.com/a/23619544 # In[1]: %%javascript var kernel = IPython.notebook.kernel; var thename = window.document.getElementById("notebook_name").innerHTML; var command = "theNotebook = " + "'"+thename+"'"; kernel.execute(command); # saving to a directory 'backup'. create the directory if it doesn't exist # source http://stackoverflow....

September 21, 2014 · SergeM

Python equivalent of interp2

I wrote python version of interp2(z, xi, yi,’linear’) from matlab https://github.com/serge-m/pyinterp2

September 16, 2014 · SergeM

Simple occlusion filling for depth maps

As an example I use images from middleburry. Solution is very dirty and slow. [https://github.com/serge-m/depth_map_occlusion](https://github.com/serge-m/depth_map_occlusion" target="_blank) # In[1]: import numpy import scipy import matplotlib.pyplot as plt In[2]: from scipy import ndimage import numpy as np kernels for shift k = np.array([ [[0,0,0], [0,0,1], [0,0,0],], [[0,1,0], [0,0,0], [0,0,0],], [[0,0,0], [1,0,0], [0,0,0],], [[0,0,0], [0,0,0], [0,1,0],], [[1,0,0], [0,0,0], [0,0,0],], [[0,0,1], [0,0,0], [0,0,0],], [[0,0,0], [0,0,0], [0,0,1],], [[0,0,0], [0,0,0], [1,0,0],], ]) In[8]: from scipy import misc...

September 1, 2014 · SergeM

ipython. save notebook as script

Joint solution from [http://stackoverflow.com/a/23619544](http://stackoverflow.com/a/23619544" target="_blank) and [http://stackoverflow.com/a/19067979](http://stackoverflow.com/a/19067979" target="_blank) # [1] %%javascript var kernel = IPython.notebook.kernel; var thename = window.document.getElementById("notebook_name").innerHTML; var command = "theNotebook = " + "'"+thename+"'"; kernel.execute(command); [2] try : if(__IPYTHON__) : get_ipython().system(u’ipython nbconvert –to python {}.ipynb’.format(theNotebook)) except NameError : pass

August 31, 2014 · SergeM

Use Matlab function from python

There are several solutions: Source: http://stackoverflow.com/questions/2883189/calling-matlab-functions-from-python pymatA low level interface to Matlab using the matlab engine (libeng) for communication (basically a library that comes with matlab). The module has to be compiled and linked with libeng. [http://pymat.sourceforge.net](http://pymat.sourceforge.net/" rel="nofollow) Last updated: 2003 pymat2A somewhat short lived continuation of the pymat development. Seems to work on windows (including 64bit), linux and mac (with some changes). [https://code.google.com/p/pymat2/](https://code.google.com/p/pymat2/" rel="nofollow) Last updated: 2012 mlabwrapA high level interface that also comes as a module which needs compilation and linking against libeng....

August 31, 2014 · SergeM

Pylearn2 out of memory error

I am trying to train NN using pylearn2 I use stochastic gradient decent. I had always a message about failed GPU memory allocation in train->self.sgd_update(*batch) To fix it, I reduced size of the batch in yaml-config: batch_size: 200 was replaced by batch_size: 100

August 14, 2014 · SM!

tikz cookbook

Drawing on an image with TikZ Drawing label on figure (using tikz) \begin{tikzpicture} \node[anchor=south west,inner sep=0] at (0,0) {\includegraphics[trim={600px 200px 50px 200px},clip, width=1\linewidth]{images/DP_10150_simpleCombinedBasedOnDPlen.exe_scale1_blank/frm00001}}; %\draw[white,fill=white] (0.0,0.0) rectangle (0.5,0.5); \node[minimum size=.6cm, fill=white,anchor=south west] at (0.0,0.0){а}; \end{tikzpicture}

July 16, 2014 · SergeM