예제 #1
0
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()
예제 #2
0
# -*- 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()
예제 #3
0
im2 = array(Image.open("wave2.jpg").convert("L"))

wid = 5

t = time.time()
harrisim = harris.compute_harris_response(im1, 5)

print "t for harrisim=", time.time() - t
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()
예제 #4
0
def harris_features(im):
    response = cv2.cornerHarris(im, 7, 5, 0.05)
    points = harris.get_harris_points(response)
    desc = harris.get_descriptors(im, points)
    return points, desc
예제 #5
0
from PIL import Image
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()
예제 #7
0
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()
예제 #8
0
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image

from harris import compute_harris_response, get_harris_points, \
    get_descriptors, match_two_sided, plot_matches, match

img1 = np.array(Image.open('images/house.jpg').convert('L'))
img2 = np.array(Image.open('images/house2.jpg').convert('L'))
wid = 100

harris_img = compute_harris_response(img1, 5)
filtered_coords1 = get_harris_points(harris_img, wid + 1)
d1 = get_descriptors(img1, filtered_coords1, wid)

harris_img = compute_harris_response(img2, 5)
filtered_coords2 = get_harris_points(harris_img, wid + 1)
d2 = get_descriptors(img2, filtered_coords2, wid)

print('[INFO] Starting Matching ')
matches = match(d1, d2)
print('[INFO] match complete')

plt.figure()
plt.gray()
plot_matches(img1, img2, filtered_coords1, filtered_coords2, matches)
plt.show()