As the picamera has a lot of flexilibity, I have integrated it using boost::python to my C++ program.
In my application I create a PiCamera() instance at the beginning in order to continuously update the awb algorithm. The main problem occurs if the application closes unexpectedly, when I try to run it again I have the following error:
./externalC++App
mmal: mmal_vc_component_enable: failed to enable compononent : ENOSPC
Traceback (most recent call last):
File "", line, in
...
...
picamera.exc.PiCameraMMALError: Camera component couldn't be enabled: Out of resources (other than memory)
I know that is due to a unreleased camera object in the previous execution (but I couldn't manage it because I got a segmentation error).
Of course, the best solution will be fix all that unexpected endings, but we are in a really early stage so that may occur sometimes (we are working to decrease the amount of such errors).
The main question is, there is a way to check if the camera is busy at the beginning and release it if needed? whether in Python or in command shell, both solutions will work for me.
lsof /dev/video0
(or whatever your camera device is called)?