Opencv capture.read () buffer

Hello

I develop an application that should stop the operation of an equipment as soon as a person is detected (object detection).

I need the image in real time, but with cam.read I have a delay of about 1s.

cam = cv2.VideoCapture (urlcamera)
s, im = cam.read ()

Does anyone know how to work around this problem?