原标题:提取图像兴趣点
原文来自:博客园 原文链接:https://www.cnblogs.com/geeksongs/p/11189010.html
一般来讲,我们图像的兴趣点都有边缘(edges)和角点(corners),这是两种比较常见的兴趣点类型,我们现在来撸撸代码,看一个提取美女兴趣点的例子:
import numpy as npfrom skimage.feature import corner_harris, corner_peaksfrom skimage.color import rgb2gray
import matplotlib.pyplot as plt
import skimage.io as iofrom skimage.exposure import equalize_hist
def show_corners(corners, image):
fig = plt.figure()
plt.gray()
plt.imshow(image)
y_corner, x_corner = zip(*corners)
plt.plot(x_corner, y_corner, 'or')
plt.xlim(0, image.shape[1])
plt.ylim(image.shape[0], 0)
fig.set_size_inches(np.array(fig.get_size_inches()) * 2)
plt.show()
mandrill = io.imread('112.png.')
mandrill = equalize_hist(rgb2gray(mandrill))
corners = corner_peaks(corner_harris(mandrill), min_distance=1)
show_corners(corners, mandrill)
最后我们显示得到的结果红色部分就是我们的兴趣点所在位置:
虽然结果没有深色图像的好,但也是可以很明显地看到兴趣点被我们提取出来了。
免责声明:本文来自互联网新闻客户端自媒体,不代表本网的观点和立场。
合作及投稿邮箱:E-mail:editor@tusaishared.com