Ask Your Question
1

How to I make a simple response to motion detected?

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

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

Comments

2

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 -0600 )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 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
3

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

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

Comments

@StevenPuttemans Thanks for the help!

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

Question Tools

1 follower

Stats

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

Seen: 405 times

Last updated: Jan 13 '18