def cof(): im1 = np.array(Image.open(inpfilename).convert('L')) im2 = np.array(Image.open(inpfilename).convert('L')) wid = 5 harrisim = harris.compute_harris_response(im1,5) filtered_coords1 = harris.get_harris_points(harrisim, wid+1) d1 = harris.get_descriptors(im1, filtered_coords1,wid) harrisim = harris.compute_harris_response(im2,5) filtered_coords2 = harris.get_harris_points(harrisim, wid+1) d2 = harris.get_descriptors(im2, filtered_coords2,wid) print 'starting matching' matches = harris.match_twosided(d1,d2) print "matches", matches figure() gray() harris.plot_matches(im1, im2, filtered_coords1, filtered_coords2, matches) print "show the image" show()
# -*- coding: utf-8 -*- """ Created on Mon Aug 15 11:19:46 2016 @author: user """ from PIL import Image from pylab import * import harris im = array(Image.open('../ch1/baby_16.jpg').convert('L')) harrisim = harris.compute_harris_response(im) filtered_coords = harris.get_harris_points(harrisim, 6) harris.plot_harris_points(im, filtered_coords) imshow(im) wid = 5 im1 = array(Image.open('../ch1/baby_1.jpg').convert('L')) harrisim = harris.compute_harris_response(im1, 5) filtered_coords1 = harris.get_harris_points(harrisim, wid + 1) d1 = harris.get_descriptors(im1, filtered_coords1, wid) im2 = array(Image.open('../ch1/baby_16.jpg').convert('L')) harrisim = harris.compute_harris_response(im2, 5) filtered_coords2 = harris.get_harris_points(harrisim, wid + 1) d2 = harris.get_descriptors(im2, filtered_coords2, wid) print 'starting matching' matches = harris.match_twosided(d1, d2) figure() gray() harris.plot_matches(im1, im2, filtered_coords1, filtered_coords2, matches) show()
t = time.time() filtered_coords1 = harris.get_harris_points(harrisim, wid + 1) print "t for get_harris_points=", time.time() - t t = time.time() d1 = harris.get_descriptors(im1, filtered_coords1, wid) print "t for get_descriptors=", time.time() - t t = time.time() harrisim = harris.compute_harris_response(im2, 5) filtered_coords2 = harris.get_harris_points(harrisim, wid + 1) d2 = harris.get_descriptors(im2, filtered_coords2, wid) print "starting matching" matches = harris.match_twosided(d1, d2) figure() gray() harris.plot_matches(im1, im2, filtered_coords1, filtered_coords2, matches) show() """ im = array(Image.open('empire.jpg').convert('L')) harrisim = harris.compute_harris_response(im) filtered_coords = harris.get_harris_points(harrisim,6) harris.plot_harris_points(im, filtered_coords) """
from pylab import * import harris #import imtools im1 = array(Image.open('/Users/taronegeorage/Desktop/111.jpg').convert('L')) im2 = array(Image.open('/Users/taronegeorage/Desktop/111.jpg').convert('L')) harrisim1 = harris.compute_harris_response(im1) filtered_coords1 = harris.get_harris_points(harrisim1) patches1 = harris.get_descriptors(im1, filtered_coords1) harris.plot_harris_points(im1, filtered_coords1) harrisim2 = harris.compute_harris_response(im2) filtered_coords2 = harris.get_harris_points(harrisim2) patches2 = harris.get_descriptors(im2, filtered_coords2) harris.plot_harris_points(im2, filtered_coords2) matches = harris.match_twosided(patches1, patches2) figure() gray() harris.plot_matches(im1, im2, filtered_coords1, filtered_coords2, matches, show_below=False) show()
from PIL import Image from pylab import * import harris import imtools im1 = array(Image.open('/Users/thakis/src/PCV/data/sf_view1.jpg').convert('L')) im2 = array(Image.open('/Users/thakis/src/PCV/data/sf_view2.jpg').convert('L')) harrisim1 = harris.compute_harris_response(im1) filtered_coords1 = harris.get_harris_points(harrisim1) patches1 = harris.get_descriptors(im1, filtered_coords1) harris.plot_harris_points(im1, filtered_coords1) harrisim2 = harris.compute_harris_response(im2) filtered_coords2 = harris.get_harris_points(harrisim2) patches2 = harris.get_descriptors(im2, filtered_coords2) harris.plot_harris_points(im2, filtered_coords2) matches = harris.match_twosided(patches1, patches2) figure() gray() harris.plot_matches(im1, im2, filtered_coords1, filtered_coords2, matches, show_below=False) show()
harris.plot_harris_points(im, filtered_coords) # MATCHING sigma = 5 min_dist = 8 treshold_harris = 0.5 width = 5 im1 = array(Image.open('image_1.png').convert('L')) im2 = array(Image.open('image_2.png').convert('L')) harrisim1 = harris.compute_harris_response(im1, sigma) filtered_coords1 = harris.get_harris_points(harrisim1, min_dist, treshold_harris) harris.plot_harris_points(im1, filtered_coords1) desc1 = harris.get_descriptors(im1, filtered_coords1, width) harrisim2 = harris.compute_harris_response(im2, sigma) filtered_coords2 = harris.get_harris_points(harrisim2, min_dist, treshold_harris) harris.plot_harris_points(im2, filtered_coords2) desc2 = harris.get_descriptors(im2, filtered_coords2, width) treshold_sym = 0.5 matches = harris.match_twosided(desc1, desc2, treshold_sym) figure() gray() harris.plot_matches(im1, im2, filtered_coords1, filtered_coords2, matches[:10]) show()