1

I am making an automatized air hockey robot using OpenCV to detect objects

Up until now everything works but while in the loop memory is consumed in few seconds (it uses 1GB un about 1 min).

I have been disabling code to detect where the the leak comes from and finally got the line that makes the ram consume itself. It is when i get moments

moments = cv.Moments(cv.GetMat(img, 0))

where img is simply a query from my webcam. I have tried to delete the objects after use, but with no result.

Does anyone know how to fix this one?

madth3
  • 7,275
  • 12
  • 50
  • 74

1 Answers1

0

Also stumbled on this. It happens in both v2.3.1 and v2.4.5 for the old cv interface. This interface has been removed in favor of cv2. See this question for more details on the two interfaces.

Try using cv2 interface (import cv2), maybe the leak doesn't happen there. UPDATE: no leak observed after recoding using the cv2 interface.

Community
  • 1
  • 1
alexei
  • 2,031
  • 1
  • 26
  • 28