Added camera detection
parent
bd76aa0534
commit
55048a5eb3
|
@ -0,0 +1,25 @@
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
|
||||||
|
def start_realtime_keypoint_detection():
|
||||||
|
cap = cv2.VideoCapture(0)
|
||||||
|
scaling_factor = 1
|
||||||
|
|
||||||
|
while True:
|
||||||
|
ret, frame = cap.read()
|
||||||
|
frame = cv2.resize(frame, None, fx=scaling_factor, fy=scaling_factor, interpolation=cv2.INTER_AREA)
|
||||||
|
imagegray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
|
||||||
|
features = cv2.SIFT_create()
|
||||||
|
keypoints = features.detect(imagegray, None)
|
||||||
|
output_image = cv2.drawKeypoints(frame, keypoints, 0, (0, 255, 0),flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
|
||||||
|
|
||||||
|
cv2.imshow('Webcam', output_image)
|
||||||
|
c = cv2.waitKey(1)
|
||||||
|
if c == 27:
|
||||||
|
break
|
||||||
|
|
||||||
|
cap.release()
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
start_realtime_keypoint_detection()
|
Loading…
Reference in New Issue