Motion Detection Alarm System in Python

Sdílet
Vložit
  • čas přidán 28. 08. 2024

Komentáře • 57

  • @nopaallo1147
    @nopaallo1147 Před 9 měsíci +1

    Great presentation, detailed explanation, could not have asked for more

  • @Krishna-kb9ul
    @Krishna-kb9ul Před rokem

    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 ❣️

  • @musabizimana3587
    @musabizimana3587 Před rokem

    Thanks man, learning so much from these videos

  • @user-rm3ed8tr7z
    @user-rm3ed8tr7z Před rokem +2

    Traceback (most recent call last):
    File "/Users/vladimir/Desktop/Projects_CZcams/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'

  • @vincenzo3292
    @vincenzo3292 Před rokem +1

    Thank you. Can you recommend a tutorial on how to set up a camera with a computer that runs this code? Appreciate your help.

  • @arthsingh5878
    @arthsingh5878 Před měsícem

    great explanation

  • @arek7198
    @arek7198 Před rokem

    Thanks a lot, good presentation.

  • @duscraftphoto
    @duscraftphoto Před rokem

    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!

  • @francescologrillo443
    @francescologrillo443 Před rokem +1

    thank you , can i have a hint how select different cam and send mail?

  • @shenzo00ff
    @shenzo00ff Před 11 měsíci +1

    Anyone tell me how does he opens his camera/webcam in the video ?

  • @tcgvsocg1458
    @tcgvsocg1458 Před rokem

    thx a lot really interesting i will try it right now

  • @SiLiDNB
    @SiLiDNB Před rokem

    Thanks

  • @musabizimana3587
    @musabizimana3587 Před rokem

    is there a video on how to set up our IDE to look like yours?

  • @gemini1014
    @gemini1014 Před rokem +3

    I am having a prob
    AttributeError: 'NoneType' object has no attribute 'shape.'
    any support is appreciated

    • @kevinflanigan8653
      @kevinflanigan8653 Před rokem +1

      Same problem here --> frame = imutils.resize(frame, width=500)

    • @kevinflanigan8653
      @kevinflanigan8653 Před rokem

      Figured it out. Tabbing error. Duh!

    • @jamesfraser7394
      @jamesfraser7394 Před rokem

      @@kevinflanigan8653 Very old newbie wondering what tab position should be?

    • @kevinflanigan8653
      @kevinflanigan8653 Před rokem +1

      @@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 Před rokem

      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

  • @skgamedev
    @skgamedev Před rokem

    Really good video

  • @mehdimojaradi
    @mehdimojaradi Před rokem

    You're really great 👍

  • @tmusic1001
    @tmusic1001 Před rokem

    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?

  • @zerlinalilin
    @zerlinalilin Před 4 měsíci

    works!, thanks!

  • @tcgvsocg1458
    @tcgvsocg1458 Před rokem

    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

  • @vidya-laxmi
    @vidya-laxmi Před rokem

    Impressive...One!

  • @ndmdm1578
    @ndmdm1578 Před rokem

    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?

  • @felixronnoh
    @felixronnoh Před rokem

    Nice one.

  • @benezer4937
    @benezer4937 Před rokem

    It didnt shows my webcam? My webcam light is turned on but its not showing any video

  • @andystevens3474
    @andystevens3474 Před rokem

    excellent video

  • @jamesfraser7394
    @jamesfraser7394 Před rokem +1

    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 Před rokem

      I'm sure it's not opening the cam on my MacBook so no image.

    • @ladislav6291
      @ladislav6291 Před rokem +2

      @@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 Před rokem

      @@ladislav6291 Thanks Ladislav!!!

    • @ladislav6291
      @ladislav6291 Před rokem

      @@jamesfraser7394 You're welcome

  • @koongfu00
    @koongfu00 Před 5 měsíci

    How to make this work on a linux server without Qt?

  • @larianemouad4884
    @larianemouad4884 Před rokem +1

    Anyone having troubles with the opencv lib, for me it can't find the references

  • @charlesbanana6060
    @charlesbanana6060 Před rokem

    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 Před 7 měsíci

      How do u add python code into bulb?

    • @qwezxc23456
      @qwezxc23456 Před 6 měsíci

      ​There are Python libraries for smart bulbs. You connect to the bulb over wi-fi specifying it's IP address​ in Python code.@@alertsByJarvis

  • @meditation_and_focus245

    boss my winsound is not producing any sound

  • @splou6777
    @splou6777 Před rokem +1

    I have errors at import cv2 and impot imutils

    • @shenzo00ff
      @shenzo00ff Před 11 měsíci +1

      Bro first install in cmd

    • @havocff4900
      @havocff4900 Před 11 měsíci

      ​@@shenzo00ffbro source code available ? Can u share the link

  • @sarthaksingh7570
    @sarthaksingh7570 Před rokem +1

    This program was used in squid game Red light and green light...😅😅😅

  • @Solexdballer
    @Solexdballer Před rokem

    Awesome Dude......

  • @justacoder_
    @justacoder_ Před rokem

    alarm_mode = not alarm_mode
    wow this is mindblowing lol

  • @booster404
    @booster404 Před měsícem +1

    one more subscriber from me

  • @spike868
    @spike868 Před rokem

    Cool

  • @philtoa334
    @philtoa334 Před rokem

    Thx_.

  • @codenerd7823
    @codenerd7823 Před rokem

    11sec only

  • @guilhermeschitzamaral8627
    @guilhermeschitzamaral8627 Před 11 měsíci

    ⥊ 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.