MCPcopy Create free account
hub / github.com/UVA-Computer-Vision-Lab/FrameINO / pdf2

Function pdf2

utils/optical_flow_utils.py:184–195  ·  view source on GitHub ↗

Calculate PDF of the bivariate Gaussian distribution. Args: sigma_matrix (ndarray): with the shape (2, 2) grid (ndarray): generated by :func:`mesh_grid`, with the shape (K, K, 2), K is the kernel size. Returns: kernel (ndarrray): un-normalized kernel.

(sigma_matrix, grid)

Source from the content-addressed store, hash-verified

182
183
184def pdf2(sigma_matrix, grid):
185 """Calculate PDF of the bivariate Gaussian distribution.
186 Args:
187 sigma_matrix (ndarray): with the shape (2, 2)
188 grid (ndarray): generated by :func:`mesh_grid`,
189 with the shape (K, K, 2), K is the kernel size.
190 Returns:
191 kernel (ndarrray): un-normalized kernel.
192 """
193 inverse_sigma = np.linalg.inv(sigma_matrix)
194 kernel = np.exp(-0.5 * np.sum(np.dot(grid, inverse_sigma) * grid, 2))
195 return kernel
196
197def bivariate_Gaussian(kernel_size, sig_x, sig_y, theta, grid=None, isotropic=True):
198 """Generate a bivariate isotropic or anisotropic Gaussian kernel.

Callers 1

bivariate_GaussianFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected