Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions encrypter_decrypter_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ def backend_work(self, todo, text_coming):
# ==================== Classes End Here ... ! =================


# this code runes only in this file
if __name__ == "__main__":
run = Main()
Notebook(run)
Expand Down
18 changes: 13 additions & 5 deletions webcam.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

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

cap = cv2.VideoCapture(0)

Expand All @@ -17,8 +18,13 @@
# FourCC is platform dependent; however, MJPG is a safe choice.
fourcc = cv2.VideoWriter_fourcc(*"MJPG")

# Create video writer object. Save file to recording.avi
out = cv2.VideoWriter("recording.avi", fourcc, 20.0, (frames_width, frames_height))
# exception Handling for captured video
try:
# 60 FPS video capture
# Create video writer object. Save file to recording.avi
out = cv2.VideoWriter("recording.avi", fourcc, 60.0, (frames_width, frames_height))
except(Exception) as e:
print(Fore.RED, e, Fore.RESET)

while True:
# Capture frame-by-frame
Expand All @@ -27,16 +33,18 @@
if ret == True:
# Write frame to recording.avi
out.write(frame)


# color video output
# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2BGRA)

# Display the resulting frame
cv2.imshow("frame", gray)
if cv2.waitKey(1) & 0xFF == ord("q"):
if cv2.waitKey(1) & 0xFF == ord(" "):
break

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

Loading