2020-04-06 18:59:23 +00:00
|
|
|
import cv2, PySimpleGUI as sg
|
2022-02-22 10:20:03 +00:00
|
|
|
# Make the window
|
|
|
|
window, cap = sg.Window('Demo Application - OpenCV Integration', [[sg.Image(filename='', key='image')], ], location=(800, 400)), cv2.VideoCapture(0)
|
|
|
|
# Loop reading video frames
|
2019-10-03 01:13:58 +00:00
|
|
|
while window(timeout=20)[0] is not None:
|
2022-02-22 10:20:03 +00:00
|
|
|
# Read a video frame and write it to the window
|
|
|
|
window['image'](data=cv2.imencode('.png', cap.read()[1])[1].tobytes())
|