-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsample.py
36 lines (27 loc) · 781 Bytes
/
sample.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import copy
import numpy as np
import cv2 as cv
from cv_comparison_slider_window import CvComparisonSliderWindow
def main():
cvwindow = CvComparisonSliderWindow(
window_name='debug',
line_color=(255, 255, 255),
line_thickness=1,
)
cap = cv.VideoCapture(0)
while True:
ret, frame = cap.read()
if not ret:
continue
frame = cv.resize(frame, (960, 540))
original_frame = copy.deepcopy(frame)
frame = cv.Canny(frame, 100, 100)
frame = cv.cvtColor(frame, cv.COLOR_GRAY2BGR)
cvwindow.imshow(original_frame, frame)
key = cv.waitKey(1)
if key == 27: # ESC
break
cap.release()
cv.destroyAllWindows()
if __name__ == '__main__':
main()