0

The standard method to plot live data in python seems to be the matplotlib animation interface. However, this requires a fixed update frequency in FuncAnimation(). My code looks (simplified) like this:

def foo(image):
  # compute something
  return value

cap = cv2.VideoCapture(0)
i=0
while True:
  ret, img = self.cap.read()
  i += 1
  y = foo(img)
  # update plot (i, y)
  cv2.imshow("window", img)
  cv2.waitKey(1)

How could I achieve this "update plot"? It would be great if it didn't add much delay of cause. I'm open for pretty much any library.

Sebastian E
  • 339
  • 1
  • 2
  • 14
  • [This](https://stackoverflow.com/a/71128728/8881141) is an example of how to animate a figure with a while loop. But you can use FuncAnimation as well - the `interval` parameter is the minimum time between updates. – Mr. T Mar 03 '22 at 11:08

0 Answers0