MCPcopy Create free account
hub / github.com/InternRobotics/G2VLM / disk_kernel

Function disk_kernel

eval_code/recons/models/moge/utils/geometry_numpy.py:309–326  ·  view source on GitHub ↗

Generate disk kernel with given radius. Args: radius (int): Radius of the disk (in pixels). Returns: np.ndarray: (2*radius+1, 2*radius+1) normalized convolution kernel.

(radius: int)

Source from the content-addressed store, hash-verified

307
308
309def disk_kernel(radius: int) -> np.ndarray:
310 """
311 Generate disk kernel with given radius.
312
313 Args:
314 radius (int): Radius of the disk (in pixels).
315
316 Returns:
317 np.ndarray: (2*radius+1, 2*radius+1) normalized convolution kernel.
318 """
319 # Create coordinate grid centered at (0,0)
320 L = np.arange(-radius, radius + 1)
321 X, Y = np.meshgrid(L, L)
322 # Generate disk: region inside circle with radius R is 1
323 kernel = ((X**2 + Y**2) <= radius**2).astype(np.float32)
324 # Normalize the kernel
325 kernel /= np.sum(kernel)
326 return kernel
327
328
329def disk_blur(image: np.ndarray, radius: int) -> np.ndarray:

Callers 1

disk_blurFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected