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()
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()
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()
def test_brightness(): InitCamera("pi", "cpp", StdoutLogger()) from time import sleep, time vision = VisionInstance() sleep(2) #vision.SetCameraParameter("BRIGHTNESS",60) #vision.SetCameraParameter("CONTRAST",30) #vision.SetCameraParameter("SHARPNESS",0) #vision.SetCameraParameter("SATURATION",0) #vision.SetCameraParameter("EXPOSURE", 1); for b in range(50000, 500000, 50000): vision.FileName = "static/test2_SHUTTER_SPEED%d.jpg" % b print vision.FileName vision.SetCameraParameter("SHUTTER_SPEED", b) print vision.GetImageMetrics() #vision.Fire() vision.Release()
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()
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()
def test_remote(): from Head import Head InitCamera("pi", "picamera", StdoutLogger(), Head()) print test_serie()
def test_local(): from HeadLocal import HeadLocal InitCamera("local", "dump", StdoutLogger(), HeadLocal()) #ExtractorSet({"Scale": "10"}) print test_camera()
def readDump(fileName): from HeadLocal import HeadLocal InitCamera("local", "dump", StdoutLogger(), HeadLocal()) (width, height, depth, data) = LoadDump(fileName) print(width, height, depth)
app.logger.debug('SHUTDOWN START') 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__": if len(sys.argv) >= 2 and sys.argv[1] == "local": from HeadLocal import HeadLocal g_Head = HeadLocal() #InitCamera("local", "cpp", app.logger) InitCamera("local", "dump", app.logger, g_Head) else: from Head import Head g_Head = Head() #InitCamera("pi", "cpp", app.logger) #InitCamera("pi", "dump", app.logger) InitCamera("pi", "picamera", app.logger, g_Head) g_Commands = Commands(g_Head, app.logger) g_Commands.start() app.run(host='0.0.0.0', port=7778, debug=True)
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)