How to Create Home surveillance system using Python

Поделиться
HTML-код
  • Опубликовано: 5 сен 2024

Комментарии • 26

  • @nakul--
    @nakul-- Год назад

    loveyou yaarrrr, i legit made it and learnt so much from you!!! I literally ran it on my laptop...and you cant imagine how happy I'm right now. Thanks man..

    • @shivanigangwar1192
      @shivanigangwar1192 Год назад +1

      hi, my code is not running, it is going into processing for long time. please help

    • @nakul--
      @nakul-- Год назад

      @@shivanigangwar1192 Hey! So, I had a lot of errors as well! Thats how we learn actually, I scrolled through stack overflow,used chatGpt,google, a lot of other sources to finally remove all the errors,please be careful about the directory you provide for the pictures and video
      ,here is my code :

    • @nakul--
      @nakul-- Год назад

      import cv2
      import time
      from datetime import datetime
      import argparse
      import os
      face_cascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
      video = cv2.VideoCapture(0)
      counter = 0
      while True:
      check, frame = video.read()
      if frame is not None:
      gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
      faces = face_cascade.detectMultiScale(gray, scaleFactor=1.1, minNeighbors=10)

      for x, y, w, h in faces:
      img = cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 3)
      exact_time = datetime.now().strftime('%Y-%b-%d-%H-%M-%S-%f')
      file_name = "C:/Users/dell/Desktop/Computer Vision/project/face_detected_{}.jpg".format(counter)
      cv2.imwrite(file_name, frame, [cv2.IMWRITE_JPEG_QUALITY, 100])
      print("Saved:", file_name)
      counter += 1
      cv2.imshow("home surv", frame)
      key = cv2.waitKey(1)
      if key == ord('q'):
      break
      video.release()
      cv2.destroyAllWindows()
      dir_path = "C:/Users/dell/Desktop/Computer Vision/project/"
      ext = "jpg"
      output = "C:/Users/dell/Desktop/Computer Vision/project/output.mp4"
      images = [f for f in os.listdir(dir_path) if f.endswith(ext)]
      images.sort()
      if len(images) > 0:
      first_image_path = os.path.join(dir_path, images[0])
      frame = cv2.imread(first_image_path)
      height, width, channels = frame.shape
      fourcc = cv2.VideoWriter_fourcc(*'mp4v')
      out = cv2.VideoWriter(output, fourcc, 5.0, (width, height))
      for image in images:
      image_path = os.path.join(dir_path, image)
      frame = cv2.imread(image_path)
      out.write(frame)
      out.release()

    • @nakul--
      @nakul-- Год назад

      and also keep the haarcascade_frontalface_default.xml file and the python script in one folder, it is very important! I hope this helps!

  • @samuvelramesh993
    @samuvelramesh993 3 года назад

    That explanations 😍😍 thank you bro. Finally a productive thing from Instagram 😂 highlighting me your channel

  • @devshinde3326
    @devshinde3326 3 года назад +1

    hey, can u please help me with code where I can use mobile camera for input

  • @KabirKhan-pc4fs
    @KabirKhan-pc4fs 3 года назад +2

    i am not able to import cv2 , i also tried pip install cv2 also i tried uninstalling and re-installing again but it shows no such module ,....what to do ?

    • @shreyadeb01
      @shreyadeb01 2 года назад

      yes me too. Even i cant import cv2, so its showing error not able to run the code.

    • @abhishekpatil5768
      @abhishekpatil5768 Год назад

      Do pip install opencv

    • @abhishekpatil5768
      @abhishekpatil5768 Год назад

      @@shreyadeb01 pip install opencv

  • @Kishi1969
    @Kishi1969 3 года назад

    Looking forward my dude

  • @buttscratcher4530
    @buttscratcher4530 3 года назад

    Nice work 👌

  • @vantakalabhavana9451
    @vantakalabhavana9451 Год назад

    The haarcascade_ frontalface_ default .XML where we need to save this file ? We need to save the file in same folder of our original code

  • @rohinijadhav0055
    @rohinijadhav0055 Год назад +1

    How we can use mobile

  • @richapatil908
    @richapatil908 3 года назад

    You explain so well I recognized your voice. Amazing

  • @rzvn111
    @rzvn111 10 месяцев назад

    Thanks man

  • @seyedmohsen2306
    @seyedmohsen2306 Год назад

    Hi
    How about audio
    How read video and audio together

  • @brefat
    @brefat 3 года назад

    nice i wait it

  • @abhijithunni2976
    @abhijithunni2976 3 года назад

    Super bro

  • @fintech1378
    @fintech1378 8 месяцев назад

    Can you do it real-time

  • @rohinijadhav0055
    @rohinijadhav0055 Год назад

    Where we can find code for using mobile as External device

  • @pinikeshibindupriya5020
    @pinikeshibindupriya5020 Год назад

    Vedio is not opening

  • @RakeshKumar-mt9fv
    @RakeshKumar-mt9fv 3 года назад

    Facing lots of error
    Please suggest

  • @ldwabananattqw
    @ldwabananattqw 3 года назад

    15:39
    But the guy who want to break into my house must be covered his face