def start_main_thread(self, kwargs_contourlines: dict = {}, kwargs_cmap: dict = {}): from sandbox.main_thread import MainThread thread = MainThread(sensor=self.sensor, projector=self.projector, aruco=self.aruco, kwargs_contourlines=kwargs_contourlines, kwargs_cmap=kwargs_cmap) thread._modules = self.Modules thread.run() return thread
def start_main_thread(self, **kwargs): from sandbox.main_thread import MainThread thread = MainThread(sensor=self.sensor, projector=self.projector, aruco=self.aruco, **kwargs) thread._modules = self.Modules thread.run() return thread
def test_thread_functions(): smain = MainThread(sensor, projector) smain.run() print('run() working') smain.pause() print('pause() working') smain.resume() print('resume() working') smain.stop() print('stop() working')
def test_thread_module(): from sandbox.modules import TopoModule, GradientModule proj = Projector(use_panel=True) sens = Sensor(name='kinect_v2', invert=True) smain = MainThread(sens, proj) topo = TopoModule(extent=sens.extent) grad = GradientModule(extent=sens.extent) smain.modules = [topo] smain.run()
def test_with_gempy(): 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.gempy import GemPyModule gpsb = GemPyModule(geo_model=None, extent=sensor.extent, box=sensor.physical_dimensions, load_examples=True, name_example=['Fault']) mainT.add_module(name='gempy', module=gpsb) mainT.update()
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()
def test_bug_no_dpi_no_aruco(): #import matplotlib.text from sandbox import _calibration_dir _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, use_panel = False) # Initialize the aruco detection from sandbox.main_thread import MainThread main = MainThread(sensor=sensor, projector=projector) # Start the thread main.update() projector.trigger()
def test_bug_no_dpi(): from sandbox import _calibration_dir _calibprojector = _calibration_dir + "my_projector_calibration.json" _calibsensor = _calibration_dir + "my_sensor_calibration.json" from sandbox.sensor import Sensor sensor = Sensor(calibsensor=_calibsensor, name="kinect_v2") from sandbox.projector import Projector projector = Projector(calibprojector=_calibprojector) # Initialize the aruco detection from sandbox.markers import MarkerDetection aruco = MarkerDetection(sensor=sensor) from sandbox.main_thread import MainThread main = MainThread(sensor=sensor, projector=projector, aruco=aruco) # Start the thread main.run()
def test_thread_kinectv2(): from sandbox import _calibration_dir from sandbox.markers import MarkerDetection projector_2 = Projector(use_panel=True) sensor_2 = Sensor(name='kinect_v2', calibsensor=_calibration_dir+'my_sensor_calibration.json') aruco = MarkerDetection(sensor=sensor_2) smain = MainThread(sensor_2, projector_2, aruco) smain.sb_params['active_contours'] = True smain.sb_params['active_cmap'] = True smain.run()
def test_run(): #TODO: runs but does not show contour lines projector_2 = Projector(use_panel=True) sensor_2 = Sensor(name='dummy') smain = MainThread(sensor_2, projector_2) smain.run()
def test_update(): projector_2 = Projector(use_panel=True) sensor_2 = Sensor(name='dummy') smain = MainThread(sensor_2, projector_2) smain.update()
def test_init(): smain = MainThread(sensor, projector) print(smain)