Friday, October 10, 2025
HomeLanguagesMahotas – Getting Disk Structuring Element of given radius

Mahotas – Getting Disk Structuring Element of given radius

In this article we will see how we can get binary disk structuring element of given radius of the image in mahotas. A flat structuring element is a binary valued neighborhood, either 2-D or multidimensional, in which the true pixels are included in the morphological computation, and the false pixels are not. The center pixel of the structuring element, called the origin, identifies the pixel in the image being processed.

In this tutorial we will use “lena” image, below is the command to load it.

mahotas.demos.load('lena')

Below is the lena image

In order to do this we will use mahotas.disk method

Syntax : mahotas.disk(radius)

Argument : It takes integer as argument

Return : It returns image object

Below is the implementation




# importing required libraries
import mahotas
import numpy as np
from pylab import gray, imshow, show
import os
  
# getting disk of given radius
disk = mahotas.disk(10)
  
# showing disk image
imshow(disk)
show()


Output :

Another example




# importing required libraries
import mahotas
import numpy as np
from pylab import gray, imshow, show
import os
  
# getting disk of given radius
disk = mahotas.disk(98)
  
# showing disk image
imshow(disk)
show()


Output :

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32348 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6715 POSTS0 COMMENTS
Nicole Veronica
11878 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11941 POSTS0 COMMENTS
Shaida Kate Naidoo
6837 POSTS0 COMMENTS
Ted Musemwa
7097 POSTS0 COMMENTS
Thapelo Manthata
6792 POSTS0 COMMENTS
Umr Jansen
6791 POSTS0 COMMENTS