Mahotas – 获得 SURF 密集点
在本文中,我们将了解如何在 mahotas 中获得图像的加速鲁棒密集特征。在计算机视觉中,加速鲁棒特征(SURF)是一种获得专利的局部特征检测器和描述符。它可用于对象识别、图像配准、分类或 3D 重建等任务。它的部分灵感来自尺度不变特征变换 (SIFT) 描述符。为此,我们将使用来自核分割基准的荧光显微镜图像。我们可以在下面给出的命令的帮助下获取图像
mahotas.demos.nuclear_image()
下面是nuclear_image
为此,我们将使用 surf.dense 方法
Syntax : surf.surf(img, spacing)
Argument : It takes image object and integer as argument
Return : It returns numpy.ndarray i.e descriptors at dense points
示例 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 dense points
dense_img = surf.dense(nuclear, 120)
# showing image
print("Dense Image")
imshow(dense_img)
show()
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 dense points
dense_img = surf.dense(gaussian, 80)
# showing image
print("Dense Image")
imshow(dense_img)
show()
输出 :
示例 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 dense points
dense_img = surf.dense(gaussian, 80)
# showing image
print("Dense Image")
imshow(dense_img)
show()
输出 :