Motion Detection Alarm System in Python

  Рет қаралды 37,839

NeuralNine

NeuralNine

Күн бұрын

In this video, we build a motion detection alarm system, which recognizes movement in Python.
◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚
🐍 The Python Bible Book: www.neuralnine.com/books/
💻 The Algorithm Bible Book: www.neuralnine.com/books/
👕 Programming Merch: www.neuralnine.com/shop
🌐 Social Media & Contact 🌐
📱 Website: www.neuralnine.com/
📷 Instagram: / neuralnine
🐦 Twitter: / neuralnine
🤵 LinkedIn: / neuralnine
📁 GitHub: github.com/NeuralNine
🎙 Discord: / discord
🎵 Outro Music From: www.bensound.com/
Timestamps:
(0:00) Intro
(0:11) Preview
(1:26) Coding Alarm System
(15:44) Demonstration
(18:47) Outro

Пікірлер: 56
@nopaallo1147
@nopaallo1147 7 ай бұрын
Great presentation, detailed explanation, could not have asked for more
@musabizimana3587
@musabizimana3587 Жыл бұрын
Thanks man, learning so much from these videos
@Krishna-kb9ul
@Krishna-kb9ul Жыл бұрын
Dude this is awesome, i have been searching for almost same project, now i just need to alter it to meet my needs , thanks alot ❣️
@arek7198
@arek7198 Жыл бұрын
Thanks a lot, good presentation.
@tcgvsocg1458
@tcgvsocg1458 Жыл бұрын
thx a lot really interesting i will try it right now
@mehdimojaradi
@mehdimojaradi Жыл бұрын
You're really great 👍
@arthsingh5878
@arthsingh5878 7 күн бұрын
great explanation
@francescologrillo443
@francescologrillo443 Жыл бұрын
thank you , can i have a hint how select different cam and send mail?
@musabizimana3587
@musabizimana3587 Жыл бұрын
is there a video on how to set up our IDE to look like yours?
@vidya-laxmi
@vidya-laxmi Жыл бұрын
Impressive...One!
@skgamedev
@skgamedev Жыл бұрын
Really good video
@vincenzo3292
@vincenzo3292 Жыл бұрын
Thank you. Can you recommend a tutorial on how to set up a camera with a computer that runs this code? Appreciate your help.
@felixronnoh
@felixronnoh Жыл бұрын
Nice one.
@zerlinalilin
@zerlinalilin 2 ай бұрын
works!, thanks!
@andystevens3474
@andystevens3474 Жыл бұрын
excellent video
@SiLiDNB
@SiLiDNB Жыл бұрын
Thanks
@shenzo00ff
@shenzo00ff 10 ай бұрын
Anyone tell me how does he opens his camera/webcam in the video ?
@tcgvsocg1458
@tcgvsocg1458 Жыл бұрын
can you do a soft for card (like yugioh, magic ,pokemon) that add card show on camera to database with the number of card associate? that can be really itneresting
@ndmdm1578
@ndmdm1578 Жыл бұрын
i use this motion on my program. i increase the value of threshold.sum to 1000 and even 9999 to verify if it work but still its sensitive to movement..what should i do?
@duscraftphoto
@duscraftphoto Жыл бұрын
This was great! One issue that I ran into (because I'm stupid and wasn't paying attention to what I was doing ha ha) is that the cam window has to be selected and in the foreground for the waitKey to be triggered by the key press. If the terminal is selected, it will just type the keyboard output to the terminal and do nothing. I'm sure I'm the only idiot that did this, but just incase anyone else made the same mistake... I figured I'd save you the waitKey Google sinkhole you may end up in ha ha. Keep up the great content, Flori!
@tmusic1001
@tmusic1001 Жыл бұрын
when I write 'cv2.' it doesn't show me its options like VideoCapture(), but I write it manually and it works properly how to fix it?
@spike868
@spike868 Жыл бұрын
Cool
@user-rm3ed8tr7z
@user-rm3ed8tr7z Жыл бұрын
Traceback (most recent call last): File "/Users/vladimir/Desktop/Projects_KZfaq/main.py", line 36, in difference = cv2.absdiff(frame_bw, start_frame) cv2.error: OpenCV(4.7.0) /Users/runner/work/opencv-python/opencv-python/opencv/modules/core/src/arithm.cpp:650: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'arithm_op'
@flarexlucifer
@flarexlucifer Жыл бұрын
i'm also getting same error
@Solexdballer
@Solexdballer Жыл бұрын
Awesome Dude......
@charlesbanana6060
@charlesbanana6060 11 ай бұрын
I don't know if you will still reply, but I want to get a smart bulb, and then turn it to a specific color after motion is detected. I can already turn the bulb on and off using voice commands and change is color. Do you think it will be possible this way? Plus, I also wanted to ask if you could give me a bit more details about the type of cameras I can use and how I can connect them to my computer etc. I want fire cameras dey up at the same point, pointing in all four directions.
@alertsByJarvis
@alertsByJarvis 5 ай бұрын
How do u add python code into bulb?
@qwezxc23456
@qwezxc23456 4 ай бұрын
​There are Python libraries for smart bulbs. You connect to the bulb over wi-fi specifying it's IP address​ in Python code.@@alertsByJarvis
@larianemouad4884
@larianemouad4884 Жыл бұрын
Anyone having troubles with the opencv lib, for me it can't find the references
@splou6777
@splou6777 Жыл бұрын
me too
@splou6777
@splou6777 Жыл бұрын
I have errors at import cv2 and impot imutils
@shenzo00ff
@shenzo00ff 10 ай бұрын
Bro first install in cmd
@havocff4900
@havocff4900 10 ай бұрын
​@@shenzo00ffbro source code available ? Can u share the link
@koongfu00
@koongfu00 3 ай бұрын
How to make this work on a linux server without Qt?
@philtoa334
@philtoa334 Жыл бұрын
Thx_.
@benezer4937
@benezer4937 Жыл бұрын
It didnt shows my webcam? My webcam light is turned on but its not showing any video
@meditation_and_focus245
@meditation_and_focus245 Жыл бұрын
boss my winsound is not producing any sound
@justacoder_
@justacoder_ Жыл бұрын
alarm_mode = not alarm_mode wow this is mindblowing lol
@TechWithLoLo
@TechWithLoLo Жыл бұрын
Agree +1
@gemini1014
@gemini1014 Жыл бұрын
I am having a prob AttributeError: 'NoneType' object has no attribute 'shape.' any support is appreciated
@kevinflanigan8653
@kevinflanigan8653 Жыл бұрын
Same problem here --> frame = imutils.resize(frame, width=500)
@kevinflanigan8653
@kevinflanigan8653 Жыл бұрын
Figured it out. Tabbing error. Duh!
@jamesfraser7394
@jamesfraser7394 Жыл бұрын
@@kevinflanigan8653 Very old newbie wondering what tab position should be?
@kevinflanigan8653
@kevinflanigan8653 Жыл бұрын
@@jamesfraser7394 I believe my problem was that I had the "key_pressed = cv2.waitKey(30)" statement and the two subsequent "if statements" indented too far to the right. Had pull the group back by one tab. I hope that helps.
@ladislav6291
@ladislav6291 Жыл бұрын
Hi there That's because your camera won't turn on, so there's no picture Try to change this cap = cv2.VideoCapture(0, cv2.CAP_DSHOW) for this cap = cv2.VideoCapture(0) I hope it helped you
@sarthaksingh7570
@sarthaksingh7570 11 ай бұрын
This program was used in squid game Red light and green light...😅😅😅
@codenerd7823
@codenerd7823 Жыл бұрын
11sec only
@jamesfraser7394
@jamesfraser7394 Жыл бұрын
What is causing this...Very old inspired newbie asking. Traceback (most recent call last): File "/home/aladdinsane/vpyenv/detectmotion/detectmotion.py", line 21, in start_frame = imutils.resize(start_frame, width=500) File "/home/aladdinsane/vpyenv/detectmotion/lib/python3.10/site-packages/imutils/convenience.py", line 69, in resize (h, w) = image.shape[:2] AttributeError: 'NoneType' object has no attribute 'shape'
@jamesfraser7394
@jamesfraser7394 Жыл бұрын
I'm sure it's not opening the cam on my MacBook so no image.
@ladislav6291
@ladislav6291 Жыл бұрын
@@jamesfraser7394 Hi James Here is the code that works on mac You need import playsound and download some alarm ring :) enjoy import threading from playsound import playsound import cv2 import imutils cap = cv2.VideoCapture(0) cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640) cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480) _, start_frame = cap.read() start_frame = imutils.resize(start_frame, width=500) start_frame = cv2.cvtColor(start_frame, cv2.COLOR_BGR2GRAY) start_frame = cv2.GaussianBlur(start_frame, (21,21), 0) alarm = False alarm_mode = False alarm_counter = 0 def beep_alarm(): global alarm for _ in range(5): if not alarm_mode: break print('ALARM') playsound ('/Applications/Sienna/songs/alert.wav') alarm = False while True: _, frame = cap.read() frame = imutils.resize(frame, width=500) if alarm_mode: frame_bw = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) frame_bw = cv2.GaussianBlur(frame_bw, (5, 5), 0) difference = cv2.absdiff(frame_bw, start_frame) threshold = cv2.threshold(difference, 25,255, cv2.THRESH_BINARY)[1] start_frame = frame_bw if threshold.sum() > 300: alarm_counter += 1 else: if alarm_counter > 0: alarm_counter -= 1 cv2.imshow("Cam", threshold) else: cv2.imshow("Cam", frame) if alarm_counter > 20: if not alarm: alarm = True threading.Thread(target=beep_alarm).start() key_pressed = cv2.waitKey(30) if key_pressed == ord('t'): alarm_mode = not alarm_mode alarm_counter = 0 if key_pressed == ord('q'): alarm_mode = False break cap.release() cv2.destroyAllWindows()
@jamesfraser7394
@jamesfraser7394 Жыл бұрын
@@ladislav6291 Thanks Ladislav!!!
@ladislav6291
@ladislav6291 Жыл бұрын
@@jamesfraser7394 You're welcome
@guilhermeschitzamaral8627
@guilhermeschitzamaral8627 9 ай бұрын
⥊ 55: 135 0: Good (if not good, then not zero) 1: Ethics 2: Problem-Solution 3: Consent 4: Emotion/Will 5: To Testify/To Meet 6: Why/Who/When/How/Where/What 7: Information 8: Stability 9: Sanity/Seriousness 10: Network (Good Network, because zero) 11: Justice 13: Death 16: Tower 20: Judgement 21: Solving Problems with Ethics 22: Resistance 23: Resilience 30: Good Wave 32: Discernment 33: Sacred 40: Good Force 44: Free Love 50: Good Expression 55: War 57: Counter-Terrorism 60: Good Reason 70: Good Information 80: Good Stability 90: Good Seriousness 95: Only One Global Fiat Currency 96: Blockchain 97: Anarchy 98: Vegan 99: Revolution 100: Liberation 444: Direct Digital Democracy 555: Diplomacy 1000: Possible Conversation Method using numbers to convey meaning For ex.: 6022: Good Reason to Resist.
@guilhermeschitzamaral8627
@guilhermeschitzamaral8627 9 ай бұрын
513
Building A Security System In Python...🚨
17:56
Tech With Tim
Рет қаралды 49 М.
Make A Security Camera With Python
35:58
Tech With Tim
Рет қаралды 231 М.
I Can't Believe We Did This...
00:38
Stokes Twins
Рет қаралды 87 МЛН
Khó thế mà cũng làm được || How did the police do that? #shorts
01:00
Final muy increíble 😱
00:46
Juan De Dios Pantoja 2
Рет қаралды 51 МЛН
Makefiles in Python For Professional Automation
13:43
NeuralNine
Рет қаралды 40 М.
Object Tracking with Opencv and Python
30:03
Pysource
Рет қаралды 597 М.
Coding Encrypted Chat in Python
20:33
NeuralNine
Рет қаралды 45 М.
Facial Recognition attendance system using python
19:44
I know python
Рет қаралды 597 М.
Object Detection in 10 minutes with YOLOv5 & Python!
10:45
Rob Mulla
Рет қаралды 235 М.
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 795 М.
Как правильно выключать звук на телефоне?
0:17
Люди.Идеи, общественная организация
Рет қаралды 237 М.
Easy Art with AR Drawing App - Step by step for Beginners
0:27
Melli Art School
Рет қаралды 8 МЛН
ИГРОВОВЫЙ НОУТ ASUS ЗА 57 тысяч
25:33
Ремонтяш
Рет қаралды 345 М.
OZON РАЗБИЛИ 3 КОМПЬЮТЕРА
0:57
Кинг Комп Shorts
Рет қаралды 1,3 МЛН
Спутниковый телефон #обзор #товары
0:35
Product show
Рет қаралды 2,2 МЛН
Опять съемные крышки в смартфонах? #cmf
0:50