I have a web cam application in Linux. When it starts, it initializes the web cam and the image is displayed live in a new window inside startx. Some calculations will be performed too and the result will be displayed on the window. There are also some buttons on the window for the user to tune the settings.
Now I would like the program to start running automatically (hence starting the web cam) every time Linux boots up. The problem is that, if I put the program in scripts like /etc/rc.local and run as background, the program cannot run since the X display does not exist. In addition, I would like to allow users to see the live image and processed results on demand. Now I come up with a few possible solutions:
(1) Use some method (such as VNCserver) to start X server without displaying it on screen, and then redirect the display to the server and run the program. When the user wants to see the live image and processed results, they start VNC client to view it.
(2) Use some method to redirect the display to a dummy X server, so that the program can start without error. But then there needs to be some method for the user to invoke the program, inherit the information of the executing process, so as to see the live image and processed results on demand.
(3) Modify the program so that if the display does not support X windows, the display part is skipped. Same as (2), there needs to be some method for the user to invoke the program, inherit the information of the executing process, so as to see the live image and processed results on demand.
(4) Modify the program and split into two programs, so that the one running automatically only handles the web cam initialization, gets the image data and perform the calculation, while the other program gets the image data and processed results (via IPC shared memory, for instance), and when invoked by user, it displays the result on a window in X.
While I believe (1) and (4) are feasible, how about (2) and (3)? And among the possible solutions, which one will be the best?