Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CalibrateDisplayShape Unit Tests #47

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ def downsample_dataset(dir_input: str, dir_output: str) -> None:
# Copy files that don't need downsampling
print('Copying files with no downsampling...')
files = [
"camera_sofast.h5",
"screen_calibration_point_pairs.csv",
"image_projection.h5",
"image_sofast_camera.png",
"point_locations.csv",
]
for file in files:
shutil.copy(join(dir_input, file), join(dir_output, file))
Expand Down Expand Up @@ -70,7 +67,7 @@ def downsample_dataset(dir_input: str, dir_output: str) -> None:
downsample_dataset(
dir_input=join(
opencsp_code_dir(),
'../../sample_data/sofast/data_photogrammetric_calibration/data_measurement',
'../../sample_data/deflectometry/calibration_screen_shape_photogrammetric/data_measurement',
),
dir_output=join(opencsp_code_dir, 'test/data/measurements_sofast_fringe'),
dir_output=join(opencsp_code_dir(), 'app/sofast/test/data/data_measurement'),
)
4 changes: 3 additions & 1 deletion example/sofast_fringe/example_calibration_screen_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def example_run_screen_shape_calibration(save_dir):
corner_ids = pts_marker_data[:, 1]

# Define desired resolution of screen sample grid
resolution_xy = [100, 100]
resolution_xy = [20, 20]

# Define directory where screen shape calibration data is saved
base_dir_sofast_cal = join(opencsp_code_dir(), 'app/sofast/test/data/data_measurement')
Expand All @@ -37,6 +37,7 @@ def example_run_screen_shape_calibration(save_dir):
file_camera_distortion = join(base_dir_sofast_cal, 'camera_screen_shape.h5')
file_image_projection = join(base_dir_sofast_cal, 'image_projection.h5')
files_screen_shape_measurement = glob(join(base_dir_sofast_cal, 'screen_shape_sofast_measurements/pose_*.h5'))
files_screen_shape_measurement.sort()

# Load input data
camera = Camera.load_from_hdf(file_camera_distortion)
Expand All @@ -52,6 +53,7 @@ def example_run_screen_shape_calibration(save_dir):
camera,
image_projection_data,
[MeasurementSofastFringe.load_from_hdf(f) for f in files_screen_shape_measurement],
ray_intersection_threshold=0.1
)

# Perform screen shape calibration
Expand Down
Binary file not shown.
Binary file not shown.
7 changes: 4 additions & 3 deletions opencsp/app/sofast/test/test_CalibrateDisplayShape.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def setUpClass(cls):
dir_output = join(opencsp_code_dir(), 'app/sofast/test/data/data_expected')

# Define input files
resolution_xy = [100, 100] # sample density of screen
resolution_xy = [20, 20] # sample density of screen
file_screen_cal_point_pairs = join(dir_input_sofast, 'screen_calibration_point_pairs.csv')
file_point_locations = join(dir_input_def, 'point_locations.csv')
file_camera_distortion = join(dir_input_sofast, 'camera_screen_shape.h5')
Expand All @@ -61,6 +61,7 @@ def setUpClass(cls):
camera,
image_projection_data,
[Measurement.load_from_hdf(f) for f in files_screen_shape_measurement],
ray_intersection_threshold=0.1
)

# Perform screen position calibration
Expand All @@ -73,11 +74,11 @@ def setUpClass(cls):
# Test screen distortion information
cls.data_exp = load_hdf5_datasets(
['pts_xy_screen_fraction', 'pts_xyz_screen_coords'],
join(dir_output, 'screen_distortion_data_100_100.h5'),
join(dir_output, 'screen_distortion_data_20_20.h5'),
)
cls.data_meas = dist_data

@pytest.mark.no_xvfb
# @pytest.mark.no_xvfb
def test_screen_distortion_data(self):
"""Tests screen calibration data"""
np.testing.assert_allclose(
Expand Down
Loading