Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. import numpy as np
  2. import cv2
  3. import cv2.aruco as aruco
  4. import time
  5.  
  6.  
  7.  
  8. camera = cv2.VideoCapture(0) #is this needed?
  9. #camera = PiCamera() #what's the equivalent for this?
  10.  
  11. font = cv2.FONT_HERSHEY_SIMPLEX
  12.  
  13.  
  14. while True:
  15. return_value,img = camera.read()
  16.  
  17.  
  18. gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
  19. aruco_dict = aruco.Dictionary_get(aruco.DICT_4X4_250)
  20. parameters = aruco.DetectorParameters_create()
  21.  
  22. corners, ids, rejectedImgPoints = aruco.detectMarkers(gray, aruco_dict, parameters=parameters)
  23. #print(corners)
  24.  
  25. id_list = list(ids)
  26.  
  27. id_list2 = []
  28. for i in id_list:
  29. id_list2.append(i[0]) #where is this being used?
  30.  
  31.  
  32. image = aruco.drawDetectedMarkers(img, corners, ids)
  33.  
  34. # get_head_and_shoulders()
  35. # get_stoop()
  36.  
  37. cv2.putText(image,'RR2/CamTestv0.1.2706',(10,30),font,1,(255,0,0),1,cv2.LINE_AA)
  38. cv2.putText(image,fps(),(10,50),font,1,(255,0,255),1,cv2.LINE_AA)
  39. cv2.imshow('frame',image)
  40.  
  41. if cv2.waitKey(1) & 0xFF == ord('q'):
  42. break
  43. #cap.truncate(0) # Important!
  44.  
  45. camera.close()
  46. cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement