Skip to content

Instantly share code, notes, and snippets.

@shrimo
Created March 8, 2024 00:24
Show Gist options
  • Save shrimo/05f865d7ea8be5cdcbffb1a32d42b4d7 to your computer and use it in GitHub Desktop.
Save shrimo/05f865d7ea8be5cdcbffb1a32d42b4d7 to your computer and use it in GitHub Desktop.
Feature points (CV)
import cv2
import numpy as np
file = "image.jpg"
img = cv2.imread(file)
[
cv2.circle(img, (np.int32(ppt)), 5, (0, 255, 0), 1)
for ppt in [
(int(points.pt[0]), int(points.pt[1]))
for points in [
keypoints
for keypoints in cv2.SIFT_create(500).detectAndCompute(
cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), None
)
][0]
]
]
cv2.imshow("image", img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment