Hi,
I want to apply morphological closing on a 3D grayscale/binary batched tensor. So far, i tried:
# importing modules
import torch
import torch.nn as nn
import torch.nn.functional as F
from kornia import morphology as morph
# creating random input
input_tensor = torch.rand(1,1,8,8,8)
print(input_tensor[:,:,:,:,0])
# applying morphological closing
morph_kernel = torch.ones(3,3,3)
result = morph.closing(input_tensor, morph_kernel)
print(result[:,:,:,:,0])
But it leads to this error:
ValueError: Input size must have 4 dimensions. Got 5
Do you know a way to perform closing on 3D tensors (B,C,X,Y,Z) with kornia ? (or any other way working on tensors and allowing backpropagation)
Thanks