Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 20064b9

Browse files
Update ORB_Algorithm.py
1 parent 430ef17 commit 20064b9

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

‎ORB Algorithm/ORB_Algorithm.py‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44
# Load the image
55
path=input('Enter the path of the image')
66
image = cv2.imread(path)
7+
path2=input('Enter the path for testing image')
8+
test_image=cv2.imread(path2)
9+
710
#Resizing the image
811
image=cv2.resize(image,(600,600))
12+
test_image=cv2.resize(test_image,(600,600))
13+
914
# Convert the image to gray scale
1015
gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
11-
12-
# Create test image by adding Scale Invariance and Rotational Invariance
13-
test_image = cv2.pyrDown(image)
14-
test_image = cv2.pyrDown(test_image)
15-
num_rows, num_cols = test_image.shape[:2]
16-
rotation_matrix = cv2.getRotationMatrix2D((num_cols/2, num_rows/2), 30, 1)
17-
test_image = cv2.warpAffine(test_image, rotation_matrix, (num_cols, num_rows))
1816
test_gray = cv2.cvtColor(test_image, cv2.COLOR_RGB2GRAY)
1917

2018
#Display the given and test image
@@ -45,7 +43,7 @@
4543
# The matches with shorter distance are the ones we want.
4644
matches = sorted(matches, key = lambda x : x.distance)
4745

48-
result = cv2.drawMatches(image, train_keypoints, test_gray, test_keypoints, matches, test_gray, flags = 2)
46+
result = cv2.drawMatches(image, train_keypoints, test_image, test_keypoints, matches, test_gray, flags = 2)
4947

5048
# Display the best matching points
5149
cv2.imshow('result',result)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /