Mahotas – 加速强大的功能
在本文中,我们将看到如何在 mahotas 中获得图像的加速鲁棒特征。在计算机视觉中,加速鲁棒特征(SURF)是一种获得专利的局部特征检测器和描述符。它可用于对象识别、图像配准、分类或 3D 重建等任务。它的部分灵感来自尺度不变特征变换 (SIFT) 描述符。为此,我们将使用来自核分割基准的荧光显微镜图像。我们可以在下面给出的命令的帮助下获取图像
mahotas.demos.nuclear_image()
下面是nuclear_image
为此,我们将使用 surf.surf 方法
Syntax : surf.surf(img)
Argument : It takes image object as argument
Return : It returns numpy.ndarray
示例 1:
Python3
# importing various libraries
import mahotas
import mahotas.demos
import mahotas as mh
import numpy as np
from pylab import imshow, show
from mahotas.features import surf
# loading nuclear image
nuclear = mahotas.demos.nuclear_image()
# filtering image
nuclear = nuclear[:, :, 0]
# adding gaussian filter
nuclear = mahotas.gaussian_filter(nuclear, 4)
# showing image
print("Image")
imshow(nuclear)
show()
# getting Speeded-Up Robust Features
spoints = surf.surf(nuclear)
print("No of points: {}".format(len(spoints)))
Python3
# importing required libraries
import numpy as np
import mahotas
from pylab import imshow, show
from mahotas.features import surf
# loading image
img = mahotas.imread('dog_image.png')
# filtering the image
img = img[:, :, 0]
# setting gaussian filter
gaussian = mahotas.gaussian_filter(img, 5)
# showing image
print("Image")
imshow(gaussian)
show()
# getting Speeded-Up Robust Features
spoints = surf.surf(gaussian)
print("No of points: {}".format(len(spoints)))
输出 :
No of points: 217
示例 2:
Python3
# importing required libraries
import numpy as np
import mahotas
from pylab import imshow, show
from mahotas.features import surf
# loading image
img = mahotas.imread('dog_image.png')
# filtering the image
img = img[:, :, 0]
# setting gaussian filter
gaussian = mahotas.gaussian_filter(img, 5)
# showing image
print("Image")
imshow(gaussian)
show()
# getting Speeded-Up Robust Features
spoints = surf.surf(gaussian)
print("No of points: {}".format(len(spoints)))
输出 :
No of points: 364