Mahotas – 获得 SURF 积分
在本文中,我们将看到如何在 mahotas 中获得图像的加速鲁棒积分特征。在计算机视觉中,加速鲁棒特征(SURF)是一种获得专利的局部特征检测器和描述符。它可用于对象识别、图像配准、分类或 3D 重建等任务。它的部分灵感来自尺度不变特征变换 (SIFT) 描述符。为此,我们将使用来自核分割基准的荧光显微镜图像。我们可以在下面给出的命令的帮助下获取图像
mahotas.demos.nuclear_image()
下面是nuclear_image
为此,我们将使用 surf.integral 方法
Syntax : surf.integral(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 integral feature
i_img = surf.integral(nuclear)
# showing image
print("Integral Image")
imshow(i_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 integral feature
i_img = surf.integral(gaussian)
# showing image
print("Integral Image")
imshow(i_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 integral feature
i_img = surf.integral(gaussian)
# showing image
print("Integral Image")
imshow(i_img)
show()
输出 :