I have developed a Java application, which captures photos from a webcam and detects faces (using OpenCV) and prints only the facial area on paper. Now I have to run this app on a Raspberry Pi. I need a very minimal operating system to run this app. I don't use any monitor with this system, so when I start the machine, app should start automatically. and then app will start functioning, if it detects a face it will print. This machine will be used only used for this app only, so which OS I have to use for this purpose?
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
Surely any OS would do, so long as it supports Java (i.e. it has a JRE), you can specify which binaries execute upon startup and it supports OpenCV - which is all of the common Pi OSes.
As you will only be running this app, you don't need an OS with every service installed, nor would you require a desktop environment, just a minimal setup.
You should google for "lightweight linux for Pi" to see the full range of options, as it is difficult to give you a single answer without it being an opinion. Nevertheless, some of your options would include: