Exemplo n.º 1
0
def test_add_countour():
    pytest.sb_params['ax'].cla()
    module = TopoModule(extent=extent)
    sb_params = module.update(pytest.sb_params)
    ax = sb_params['ax']
    fig = sb_params['fig']
    ax.imshow(sb_params.get('frame'), #vmin=sb_params.get('extent')[-2], vmax=sb_params.get('extent')[-1],
              cmap=sb_params.get('cmap'), norm=sb_params.get('norm'), origin='lower')
    fig.show()
    #pytest.sb_params['frame'] = frame
    module.sea = True
    module.sea_contour = True
    sb_params = module.update(pytest.sb_params)
    ax = sb_params['ax']
    fig = sb_params['fig']
    ax.imshow(sb_params.get('frame'), #vmin=sb_params.get('extent')[-2], vmax=sb_params.get('extent')[-1],
              cmap=sb_params.get('cmap'), norm=sb_params.get('norm'), origin='lower')
    fig.show()
    pytest.sb_params['ax'].cla()
    module.sea_contour = False
    #pytest.sb_params['frame'] = frame
    sb_params = module.update(pytest.sb_params)
    ax = sb_params['ax']
    fig = sb_params['fig']
    ax.imshow(sb_params.get('frame'), #vmin=sb_params.get('extent')[-2], vmax=sb_params.get('extent')[-1],
              cmap=sb_params.get('cmap'), norm=sb_params.get('norm'), origin='lower')
    fig.show()
def test_topo_module():
    from sandbox import _calibration_dir, _test_data
    file = np.load(_test_data['topo'] + "DEM1.npz")
    frame = file['arr_0']
    frame = frame + np.abs(frame.min())

    _calibprojector = _calibration_dir + "my_projector_calibration.json"
    _calibsensor = _calibration_dir + "my_sensor_calibration.json"
    from sandbox.sensor import Sensor
    sensor = Sensor(calibsensor=_calibsensor, name="dummy")
    from sandbox.projector import Projector
    projector = Projector(calibprojector=_calibprojector)
    # Initialize the aruco detection
    from sandbox.main_thread import MainThread
    mainT = MainThread(sensor=sensor, projector=projector)
    mainT.load_frame(frame)

    # Start the thread
    #mainT.run()
    from sandbox.modules import TopoModule
    module = TopoModule(extent = extent)
    mainT.add_module(name='Topo', module=module)
    module.sea = True
    module.sea_contour = True
    mainT.update()