def filter(self, p):
"""
Parameters
----------
p: NDArray
Filtering input which is 2D or 3D with format
HW or HWC
Returns
-------
ret: NDArray
Filtering output whose shape is same with input
"""
p = to_32F(p)
if len(p.shape) == 2:
return self._Filter.filter(p)
elif len(p.shape) == 3:
channels = p.shape[2]
ret = np.zeros_like(p, dtype=np.float32)
for c in range(channels):
ret[:, :, c] = self._Filter.filter(p[:, :, c])
return ret
评论列表
文章目录