Skip to content

Commit

Permalink
fix: bugs fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
NitkarshChourasia committed Jan 14, 2024
1 parent 4f322f5 commit 1924e81
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions webcam.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Requirements:
# pip install numpy
# sudo apt-get install python-openCV
# pip install opencv-python
# Program:
# opens your webcam, and records.
# Opens your webcam and records.

# Improve this program and make it suitable for general module like use in another programs
import cv2

cap = cv2.VideoCapture(0)
Expand All @@ -13,7 +14,7 @@
frames_height = int(cap.get(4))

# Specify the video codec
# FourCC is plateform dependent, however MJPG is a safe choice.
# FourCC is platform dependent; however, MJPG is a safe choice.
fourcc = cv2.VideoWriter_fourcc(*"MJPG")

# Create video writer object. Save file to recording.avi
Expand All @@ -24,7 +25,6 @@
ret, frame = cap.read()

if ret == True:

# Write frame to recording.avi
out.write(frame)

Expand All @@ -36,7 +36,7 @@
if cv2.waitKey(1) & 0xFF == ord("q"):
break

# When everything done, release the capture and video writer
# When everything is done, release the capture and video writer
cap.release()
out.release()
cv2.destroyAllWindows()

0 comments on commit 1924e81

Please sign in to comment.