architetto francesco fantoni <hva - hermanitos verdes architetti>
2009-01-21 00:37:50 UTC
opencv library has an issue i can't figure out how to solve:
when using a camera capture, you're supposed to call an opencv function
cvReleaseCapture(capture_instance) in order to release memory and free
the camera when you don't need it anymore.
My problem is I can call that function in the library if frame grabbing
fails for some reason, but on script execution stop (e.g. closing gtk
window) the function remains uncalled and camera gets trapped, memory is
not set free and you're forced to disconnect and re-connect the camera
in order to use it again. Is a problem with different memory management
in python and C i suppose. If you leave many camera capture unreleased,
this finally leads to crash in camera kernel driver sometimes.
Is there a reliable way to call a function in imported library on gtk
window close? in this case i would have to call the release function,
but i can't insert it in script, otherwise would get called at each
frame and things wouldn't work. any advice, tip or trick?
when using a camera capture, you're supposed to call an opencv function
cvReleaseCapture(capture_instance) in order to release memory and free
the camera when you don't need it anymore.
My problem is I can call that function in the library if frame grabbing
fails for some reason, but on script execution stop (e.g. closing gtk
window) the function remains uncalled and camera gets trapped, memory is
not set free and you're forced to disconnect and re-connect the camera
in order to use it again. Is a problem with different memory management
in python and C i suppose. If you leave many camera capture unreleased,
this finally leads to crash in camera kernel driver sometimes.
Is there a reliable way to call a function in imported library on gtk
window close? in this case i would have to call the release function,
but i can't insert it in script, otherwise would get called at each
frame and things wouldn't work. any advice, tip or trick?