With this easy OpenCV code you can take a picture from your video source.
For example, if you are analysing images in realtime and you want to take a photo of a certain moment, just press 's' and the photo will save as "muestran.png" (where n is the number of picture) in the folder where you locate the script.