I am trying to write a C++/Qt program for linux, where I take a still image photo from a webcam, make some transformations to a photo (cropping, resizing, etc.), and save it to
mplayer -vo png -frames 1 tv://
might give a green screen output as the camera is not yet ready.
mplayer -vo png -frames 2 tv://
You can try increasing the number of frames and choose a number from which the camera gives correct images.