Make A Security Camera With Python
ฝัง
- เผยแพร่เมื่อ 7 ก.ค. 2024
- Welcome back to another video! In this video, I'm going to show how to create a security camera system using OpenCV. We'll be detecting a face or body in the footage so a webcam or external camera that can connect to your computer is needed. We'll be using that camera through OpenCV and detecting a face or body before recording.
💻 AlgoExpert is the coding interview prep platform that I used to ace my Microsoft and Shopify interviews. Check it out and get a discount on the platform using the code "techwithtim" algoexpert.io/techwithtim
📄 Resources 📄
OpenCV Tutorial Series: • OpenCV Python Tutorials
Code In This Video: github.com/techwithtim/Python...
OpenCV FourCC's: www.fourcc.org/codecs.php
OpenCV HaarCascades: github.com/opencv/opencv/tree...
Fix Pip (Mac): • How to Install Pygame ...
Fix Pip (Windows): • How to Install Pygame ...
⭐️ Timestamps ⭐️
00:00 | Overview
01:15 | OpenCV Setup
02:43 | Displaying Webcam Video
06:35 | Detecting Faces and Bodies
12:46 | Drawing Faces On Video
16:09 | Saving And Recording Video
20:25 | Security Camera Logic
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
💰 Courses & Merch 💰
💻 The Fundamentals of Programming w/ Python: tech-with-tim.teachable.com/p...
👕 Merchandise: teespring.com/stores/tech-wit...
🔗 Social Medias 🔗
📸 Instagram: / tech_with_tim
📱 Twitter: / techwithtimm
⭐ Discord: / discord
📝 LinkedIn: / tim-ruscica-82631b179
🌎 Website: techwithtim.net
📂 GitHub: github.com/techwithtim
🔊 Podcast: anchor.fm/tech-with-tim
🎬 My TH-cam Gear 🎬
🎥 Main Camera (EOS Canon 90D): amzn.to/3cY23y9
🎥 Secondary Camera (Panasonic Lumix G7): amzn.to/3fl2iEV
📹 Main Lens (EFS 24mm f/2.8): amzn.to/2Yuol5r
🕹 Tripod: amzn.to/3hpSprv
🎤 Main Microphone (Rode NT1): amzn.to/2HrZxXc
🎤 Secondary Microphone (Synco Wireless Lapel System): amzn.to/3e07Swl
🎤 Third Microphone (Rode NTG4+): amzn.to/3oi0v8Z
☀️ Lights: amzn.to/2ApeiXr
⌨ Keyboard (Daskeyboard 4Q): amzn.to/2YpN5vm
🖱 Mouse (Logitech MX Master): amzn.to/2HsmRDN
📸 Webcam (Logitech 1080p Pro): amzn.to/2B2IXcQ
📢 Speaker (Beats Pill): amzn.to/2XYc5ef
🎧 Headphones (Bose Quiet Comfort 35): amzn.to/2MWbl3e
🌞 Lamp (BenQ E-reading Lamp): amzn.to/3e0UCr8
🌞 Secondary Lamp (BenQ Screenbar Plus): amzn.to/30Dtafi
💻 Monitor (BenQ EX2780Q): amzn.to/2HsmUPZ
💻 Monitor (LG Ultrawide 34WN750): amzn.to/3dSD7tS
🎙 Mic Boom Arm (Rode PSA 1): amzn.to/30EZw9m
🎚 Audio Interface (Focusrite Scarlet 4i4): amzn.to/2TjXsih
💸 Donations 💸
💵 One-Time Donations: www.paypal.com/donate?hosted_...
💰 Patreon: / techwithtim
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
⭐️ Tags ⭐️
- Tech With Tim
- Security
- OpenCV
- Security Camera
- Detecting Faces
- Python
⭐️ Hashtags ⭐️
#TechWithTim #SecurityCamera
I think the best programming tutorial a youtuber can make is teaching how to read a module documentation efficiently and intuitively.
Absolutely true. If you find any please share it with mam/ sir
Couldn't agree more!!
Yes!
I see some bots in these chats ... really good bots ... check the comments carefully
yes, I am agree because this is the hardest part
The stuff you do for this community at no charge is just amazing. Thanks, Tim!
Tim, you are the best. I hope there will be continue of this series (at least part two):
1.) Manage files (delete records older than some period)
2.) Notification on e-mail about new record
3.) ... and more features with Python
Tim, thank you for your TH-cam content! ;)
Easy to find. Tim is just introducing the subject
Great video as always Tim, I cant even imagine how stressful it must be to try to code and explain, but just thought I mention that for future it might help to include comments on your code as it will help reduce the amount of explanation you would need to do, and is usually better practice right. Thanks again for your awesome content.
Tim you're doing a great job!!
Keep up the good work!!👍🏻
I like the way you explain and present your code, especially at the end of video wrapping up is really helpful. Thank you for awesome content!
you are such a great explainer dude ! honestly the video is simple to understand , concise and very very informative !!! you helped me a lot !
when he creates a variable more than 10 letters long, you know his a legend
I think I had complete the feature mention earlier in the vedio, but i will still follow this series to seek the better way of doing it.
This guy is one of the best developer in the world!
Hes good at best not really the best
@@Bruh-sp2bj He said ONE of the best not the best. Ffs.
@@johnwig285 not even one of the best ffs. Decent
Tim, thanks for the example, very good.
Damn, that is some good stuff. That CV library looks comprehensive. Thanks for sharing!
The best Python guy that creates a social engineering tools
Very well explained, good job man!
Learning Python ... subbed because your content turns out to be HQ lessons.
Thanks Tim... you are an amazing gent 🙏
Best Developer in the World
To make your video start faster add this code to define some of the video parameters. It will cut the start of the video in half or more.
cam=cv2.VideoCapture(1,cv2.CAP_DSHOW)
cam.set(cv2.CAP_PROP_FRAME_WIDTH, width)
cam.set(cv2.CAP_PROP_FRAME_HEIGHT,height)
cam.set(cv2.CAP_PROP_FPS, 20)
cam.set(cv2.CAP_PROP_FOURCC,cv2.VideoWriter_fourcc(*'mp4v'))
Tim, this is sooooo cool
great work tim!
This channel is simply a treasure
This is really cool!
i literally just looked up how to detect motion with python on my 2nd monitor.... looked over on my 1st monitor youtube, and this video popped up!
I like it you are actually a genius
Nice video, Tim👍
Great tutorial !!
Thank you very much
dude i just wanna take ur blessing ahahahaha U ARE SO GOOD AT IT
What module do I need to make the import command colour be red and not the pink colour it usually is
after the opencv tutorials. this is just what i need
Typical comment on his videos
Thanks Tim
I would love to see you talk about using a camera wirelessly (for instance using a raspberry pi with an esp32 cam)
Ig what you can do is give it a lot of storage and set up a ssh system so that you can wirelessly control your raspberry pi and thus you could see the recordings from anywhere in the world
Im following.
Very very interesting!
I’m 43 yrs old and want to be as smart and articulate as this kid when I grow up
Legend, thank you
this the type of videos i wana watch, thanks bro!
tim you are amazing love from india
thank you so much
thx for the tutorial)))
heey Tim great video, which is better : build our own classifier or use the built in classifiers for safety and robustness reasons like if someone is building a bank security system, and how can we use this open cv code to interact with a real camera like in banks, thanks budy
awesome stuff. i wrote a camera app in android but it is really hard. i got a camera in my roof that records things that fly over my house. i want to set up a python camera that will record only birds but the end goal is record ufos. that kinda script would be priceless for the ufo community.
I followed along and got a working security program written in python, awesome thank you very much. I've just started learning Python but I've watched a few of your videos, the others being the python curses/ncurses tutorials, awesome videos and explanation of the examples. Thank you.
*** how can I redirect where the video gets saved, as of now all files are saved in the directory where the script resides in, thanks.
Who misses this Tim who didn't make hyper-stimulating videos?
Its really good!
Can you show how to creat a screen recorder in python
Could you please make a video on easing-functions?
Thank bro..
Great stuff. Possible bug on line 25.
Thank you
Me when my code doesn't run properly: 13:29
Me when my code does work: 13:28
Lol
Great Video! could make a part two in which the webcam detects a person and opens a door if the right person's face is detected. It would be really cool!
thanks for project
Do you have a tutorial showing how to set up visual studio code?
Hello Tim,
sorry, but nothing more than the many tutorials on this subject.
I would have hoped from you that you would divide the screen for four cameras,
that you say after 5 seconds start cam 1, the body is in front of cam 2 so it starts after the first one goes off if it detects a body.
I would have wanted you to show how the video can take a photo when you detect the face ... ect
but you still the best;)
Hey Tim, What is your Color Theme do you use? Mine are kinda boring I want to change to something and I think what you're using is gonna work.
excellent video, thanks for sharing, with that last statement regarding showing the video frame, i use a raspberry pi, could you set a key press that will show the current video, as if you wake up to a sound and hit the key to show the camera live view
hey tim, great video. can you please tell me how can I record the audio along with the video?
Great video! One small bug: You are using the same cascade for body and face:
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
bodies = face_cascade.detectMultiScale(gray, 1.3, 5)
My detectMultiScale isnt working it just gives me an error
@@Hog-n same here :(
hello TIM you are the best youtuber/programmer python spesialist for me..i am a new programmer i lvoe python and i am making tons of your videos to practise and get any better in this..so if you can make a video of this camera project to make it even better?perhaps send an email notification on your phone or somethink like that? thx a lot
Hey Tim can you please create a video on regular expressions in python
Can you make a body tracer that gives same input as a keyboard? For example: if you lower your upper body to the right (keeping legs in the same place, facing the camera), this move would be equivalent to you pressing right arrow key. Is that possible in pure python?
"this is your daily dose of internet"
I had to fix the pipX install on my friends windows box, python nor was pip wasn't in the path & pipenv wasn't installed. The hardest part for me was trying to find out where python (& pipenv) lives on windows so I could just add them myself to the system environment. Once the windows system knows where python is, the Tim way works. I was thinking you should write a python module app script to try the various methods of install, then realised, you'd need to have installed that module to use it (segfault: redo from start lol)
Excellent video, thank you, so I have one question, can I do the same with an ip camera?
very cool 😎
you re the best
your explanation skills are exceptional.. you know exactly when it start become confusing and then you stop and explain it.. every line is explained.. i couldn't ask for a better tutorial.. i literally feel it's like a private tutorial 1on1.. exceptional work.. just one question on line 38 when the result is false isn't it just goes to the if statement on the line above aka line 37 and hence it will never check if there's a 'new' body/face? or when the if is false it returns to the upper most scope?
to end the delay of turn on the camera, jus do this: cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
i dont know why it works, but it works
Amazing
Nice
Sir once we record the recording will be save to our local system. How can we upload or store the recording made by the webcam to cloud?
I have no idea what this guy is saying, but im really interested
correkt
How can we generate data from this program? For example to generate data in a database, location or how many different people where spotted in different time period?
Could you add some code to detect somebody ‘s face and this give some output like opening a door???
cool video
cap = cv2.VideoCapture(0, cv2.CAP_DSHOW) will open fast
Machine learning with EMG sensor plz
Can you make a program to detect thermal cameras?
Where do business save these video recordings usually? on a local server or in some cloud? if the cloud how do they connect the cameras to there?
Normally you would save it on a local device. I don't really see the point in having it in a cloud, unless maybe you employ a separate security firm that needs access to the data. You also probably wouldn't stream directly to a cloud (raw video data is huge), it makes more sense to encode the data locally and then send the completed file to the cloud.
Hi amazing video like always but i have an error after writing
{ faces = face_cascade.detectMultiScale(gray, 1.3, 5) } if i remove this line it's works what should i do ?
Nice .How can I run multiple camera using this code?
Any idea on how to make it work where it doens't record YOU but everyone else?
It’s okay, but how can I transmit image by RTSP protocol?
Can u make when u turn pc on to you get notification on phone that your computer turned on?
What about using a stream from an IP camera?
What if I wanted to make a face ID thing, where my computer would do something when I enter it's camera?
Import cv2 doesn’t work for me, what else can I do? I love your videos
what coding platform did u use, please I really want to do this and I love your vids
He used python
Does this work with a phone camera
Question what if camera detect a person wears mask like hiding his face does program start recording?
Lol I put the timestamp generation + assignment to 'out' on the wrong side of the if/else conditions, and that caused a file to generate every few frames/every second in real time.
How can it detect the difference between family persons faces and real theft persons??
what IDE are you using in combination with tabnine?
Sublime Text bro
What editor is he using
What algorithm does this use?
If i do it laptop, will it require external camera or not?
Hi
How about audio
How read video and audio together
Aren't we supposed to use body_cascade (for bodies) in line 23 ?
Yes
I was about to comment that lol
Yesssss
Line 17: resulting an error e.depth() == CV_8U in function 'cv::CascadeClassifierImpl::detectMultiScale'
it doesn't save the videos at the end of the recordings. I already checked in the folder when the code is saved.