INNER CODE UNIT · Python
create_pairwise_gaussian
lucasb-eyer/pydensecrf · pydensecrf/utils.py:89
def create_pairwise_gaussian(sdims, shape):
"""
Util function that create pairwise gaussian potentials. This works for all
image dimensions. For the 2D case does the same as
`DenseCRF2D.addPairwiseGaussian`.
Parameters
----------
sdims: list or tuple
The scaling factors per dimension. This is referred to `sxy` in
`DenseCRF2D.addPairwiseGaussian`.
shape: list or tuple
The shape the CRF has.
"""
# create mesh
hcord_range = [range(s) for s in shape]
mesh = np.array(np.meshgrid(*hcord_range, indexing='ij'), dtype=np.float32)