Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. flow = cv2.calcOpticalFlowFarneback(prvs,frame_next, None, 0.5, 3, 15, 3, 5, 1.2, 0)
  2.  
  3. k = cv2.waitKey(1) & 0xff
  4. if k == 27:
  5. break
  6. elif k == ord('s'):
  7. cv2.imwrite('opticalfb.png',frame2)
  8. cv2.imwrite('opticalhsv.png',rgb)
  9. prvs = frame_next
  10.  
  11. for i in range(len(output_image)):
  12. for j in range(len(output_image[0])):
  13. if prvs[i][j] != 0:
  14. output_image[i][j] = [0, 255, 0]
  15. output_image = cv2.arrowedLine(output_image, (j ,i), (j + int(flow[i][j][0]), i + int(flow[i][j][1])), (0, 0, 255), 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement