I'm writing a program using OpenCV 3.4 and Python 3. I also use a Raspberry pi 3 and a PiCamera.
My problem is that I have to process the last frame from a video recorded in real time from picamera every 2 or 3 seconds.

```
import cv2
from time import sleep
cam=cv2.VideoCapture(0)
while True:
    suc, img=cam.read()
    #operation on image, it's not important
    cv2.imshow(...)

```

I've a code similar to this.
This code works really well, but raspberry continues to process the last frame of the video many times for seconds.
I want process only 1 time every 2 or 3 seconds.
I've tried with time.sleep(2) in the while loop but it doesn't work because then the video is not in real time. I've searched a lot on the internet and I think that picamera continues to record and when the 2 seconds are passed, my program processes the frame after and not the last frame recorded by the camera.
On the internet I've found a function called VideoCapture.Grab but I don't understand how it works and if I have to use it.
I've find this other question that is very similar to mine 
[How to capture a picture after every 5 seconds of camera using opencv python and Raspbery Pi 3?](https://stackoverflow.com/questions/49278087/how-to-capture-a-picture-after-every-5-seconds-of-camera-using-opencv-python-and?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa)
but the second part of code is cut or similar and I can't understand.
Thank you all.