Loading Image using Mahotas – Python

In this article we will see can load image in mahotas. Mahotas is a computer vision and image processing and manipulation library for Python. A library is a collection of functions and methods that allows you to perform many actions without having to write hundreds of lines of code. Mahotas includes many algorithms that operates with arrays, mahotas currently has over 100 functions for image processing and computer vision and is constantly growing.

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

Syntax : mahotas.imread(image_name)

Argument : It takes string as argument which is image name

Return : It returns numpy.ndarray object



Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

# importing required libraries
import numpy as np
import mahotas
from pylab import imshow, show
  
# loading iamge
img = mahotas.imread('dog_image.png')
  
# showing the original image
imshow(img)
show()

chevron_right


Output :

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# importing required libraries
import numpy as np
import mahotas
from pylab import imshow, show
  
# loading iamge
img = mahotas.imread('wally.png')
  
# showing the image
imshow(img)
show()

chevron_right


Output :

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.