Ejemplo n.º 1
0
def test_init():
	from HeadLocal import HeadLocal
	from Commands import Commands
	g_Head = HeadLocal()
	logger = StdoutLogger()
	InitCamera(logger, g_Head)
	g_Commands = Commands(g_Head, logger)
	g_Commands.CmdExtractorGetParameters()
Ejemplo n.º 2
0
def test_local_camera2():
    from HeadLocal import HeadLocal
    from Commands import Commands
    g_Head = HeadLocal()
    logger = StdoutLogger()
    InitCamera("local", "dump", logger, g_Head)
    g_Commands = Commands(g_Head, logger)
    g_Commands.start()

    CameraSetValues({'DumpFile': '1477947546'})
    g_Commands.CmdIPreview('test3.jpg')

    g_Commands.Shutdown()
Ejemplo n.º 3
0
def testGaussians():
    from HeadLocal import HeadLocal
    from Commands import Commands
    g_Head = HeadLocal()
    logger = StdoutLogger()
    InitCamera("local", "dump", logger, g_Head)
    g_Commands = Commands(g_Head, logger)
    g_Commands.start()

    CameraSetValues({'extractor': 'kp', 'DumpFile': '1477947546'})
    ExtractorSet({'GaussianSize': '5', 'Depth': '3'})
    g_Commands.CmdIPreview('test3.jpg')

    g_Commands.Shutdown()
Ejemplo n.º 4
0
def test_histogram():
    from HeadLocal import HeadLocal
    from Commands import Commands
    g_Head = HeadLocal()
    logger = StdoutLogger()
    InitCamera("local", "dump", logger, g_Head)
    g_Commands = Commands(g_Head, logger)
    #g_Commands.start()

    CameraSetValues({'DumpFile': '1502667084'})
    g_Commands.CmdCameraFire('green.jpg')

    g_Commands.ShutdownCamera()

    CameraSetValues({'DumpFile': '1502667129'})
    g_Commands.CmdCameraFire('blue.jpg')

    g_Commands.Shutdown()
Ejemplo n.º 5
0
def test_stat():
	from HeadLocal import HeadLocal
	from Commands import Commands
	g_Head = HeadLocal()
	logger = StdoutLogger()
	
	config = ConfigParser.ConfigParser()
	config.read('head.cfg')

	InitCamera(logger, g_Head, config)
	g_Commands = Commands(g_Head, logger)
	
	ExtractorSet({'AnomalyThreshold': 0.15})
	
	#g_Commands.CmdTestDump('1542258022', 't1.jpg', 1)
	#g_Commands.CmdTestDump('1542260639', 't1.jpg', 1)
	#g_Commands.CmdTestDump('1542260685', 't1.jpg', 1)
	#g_Commands.CmdTestDump('1542260719', 't1.jpg', 1)
	#g_Commands.CmdTestDump('1542568320', 't1.jpg', 0)
	#g_Commands.CmdTestDump('1542568439', 't1.jpg', 0)
	g_Commands.CmdTestDump('1543457501', 't1.jpg', 1)

	g_Commands.ShutdownCamera()
Ejemplo n.º 6
0
def test_local():
    from HeadLocal import HeadLocal
    InitCamera("local", "dump", StdoutLogger(), HeadLocal())
    #ExtractorSet({"Scale": "10"})
    print test_camera()
Ejemplo n.º 7
0
def readDump(fileName):

    from HeadLocal import HeadLocal
    InitCamera("local", "dump", StdoutLogger(), HeadLocal())
    (width, height, depth, data) = LoadDump(fileName)
    print(width, height, depth)
Ejemplo n.º 8
0
import sys
sys.path.append('.')

from Commands import Commands
from HeadLocal import HeadLocal


class Logger:
    def debug(self, message):
        print(message)


logger = Logger()
g_Head = HeadLocal()
g_Commands = Commands(g_Head, logger)


def test1():
    global g_Commands
    g_Commands.CmdGetControlPoints()

    print "\n\n-----\n\n"
    print(g_Commands.LastResult['points']['OPEN']['FARTHEST'])
    print(g_Commands.LastResult['points']['OPEN']['MID'])
    print(g_Commands.LastResult['points']['OPEN']['CLOSEST'])
    print("\n")
    print(g_Commands.LastResult['predict']['OPEN']['a'])
    print(g_Commands.LastResult['predict']['OPEN']['g'])
    print "\n\n-----\n\n"

    g_Commands.CmdTestGrabPosition('OPEN', 164)
Ejemplo n.º 9
0
    g_Head.Shutdown()
    g_Commands.Shutdown()
    app.logger.debug('SHUTDOWN OK')
    shutdown_server = request.environ.get('werkzeug.server.shutdown')
    if shutdown_server is None:
        raise RuntimeError('Not running with the Werkzeug Server')
    shutdown_server()
    return Response("{'status': 'ok'}",
                    content_type='text/plain; charset=utf-8')


if __name__ == "__main__":

    config = ConfigParser.ConfigParser()
    config.read('head.cfg')

    if len(sys.argv) >= 2 and sys.argv[1] == "local":
        from HeadLocal import HeadLocal
        g_Head = HeadLocal(config)
    else:
        from Head import Head
        g_Head = Head(config)

    InitCamera(app.logger, g_Head, config)

    g_Commands = Commands(g_Head, app.logger, config)

    g_Commands.start()

    app.run(host='0.0.0.0', port=7778, debug=True)