File tree Expand file tree Collapse file tree 3 files changed +50
-3
lines changed
Expand file tree Collapse file tree 3 files changed +50
-3
lines changed Original file line number Diff line number Diff line change 1+ This python script is used for taking images from your webcam and saving it on your local device. Path to the folder can be specified using the following command:
2+
3+ > python3 take_pictures_from_webcam.py --directory pathname
4+
5+ The default path would be your current directory.
6+
7+ You can also give name to your image using following command:
8+ > python3 take_pictures_from_webcam.py --name ImageName
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+
3+ import cv2
4+ import click
5+ import os
6+
7+ @click .command ()
8+ @click .option (
9+ "--directory" , default = "None" , help = "Directory in which to store frames"
10+ )
11+ @click .option (
12+ "--name" , default = "person" , help = "Directory in which to store frames"
13+ )
14+ def main (name , directory ):
15+ if directory == "None" :
16+ directory = os .getcwd ()
17+ capture = cv2 .VideoCapture (0 )
18+ frame_count = 0
19+ while True :
20+ ret , frame = capture .read ()
21+ frame = cv2 .resize (frame , (600 ,600 ))
22+ cv2 .imshow ("frame" , frame )
23+ key = cv2 .waitKey (50 )
24+ if key & 0xFF == ord ("q" ):
25+ cv2 .destroyAllWindows ()
26+ break
27+ if key & 0xFF == ord (" " ):
28+ cv2 .imwrite (f"{ directory } /{ name + str (frame_count )} .jpg" , frame )
29+ print (f"got { name + str (frame_count )} " )
30+ frame_count += 1
31+
32+
33+ if __name__ == "__main__" :
34+ main ()
Original file line number Diff line number Diff line change @@ -61,10 +61,15 @@ Create a star pattern pyramid
6161## Script 13 - compound interest calculator
6262calculate compound interest
6363
64- ## Script 14 - Mouse mover
65- Moves your mouse every 15 seconds
64+ ## Script 14 - Image Capture
65+ Capture image from your webcam and save it on your local device.
66+
6667## Script 15 - JSON to YAML converter
6768Converts JSON file to YAML files. A sample JSON is included for testing.
6869
6970## Script 16 - AutoCert
70- A Python script to auto generate e-certificates in bulk.
71+ A Python script to auto generate e-certificates in bulk.
72+
73+ ## Script 17 - Mouse mover
74+ Moves your mouse every 15 seconds
75+
You can’t perform that action at this time.
0 commit comments