pymatting.make_linear_system
🔗Signature
make_linear_system(
L,
trimap,
lambda_value=100.0,
return_c=False)
Function Description
This function constructs a linear system from a matting Laplacian by
constraining the foreground and background pixels with a diagonal matrix
C to values in the right-hand-side vector b. The constraints are
weighted by a factor \(\lambda\). The linear system is given as
$$ A = L + \lambda C,
$$
where \(C=\mathop{Diag}(c)\) having \(c_i = 1\) if pixel i is known
and \(c_i = 0\) otherwise.
The right-hand-side \(b\) is a vector with entries \(b_i = 1\) is
pixel is is a foreground pixel and \(b_i = 0\) otherwise.
Parameters
- L (scipy.sparse.spmatrix)
Laplacian matrix, e.g. calculated with lbdm_laplacian function
- trimap (numpy.ndarray)
- lambda_value (float)
Constraint penalty, defaults to 100
- return_c (bool)
Whether to return the constraint matrix C, defaults to False
Returns
- A (scipy.sparse.spmatrix)
- b (numpy.ndarray)
- C (numpy.ndarray)
Vector describing the diagonal entries of the matrix C, only returned if return_c is set to True