Ask Your Question

How to I make a simple response to motion detected?

asked 2018-01-13 13:52:45 -0500

masterenol gravatar image

Hello everyone,

I want to monitor a webcam for motion detection. I want to add the text, "MOTION DETECTED" on the live video stream when motion is detected: image description

I know how to use cv2.createBackgroundSubtractorMOG2(), adding text to live video, and using OpenCV drawing functions:

image description

I'd greatly appreciate any help that I can recieve.

edit retag flag offensive close merge delete



I'm sorry, but what exactly do you need help with, if you already know how to do these things? Perhaps I'm misinterpreting your question.

sjhalayka gravatar imagesjhalayka ( 2018-01-14 18:52:54 -0500 )edit

@sjhalayka Thanks for the response, I figured out how the answer to my questions here.

masterenol gravatar imagemasterenol ( 2018-01-16 01:46:18 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-01-15 04:26:00 -0500

Apply the findNonZero function to your foreground mask, then see if at least 10% of your image content is changing (since you want to ignore noise), and trigger the alarm.

edit flag offensive delete link more


@StevenPuttemans Thanks for the help!

masterenol gravatar imagemasterenol ( 2018-01-16 01:44:36 -0500 )edit

Question Tools

1 follower


Asked: 2018-01-13 13:52:45 -0500

Seen: 327 times

Last updated: Jan 13 '18