I am trying to use Shai Bagon's (@Shai) Graph Cut MATLAB Toolbox GCMex for the model from Statistics of Patch Offsets for Image Completion (Image Completion Approaches Using the Statistics of Similar Patches).
The model is given by:
Let's say the number of labels (Shifts) is 4 (Up by 1, down by 2, right by 3 or left by 4) to make things simpler.
I am still not sure how to set the data structures (Arrays) to utilize the solver.
Does anyone have idea?
I'm not sure my GCMex implementation supports this type of smoothness term.
If I understand correctly, you need, for each neighboring
i
,j
to compute a differentL
xL
matrix of weights. The underlying c++ package (by Boykov et al) does support this, but I did not create an interface for this option.Update:
Let's say you have
n
pixels andl
possible labels.The current GCMex interface supports pair-wise weights of the form:
That is, the main "source" of pair wise penalty is a fixed
l
xl
matrixS(L(i), L(j))
that defines the penalty of assigning neighboring pixelsi
andj
to labelsL(i)
andL(j)
respectively. Thisl
xl
weight does not depend on the location of the pixelsi
andj
only on their labelsL(i)
andL(j)
.The only spatial dependency comes from a scalar
w(i,j)
that modulatesS
by a scalar that depends on the locaiton ofi
andj
.However, it seems like in your case, what you actually need is a
l
xl
matrix for each pairi
andj
.I think you should look into
void setSmoothness(smoothFnCoord cost);
.