Skip to content

Commit 975f7a7

Browse files
Merge pull request #3095 from mr-d-luffy/mr-temp
comments
2 parents 23d7b24 + cb218c7 commit 975f7a7

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

encrypter_decrypter_gui.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ def backend_work(self, todo, text_coming):
257257
# ==================== Classes End Here ... ! =================
258258

259259

260+
# this code runes only in this file
260261
if __name__ == "__main__":
261262
run = Main()
262263
Notebook(run)

webcam.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

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

1011
cap = cv2.VideoCapture(0)
1112

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

20-
# Create video writer object. Save file to recording.avi
21-
out = cv2.VideoWriter("recording.avi", fourcc, 20.0, (frames_width, frames_height))
21+
# exception Handling for captured video
22+
try:
23+
# 60 FPS video capture
24+
# Create video writer object. Save file to recording.avi
25+
out = cv2.VideoWriter("recording.avi", fourcc, 60.0, (frames_width, frames_height))
26+
except(Exception) as e:
27+
print(Fore.RED, e, Fore.RESET)
2228

2329
while True:
2430
# Capture frame-by-frame
@@ -27,16 +33,18 @@
2733
if ret == True:
2834
# Write frame to recording.avi
2935
out.write(frame)
30-
36+
37+
# color video output
3138
# Our operations on the frame come here
32-
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
39+
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2BGRA)
3340

3441
# Display the resulting frame
3542
cv2.imshow("frame", gray)
36-
if cv2.waitKey(1) & 0xFF == ord("q"):
43+
if cv2.waitKey(1) & 0xFF == ord(" "):
3744
break
3845

3946
# When everything is done, release the capture and video writer
4047
cap.release()
4148
out.release()
4249
cv2.destroyAllWindows()
50+

0 commit comments

Comments
 (0)