Mathematical Morphology - Opening operation on sphere in a box

272 Views Asked by At

The output of the opening operation with a structuring element (ball) radius as 1I am applying the opening operation on a sphere in a box. The sphere in the box is represented by a binary image on which opening is applied. The structuring element I am using is a ball of different radii. On applying the opening operation, if my structuring element (ball) has a radius less than the radius of the sphere, then I should get back the original image. However, if the radius of the ball is equal to or larger than the sphere, the output image should be blank. This is what the opening operation should do. But, I am not getting back the original image when the ball radius is less than the radius of the sphere. I know this by comparing the volumes of the input and output spheres. Should I expect such an outcome or is there something I am doing wrong? I am using the skimage library for performing the opening operation. I have attached images below. There is a difference between the input and the output images (some of the points are missing after the opening operation is applied.) TIA

The input sphere of radius 2

This is the piece of code I am using.

Ball_rad = 1
ball = skimage.morphology.ball(Ball_rad,dtype = 'int')
output_image = skimage.morphology.binary_opening(image, ball)
0

There are 0 best solutions below