从skimage中检测到的特征中提取补丁

时间:2014-11-27 10:49:54

标签: python-2.7 image-processing feature-extraction scikit-image

我对图像处理任务感到困惑。 我需要绘制不同角度拍摄的两张照片的匹配特征。 我通过使用blob探测器获得了这些功能,我知道skimage中的相关功能可以执行负交叉验证并绘制匹配。 但我错过了中心部分:我必须使用这些特征提取一个像素的平方,然后计算两个图像的补丁之间的距离(计算距离,我知道我需要一个循环)。 我是这样开始的,但我不确定这是一个很好的方法。

#my data
img1 = data.imread('Img.png')
img2 = data.imread('Img.png')

#grayscale
img1 = rgb2gray(img1)
img2 = rgb2gray(img2)

#detect features
blobs1 = blob_dog(img1, max_sigma=30, threshold=.1)
blobs2 = blob_dog(img2, max_sigma=30, threshold=.1)

#my keypoints image1
y1 = [p[0] for p in blobs1]
x1 = [p[1] for p in blobs1]

#my keypoints image2
y2 = [p[0] for p in blobs2]
x2 = [p[1] for p in blobs2]

#extract the patches (how?)
#then compute the distance between them with a loop

# for normalized cross correlation use this:
match_template(image, template, pad_input=False, mode='constant', constant_values=0)

# to match use this:
plot_matches(ax, img1, img2, keypoints1, keypoints2, matches, keypoints_color='k',      matches_color=None, only_matches=False)

0 个答案:

没有答案