Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Can a program capture images even if it is not ran manually

I have a C++ program that is launched at boot as a service. It performs image processing on the output of a USB camera thanks to OpenCV. I would like to save images corresponding to what the camera captures before the image processing. To achieve this, I'm calling imwrite() in my code. Unfortunately I only get the screenshots when the program is ran manually in the terminal: as soon as I enable it as a service running at startup, the images are not generated anymore. Do you know why that occurs and how I could get rid of this problem?

Can a program capture images even if it is not ran manually

I have a C++ program that is launched at boot as a service. It performs image processing on the output of a USB camera thanks to OpenCV. I would like to save images corresponding to what the camera captures before the image processing. To achieve this, I'm calling imwrite() in my code. Unfortunately I only get the screenshots when the program is ran manually in the terminal: as soon as I enable it as a service running at startup, the images are not generated anymore. Do you know why that occurs and how I could get rid of this problem?

EDIT - Problem solved

That was not a matter of OpenCV at all.

Actually I was specifying a relative path to imwrite() instead of an absolute one. I guess I thought that even though my program ran as a service, the working directory would still be the one where the executable is located. Hence the solution to my problem was to specify an absolute path to imwrite().