commit
c03a8000bc
|
@ -36,7 +36,7 @@ SC, GCF, WCF = .1, 1, 7/4
|
||||||
sg.change_look_and_feel('Dark Black 1') # make it look cool
|
sg.change_look_and_feel('Dark Black 1') # make it look cool
|
||||||
|
|
||||||
# ---------------- A Quick Little Window - to get camera to use ----------------
|
# ---------------- A Quick Little Window - to get camera to use ----------------
|
||||||
win_get_cam = sg.Window('Which Camera?',[[sg.T('Which camera?')],[sg.Combo(['Front', 'Rear'], default_value='Rear', font='any 20')], [sg.Ok()]], location=(0,0))
|
win_get_cam = sg.Window('Which Camera?',[[sg.T('Which camera?')],[sg.Combo(['Front', 'Rear'], default_value='Rear', font='any 20')],[sg.T(size=(1,2))], [sg.Ok()]], location=(0,0))
|
||||||
event, values = win_get_cam.read()
|
event, values = win_get_cam.read()
|
||||||
win_get_cam.close()
|
win_get_cam.close()
|
||||||
if event != 'Ok': exit()
|
if event != 'Ok': exit()
|
||||||
|
|
|
@ -11,8 +11,17 @@ import cv2
|
||||||
|
|
||||||
CAMERA_FRONT = 1
|
CAMERA_FRONT = 1
|
||||||
CAMERA_REAR = 0
|
CAMERA_REAR = 0
|
||||||
|
|
||||||
sg.change_look_and_feel('Dark Black 1')
|
sg.change_look_and_feel('Dark Black 1')
|
||||||
|
|
||||||
|
# ---------------- A Quick Little Window - to get camera to use ----------------
|
||||||
|
win_get_cam = sg.Window('Which Camera?',[[sg.T('Which camera?')],[sg.Combo(['Front', 'Rear'], default_value='Rear', font='any 20')],[sg.T(size=(1,2))], [sg.Ok()]], location=(0,0))
|
||||||
|
event, values = win_get_cam.read()
|
||||||
|
win_get_cam.close()
|
||||||
|
if event != 'Ok': exit()
|
||||||
|
USE_CAMERA = [CAMERA_FRONT, CAMERA_REAR][values[0]=='Rear']
|
||||||
|
|
||||||
|
|
||||||
# define the window layout
|
# define the window layout
|
||||||
layout = [[sg.Image(filename='', key='-IMAGE-', tooltip='Right click for exit menu')],
|
layout = [[sg.Image(filename='', key='-IMAGE-', tooltip='Right click for exit menu')],
|
||||||
[sg.Exit()],]
|
[sg.Exit()],]
|
||||||
|
@ -23,7 +32,7 @@ window = sg.Window('Demo Application - OpenCV Integration', layout, location=(0,
|
||||||
right_click_menu=['&Right', ['E&xit']], ) # if trying Qt, you will need to remove this right click menu
|
right_click_menu=['&Right', ['E&xit']], ) # if trying Qt, you will need to remove this right click menu
|
||||||
|
|
||||||
# ---===--- Event LOOP Read and display frames, operate the GUI --- #
|
# ---===--- Event LOOP Read and display frames, operate the GUI --- #
|
||||||
cap = cv2.VideoCapture(CAMERA_REAR) # Setup the OpenCV capture device (webcam)
|
cap = cv2.VideoCapture(USE_CAMERA) # Setup the OpenCV capture device (webcam)
|
||||||
while True:
|
while True:
|
||||||
event, values = window.read(timeout=20)
|
event, values = window.read(timeout=20)
|
||||||
if event in ('Exit', None):
|
if event in ('Exit', None):
|
||||||
|
|
Loading…
Reference in New Issue