Ejemplo n.º 1
0
 def determine_hfd(self, num_samples):
     cam_controller = get_camera_controller()
     samples = []
     for _ in range(num_samples):
         # TODO this is dead - the interface changed
         frame = cam_controller.capture_image('focus', 1.0, 20000)
         numpy_image = frame.get_numpy_image()
         image_greyscale = np.average(numpy_image, axis=2)
         sample = FrameQualityAnalyzer().compute_hfd(image_greyscale)
         samples.append(sample)
     return sum(samples) / num_samples
Ejemplo n.º 2
0
        def run_sequence():
            try:
                cam_controller = get_camera_controller()
                frame_manager = get_frame_manager()

                for frame in cam_controller.capture_sequence(
                        device_name, cam_state):
                    frame_manager.add_frame(frame, persist=cam_state.persist)
                    image_event(device_name, frame.path)
                    log_event(f'New frame: {frame.path}')

            except Exception as e:
                log_event(f'Capture error: {e}')
            finally:
                cam_state.sequence_stop_requested = False
                cam_state.running_sequence = False
                app_state.send_event()
Ejemplo n.º 3
0
        def exp():
            app_state = get_app_state()
            cam_state = app_state.cameras[device_name]
            cam_controller = get_camera_controller()
            frame_manager = get_frame_manager()
            try:
                cam_state.capturing = True
                app_state.send_event()
                frame = cam_controller.capture_image(device_name, cam_state)
                frame_manager.add_frame(frame, persist=cam_state.persist)
                cam_state.capturing = False
                app_state.send_event()

                image_event(device_name, frame.path)
                log_event(f'New frame: {frame.path}')

            except TypeError as e:
                log_event(f'Capture error: {e}')
                cam_state.capturing = False
                app_state.send_event()
Ejemplo n.º 4
0
 def put(self, devicename, property):
     return jsonify(get_camera_controller().set_property(devicename, property, request.json['value']))
Ejemplo n.º 5
0
 def get(self, devicename, property):
     return jsonify(get_camera_controller().property(devicename, property))
Ejemplo n.º 6
0
 def get(self, devicename):
     return jsonify(get_camera_controller().properties(devicename))
Ejemplo n.º 7
0
 def get(self):
     return jsonify(get_camera_controller().devices())
Ejemplo n.º 8
0
from flask import Flask
from flask_cors import CORS

from hti.server.config import Production
from hti.server.client import api_blueprint, client_blueprint
from hti.server.state.globals import get_camera_controller, get_axis_control

from lib.config import INDI_SERVER_COMMAND

app = Flask(__name__)
CORS(app)

config = Production
app.register_blueprint(api_blueprint)
app.register_blueprint(client_blueprint)
app.config.from_object(config)
app.secret_key = app.config['FLASK_SECRET_KEY']

subprocess.Popen(INDI_SERVER_COMMAND)

get_camera_controller()
get_axis_control()

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    args = parser.parse_args()
    app.run(host=app.config['FLASK_HOST'],
            port=app.config['FLASK_PORT'],
            debug=app.config['FLASK_DEBUG'])