Thanks for the great code.

I am trying to modify the code so that I can capture the image not just with a button, but also when the user presses the button on the webcam.

Any suggestions?
...