Пример #1
0
    def __init__(self, title=__title__):
        super(WImageLoaded, self).__init__(title)
        self.title = title
        self.paused = True
        self.image2D = True
        self.exit = False
        self.layout = [[
            sg.Frame(title="",
                     layout=[[
                         sg.Text("File RGB:", size=(10, 1)),
                         sg.Input(key="InputRGB"),
                         sg.FileBrowse()
                     ], [sg.Submit(key="SubmitRGB")],
                             [sg.Text("", key="RGB_error", visible=False)],
                             [sg.Image(filename="", key="RGB_img")]]),
            sg.Frame(title="",
                     layout=[[
                         sg.Text("File Depth:", size=(10, 1)),
                         sg.Input(key="InputDepth"),
                         sg.FileBrowse()
                     ], [sg.Submit(key="SubmitDepth")],
                             [sg.Text("", key="Depth_error", visible=False)],
                             [sg.Image(filename="", key="Depth_img")]])
        ],
                       [
                           sg.Button(button_text="Exit",
                                     key="Exit",
                                     size=(10, 1),
                                     font=("verdana", 14))
                       ]]

        self.window = None
Пример #2
0
 def __init__(self, title=__title__):
     super(TestingWindow, self).__init__(title)
     self.title = title
     self.paused = True
     self.image2D = True
     self.exit = False
     self.layout = [[
         sg.Text(title,
                 size=(40, 1),
                 justification="center",
                 font=("wingdings", 20))
     ],
                    [
                        sg.Image(filename="", key="image_color"),
                        sg.Image(filename="", key="image_depth")
                    ],
                    [
                        sg.Image(filename="", key="image_color_cropped"),
                        sg.Image(filename="", key="image_depth_cropped")
                    ],
                    [
                        sg.Button(button_text="Start",
                                  key="Start",
                                  size=(7, 1),
                                  font=("wingdings", 14)),
                        sg.Button(button_text="Resume",
                                  key="Resume",
                                  size=(7, 1),
                                  font=("wingdings", 14),
                                  visible=False),
                        sg.Button(button_text="Pause",
                                  key="Pause",
                                  size=(7, 1),
                                  font=("Verdana", 14)),
                        sg.Button(button_text="Stop",
                                  key="Stop",
                                  size=(7, 1),
                                  font=("Verdana", 14))
                    ],
                    [
                        sg.Button(button_text="Save PNG",
                                  key="Save_PNG",
                                  size=(10, 1),
                                  font=("verdana", 14)),
                        sg.Button(button_text="Take Frames",
                                  key="Take_Frames",
                                  size=(10, 1),
                                  font=("verdana", 14)),
                        sg.Button(button_text="Save PLY",
                                  key="Save_PLY",
                                  size=(10, 1),
                                  font=("verdana", 14)),
                        sg.Button(button_text="Exit",
                                  key="Exit",
                                  size=(10, 1),
                                  font=("verdana", 14)),
                    ]]
     self.window = None
Пример #3
0
def creategui():
    sg.ChangeLookAndFeel('BlueMono')

    frame_layout = [
        [sg.T('Elapsed', size=(60, 1), key='-ELAPSED-')],
        [sg.Multiline('', size=(60, 12), autoscroll=True, key='-ML-')],
    ]

    # define the window layout
    layout = [[
        sg.Text('OMRON HVC P2 Demo GUI',
                size=(50, 1),
                justification='center',
                font='Helvetica 20')
    ], [sg.Image(filename='', key='image'),
        sg.Frame('Result', frame_layout)],
              [
                  sg.ReadButton('Exit',
                                size=(10, 1),
                                pad=((0, 0), 3),
                                font='Helvetica 14'),
                  sg.RButton('Pause',
                             key='-RUN-PAUSE-',
                             size=(10, 1),
                             font='Any 14')
              ]]

    # create the window and show it without the plot
    window = sg.Window('OMRON HVC P2 Demo Application', location=(400, 200))
    #window.Layout(layout).Finalize()
    window.Layout(layout)

    return window
Пример #4
0
def main():
    # filename = 'C:/Python/MIDIVideo/PlainVideos/- 08-30 Ted Talk/TED Talk Short - Video+.mp4'
    filename = sg.PopupGetFile('Filename to play')
    if filename is None:
        exit(69)
    vidFile = cv.VideoCapture(filename)
    # ---===--- Get some Stats --- #
    num_frames = vidFile.get(cv.CAP_PROP_FRAME_COUNT)
    fps = vidFile.get(cv.CAP_PROP_FPS)

    sg.ChangeLookAndFeel('Dark')

    # define the window layout
    layout = [[
        sg.Text('OpenCV Demo',
                size=(15, 1),
                pad=((510, 0), 3),
                justification='center',
                font='Helvetica 20')
    ], [sg.Image(filename='', key='image')],
              [
                  sg.Slider(range=(0, num_frames),
                            size=(115, 10),
                            orientation='h',
                            key='slider')
              ],
              [
                  sg.ReadButton('Exit',
                                size=(10, 2),
                                pad=((600, 0), 3),
                                font='Helvetica 14')
              ]]

    # create the window and show it without the plot
    window = sg.Window('Demo Application - OpenCV Integration',
                       no_titlebar=False,
                       location=(0, 0))
    window.Layout(layout)
    window.ReadNonBlocking()

    # ---===--- LOOP through video file by frame --- #
    i = 0
    temp_filename = next(tempfile._get_candidate_names()) + '.png'
    while vidFile.isOpened():
        button, values = window.ReadNonBlocking()
        if button is 'Exit' or values is None:
            os.remove(temp_filename)
            exit(69)
        ret, frame = vidFile.read()
        if not ret:  # if out of data stop looping
            break

        window.FindElement('slider').Update(i)
        i += 1

        with open(temp_filename, 'wb') as f:
            Image.fromarray(frame).save(temp_filename,
                                        'PNG')  # save the PIL image as file
            window.FindElement('image').Update(filename=temp_filename)
Пример #5
0
# get list of PNG files in folder
png_files = [folder + '\\' + f for f in os.listdir(folder) if '.png' in f]
filenames_only = [f for f in os.listdir(folder) if '.png' in f]

if len(png_files) == 0:
    sg.Popup('No PNG images in folder')
    exit(0)


# define menu layout
menu = [['File', ['Open Folder', 'Exit']], ['Help', ['About',]]]

# define layout, show and read the window
col = [[sg.Text(png_files[0], size=(80, 3), key='filename')],
          [sg.Image(filename=png_files[0], key='image')],
          [sg.ReadButton('Next', size=(8,2)), sg.ReadButton('Prev', size=(8,2)),
           sg.Text('File 1 of {}'.format(len(png_files)), size=(15,1), key='filenum')]]

col_files = [[sg.Listbox(values=filenames_only, size=(60,30), key='listbox')],
             [sg.ReadButton('Read')]]
layout = [[sg.Menu(menu)], [sg.Column(col_files), sg.Column(col)]]
window = sg.Window('Image Browser', return_keyboard_events=True, location=(0,0), use_default_focus=False ).Layout(layout)

# loop reading the user input and displaying image, filename
i=0
while True:

    button, values = window.Read()
    # --------------------- Button & Keyboard ---------------------
    if button is None:
Пример #6
0
        return bio.getvalue()
    return ImageTk.PhotoImage(img)


#------------------------------------------------------------------------------

# create the form that also returns keyboard events
window = sg.Window('Image Browser',
                   return_keyboard_events=True,
                   location=(0, 0),
                   use_default_focus=False)

# make these 2 elements outside the layout as we want to "update" them later
# initialize to the first file in the list
filename = os.path.join(folder, fnames[0])  # name of first file in list
image_elem = sg.Image(data=get_img_data(filename, first=True))
filename_display_elem = sg.Text(filename, size=(80, 3))
file_num_display_elem = sg.Text('File 1 of {}'.format(num_files), size=(15, 1))

# define layout, show and read the form
col = [[filename_display_elem], [image_elem]]

col_files = [[
    sg.Listbox(values=fnames,
               change_submits=True,
               size=(60, 30),
               key='listbox')
],
             [
                 sg.ReadButton('Next', size=(8, 2)),
                 sg.ReadButton('Prev', size=(8, 2)), file_num_display_elem