Create 5
This commit is contained in:
1 parent
8bcef951e3
commit
a8a196d196
4 files changed
+40
No files matched your search
@@ -0,0 +1,13 @@
|
||||
import cv2 as cv
|
||||
|
||||
image = cv.imread("images/lena.jpg")
|
||||
|
||||
sift = cv.SIFT_create() # type: ignore
|
||||
|
||||
keypoints, descriptors = sift.detectAndCompute(image, None)
|
||||
|
||||
image_with_keypoints = cv.drawKeypoints(image, keypoints, None) # type: ignore
|
||||
|
||||
cv.imshow("SIFT Keypoints", image_with_keypoints)
|
||||
cv.waitKey(0)
|
||||
cv.destroyAllWindows()
|
||||
@@ -0,0 +1,27 @@
|
||||
import cv2 as cv
|
||||
|
||||
big = cv.imread("images/big.jpg")
|
||||
small = cv.imread("images/small.jpg")
|
||||
cv.imshow("big", big)
|
||||
cv.waitKey(0)
|
||||
cv.destroyAllWindows()
|
||||
cv.imshow("small", small)
|
||||
cv.waitKey(0)
|
||||
cv.destroyAllWindows()
|
||||
|
||||
sift = cv.SIFT_create() # type: ignore
|
||||
|
||||
kp1, des1 = sift.detectAndCompute(big, None)
|
||||
kp2, des2 = sift.detectAndCompute(small, None)
|
||||
|
||||
bf = cv.DescriptorMatcher_create(cv.DescriptorMatcher_BRUTEFORCE) # type: ignore
|
||||
|
||||
matches = bf.match(des1, des2)
|
||||
|
||||
matches = sorted(matches, key=lambda x: x.distance)
|
||||
|
||||
result = cv.drawMatches(big, kp1, small, kp2, matches[:15], None) # type: ignore
|
||||
|
||||
cv.imshow("-match", result)
|
||||
cv.waitKey(0)
|
||||
cv.destroyAllWindows()
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 82 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
Reference in new issue
Block a user