コード例 #1
0
def main():

    GUI.disclaimer()

    initialize()

    done = False
    while not done:

        #Live feed show
        if not work_queue.empty():
            frame = work_queue.get()
            cv2.imshow("Image", frame)
            cv2.waitKey(1)

        if msvcrt.kbhit():
            """Keyboard input handler only for Windows platform"""
            GUI.disclaimer()
            usr_in = msvcrt.getch()
            if usr_in == b'v':
                #  Start the private vehicle detection thread
                pass

            elif usr_in == b'c':
                #  Start the commercial vehicle detection thread
                pass

            elif usr_in == b'p':
                #  Start the pedestrian detection thread
                pass

            elif usr_in == b's':
                #  stop all detection threads
                pass

            elif usr_in == b'r':
                #  Stop all threads
                pass

            elif usr_in == b'h':
                os.system('cls')
                GUI.help()

            elif usr_in == b'q':
                camera_feed_thread.deactivate()
                camera_feed_thread.join()
                done = True
コード例 #2
0
def DetectPeople(cfgPath):
    print "hi"

    cam = Camera(cfgPath)

    app = QtWidgets.QApplication([])
    window = GUI(cfgPath)
    window.setCamera(cam)
    window.show()

    # Threading camera
    t_cam = ThreadCamera(cam)
    t_cam.start()

    # Threading GUI
    t_gui = ThreadGUI(window)
    t_gui.start()

    sys.exit(app.exec_())
コード例 #3
0
ファイル: global_engine.py プロジェクト: TeumessianFox/Blokus
 def play_game(self):
     self.start_ais()
     if self.activate_gui:
         gui = GUI(self.block_size, self.height, self.width,
                   [ai.name for ai in self.AIs])
         gui.update_screen(self.state)
     while not self.state.game_over:
         move = self.pick_move()
         piece_num, piece, anchor = move
         self.commit_move(piece_num, piece, anchor)
         if self.activate_gui:
             # update gui
             gui.update_screen(self.state)
         elif self.activate_terminal:
             print(self.state)
     # gui game end
     print("Game_Over")
     print(self.state.scores)
     print("Player " + str(np.argmax(self.state.scores) + 1) +
           " has won!\n")
     # while 1:
     #     continue
     return np.argmax(self.state.scores) + 1
コード例 #4
0
    tracker_prop, tracker_lib_prop = selectTracker(cfg)
    logger_status = readLoggerStatus(cfg)

    network = DetectionNetwork(net_prop)
    # Threading Network
    t_network = ThreadNetwork(network)
    t_network.setDaemon(True)  # setting daemon thread to exit
    t_network.start()

    tracker = Tracker(tracker_prop, tracker_lib_prop)
    # Threading Tracker
    t_tracker = ThreadTracker(tracker)
    t_tracker.setDaemon(True)
    t_tracker.start()

    window = GUI()
    cam.setGUI(window)
    cam.setLogger(logger_status)
    cam.setNetwork(network, t_network)
    cam.setTracker(tracker)
    cam.setNetworkParams(image_net_size, confidence)

    # Threading camera
    t_cam = ThreadCamera(cam)
    t_cam.setDaemon(True)
    t_cam.start()
    window.setNetwork(network, t_network)
    window.setTracker(tracker)

    if gui_cfg == 'on':
        window.show()
コード例 #5
0
    cfg = readConfig()
    cam = selectVideoSource(cfg)
    net_prop, DetectionNetwork = selectNetwork(cfg)

    # Threading the camera...
    t_cam = ThreadCamera(cam)
    t_cam.start()

    network = DetectionNetwork(net_prop)
    network.setCamera(cam)
    t_network = ThreadNetwork(network)
    t_network.start()

    app = QtWidgets.QApplication(sys.argv)
    window = GUI()
    window.setCamera(cam, t_cam)
    window.setNetwork(network, t_network)
    window.show()

    # Threading GUI
    t_gui = ThreadGUI(window)
    t_gui.start()

    print("")
    print("Requested timers:")
    print("    Camera: %d ms" % (t_cam.t_cycle))
    print("    GUI: %d ms" % (t_gui.t_cycle))
    print("    Network: %d ms" % (t_network.t_cycle))
    print("")
コード例 #6
0
import sys
import signal

from PyQt5 import QtWidgets

from Camera.camera import Camera
from Camera.threadcamera import ThreadCamera
from GUI.gui import GUI
from GUI.threadgui import ThreadGUI

signal.signal(signal.SIGINT, signal.SIG_DFL)

if __name__ == '__main__':

    cam = Camera()
    app = QtWidgets.QApplication(sys.argv)
    window = GUI()
    window.setCamera(cam)
    window.show()

    # Threading camera
    t_cam = ThreadCamera(cam)
    t_cam.start()

    # Threading GUI
    t_gui = ThreadGUI(window)
    t_gui.start()

    sys.exit(app.exec_())
コード例 #7
0
from GUI.gui import GUI
from GUI import callbacks
from GUI.app import app

from dash.dependencies import Output, Input, State

## create the GUI
gui = GUI()


## ugly part..., for rendering the tab content,
## because there is no other part can get layout instant,
## so put this callback func here###
@app.callback([Output('pages_content', 'children')], [Input('tabs', 'value')])
def renderContent(tab):
    if tab == 'tab1':
        return gui.layout.tabOne,
    else:
        return gui.layout.tabTwo,


if __name__ == '__main__':
    gui.app.run_server(host='0.0.0.0', debug=False)
コード例 #8
0
        for image in images:
            crop(image, page_area, image)

        page_size = define_page_size(images[0])

        page_area_in_pt = px_to_pt(page_size)

        page_area_in_pt = page_area_in_pt[0] - 100, page_area_in_pt[1] - 100

        print(page_area_in_pt)

        create_pdf_from_images(images,
                               page_area_in_pt,
                               output_dir=pdf_output_dir,
                               output_file=pdf_name)
    except Exception as e:
        print(e)

    print("finish")


if __name__ == '__main__':
    import sys

    app = QApplication(sys.argv)
    main_window = QMainWindow()
    ui = GUI(main_window)
    ui.add_logic()
    ui.set_downloader(download_book)
    sys.exit(app.exec_())
コード例 #9
0
while criteria() is False:
    print(i)

    img = find_img()
    time.sleep(1)
    link = img.get_attribute("src")
    links.append(link)
    next_page()

for i, link in enumerate(links):
    filename = "file" + str(i) + ".png"
    download_image(driver=driver, link=link, file_name=filename)
    crop(filename, (600, 0, 1200, 800), os.getcwd())

# link = seleniumq.find_image(imgs)
#
# script = "window.open({})".format(link)
#
# driver.execute_script(script)
# seleniumq.download_image(driver=driver, link=url, file_name="file{}.png".format(i))
#
# driver.save_screenshot("file{}.png".format(i))

create_pdf_from_images(["file{}.png".format(i) for i in range(amount_pages)])

driver.close()

if __name__ == '__main__':
    gui = GUI()
    gui.show()
コード例 #10
0
import argparse
import sys
from GUI.gui import GUI
from console.console import Console

cons = Console()


def createParser():
    parser = argparse.ArgumentParser()
    parser.add_argument('-i', '--insert')
    parser.add_argument('-v', '--view')
    return parser


if __name__ == '__main__':
    parser = createParser()
    namespace = parser.parse_args(sys.argv[1:])
    if namespace.insert != None:
        cons.get(str(namespace.insert))
    elif namespace.view != None:
        print(cons.view())
    else:
        GUI().wind()
コード例 #11
0
    return object


if __name__ == "__main__":
    # Init objects
    app = QtWidgets.QApplication(sys.argv)

    data = readConfig()
    cam, cam_depth = selectVideoSource(data)

    viz3d = None
    if cam_depth:
        viz3d = init_viz()
        window = GUI3D(cam, cam_depth)
    else:
        window = GUI(cam)
    window.show()

    estimator = Estimator(cam, cam_depth, viz3d, window, data["Estimator"])

    # Threading camera
    t_cam = ThreadCamera(cam)
    t_cam.setDaemon(True)
    t_cam.start()
    t_cam_depth = ThreadCamera(cam_depth)
    t_cam_depth.setDaemon(True)
    t_cam_depth.start()

    # Threading estimator
    t_estimator = ThreadEstimator(estimator)
    t_estimator.setDaemon(True)
コード例 #12
0
    else:
        raise SystemExit(
            ('%s not supported! Supported frameworks: Keras, TensorFlow') %
            (network_framework))

    cam = Camera(proxy)
    t_cam = ThreadCamera(cam)
    t_cam.start()

    network = Network(network_model_path)
    network.setCamera(cam)
    t_network = ThreadNetwork(network)
    t_network.start()

    app = QtWidgets.QApplication(sys.argv)
    window = GUI(framework_title)
    window.setCamera(cam, t_cam)
    window.setNetwork(network, t_network)
    window.show()

    # Threading GUI
    t_gui = ThreadGUI(window)
    t_gui.start()

    print("")
    print("Framework used: %s" % (framework_title))
    print("Requested timers:")
    print("    Camera: %d ms" % (t_cam.t_cycle))
    print("    GUI: %d ms" % (t_gui.t_cycle))
    print("    Network: %d ms" % (t_network.t_cycle))
    print("")