1
# -*- coding: utf-8 -*-
3
% Demo code for matching roughly based on the procedure
6
% "Shape Matching and Object Recognition using Low Distortion Correspondence"
7
% A. C. Berg, T. L. Berg, J. Malik
10
% code Copyright 2005 Alex Berg
12
% questions -> Alex Berg aberg@cs.berkeley.edu
17
def find_interest_points( signal, desired, r ):
20
% function [ci,cj] = find_interest_points( signal, desired, r )
22
% use rejection sampling to find interest points along edges
30
thresh = 0.1*signal.max(); # % initial threshhold
33
center_signal = signal>=thresh
34
while center_signal.sum()<(desired*2):
35
center_signal = signal>=thresh
42
# now we have at least 400 points in center_signal
43
# do rejection sampling to geta spatially uniform sample
46
rows,cols = signal.shape[:2]
48
c=numpy.nonzero(center_signal)
55
good = numpy.ones((n,))
56
vgood = numpy.zeros((n,))
59
notclose = (((c[:,0]-c[i,0])**2) + ((c[:,1]-c[i,1])**2))>=rs
63
if (numpy.sum(vgood)>=desired):
66
#print vgood.sum(),desired