Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a786f89
First pytest
crmauceri Apr 15, 2025
e4f25e2
Convert regression tests to pytests
crmauceri Apr 15, 2025
c593677
Convert unit test notebook to pytests
crmauceri Apr 16, 2025
5b911f4
Use landmark tools package
crmauceri Apr 16, 2025
38b1e22
Checkout submodules in workflow. Add missing gold standard data.
crmauceri Apr 16, 2025
1e216b9
SURF is not free. Remove.
crmauceri Apr 16, 2025
736ad12
Remove compiler warnings
crmauceri Apr 17, 2025
855bb13
Use tmp_path fixture for pytest output
crmauceri Apr 17, 2025
fd7d20e
Add lfs to pytest workflow
crmauceri Apr 17, 2025
c5db321
Cache lfs files between runs
crmauceri Apr 17, 2025
74f528a
Make relative paths absolute and remove debug png file writing
crmauceri Apr 17, 2025
5a32dd6
Debug why files not available to github runner
crmauceri Apr 17, 2025
1a01d33
Track .tif files in LFS
crmauceri Apr 17, 2025
6265269
Remove debug step
crmauceri Apr 17, 2025
7ff339f
Edge cases for interpolation along edge of raster
crmauceri Apr 21, 2025
d736b6c
Update polar stereo regression test data to use iterative refinement …
crmauceri Apr 21, 2025
3d5d610
Use floating point interpolation for regression data instead of trunc…
crmauceri Apr 21, 2025
e8b7b4d
Add legacy save
crmauceri Apr 23, 2025
587cf89
Clean up landmark_comparison_main and associated src files
crmauceri Apr 23, 2025
f3d3b30
Clean up image_comparison and associated files
crmauceri Apr 24, 2025
a946212
Fixed crop method
crmauceri Apr 24, 2025
9d222e1
Add gtest framework.
crmauceri Apr 24, 2025
ec82721
Add a regression test for image_comparison
crmauceri Apr 24, 2025
91535e2
Merge branch 'cursor_test' into dev/pytests
crmauceri Apr 24, 2025
b0ecc67
Working image_comparison tests.
crmauceri Apr 24, 2025
86f35aa
Add macro for safer string printing
crmauceri Apr 25, 2025
896c4c3
I think snprintf and the format string length limiters are redundant.
crmauceri Apr 25, 2025
ed88b3c
Missing include
crmauceri Apr 25, 2025
5ec62af
Print statement removed
crmauceri Apr 25, 2025
268ef31
More string validation
crmauceri Apr 25, 2025
4fa6067
Working landmark_2_point and point_2_landmark test
crmauceri Apr 26, 2025
f6f06a1
NAN initialize results.
crmauceri Apr 28, 2025
7ac5ee7
Updated landmark_comparison regression. All tests should pass
crmauceri Apr 28, 2025
19e3359
Change from MAXFLOAT to FLT_MAX
crmauceri Apr 28, 2025
0d83b6e
Align legacy landmark writer with Yang's code
crmauceri May 14, 2025
1e020a4
Add lunar lambertian shader
crmauceri May 14, 2025
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
tests/unit_test_data/final_3d_points.txt filter=lfs diff=lfs merge=lfs -text
tests/gold_standard_data/final_3d_points.txt filter=lfs diff=lfs merge=lfs -text
tests/gold_standard_data filter=lfs diff=lfs merge=lfs -text
*.tif filter=lfs diff=lfs merge=lfs -text
74 changes: 74 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build C code and run tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
lfs: false

- name: Restore LFS cache
uses: actions/cache@v3
with:
path: .git/lfs
key: lfs-${{ runner.os }}-${{ github.sha }}
restore-keys: |
lfs-${{ runner.os }}-

- name: Fetch only needed LFS files
run: |
git lfs install
git lfs fetch --include="tests/gold_standard_data/**"
git lfs checkout

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libpng-dev \
libyaml-dev \
libgsl-dev \
libgdal-dev \
libopencv-dev \
cmake \
build-essential \
python3-dev

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
cd scripts/python
pip install -e .

- name: Configure and build C code
run: |
mkdir -p build
cd build
cmake -DWITH_OPENCV=ON ..
make -j$(nproc)

- name: Run pytest tests
run: |
pytest --maxfail=3 --tb=short

- name: Run gtest tests
run: |
ctest --output-on-failure

54 changes: 37 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
cmake_minimum_required(VERSION 3.16)
project(landmark_tools)

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(STATUS "Configuring on/for Linux")
# Enable testing
enable_testing()
include(CTest)

if(UNIX AND NOT APPLE)
message(STATUS "Configuring for Linux-like system")
add_definitions(-DLINUX_OS)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
message(STATUS "Configuring on/for Windows")
add_definitions(-DWINDOWS_OS)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# Darwin is the system name for macOS
message(STATUS "Configuring on/for macOS")
elseif(APPLE)
message(STATUS "Configuring for macOS")
add_definitions(-DMAC_OS)
elseif(WIN32)
message(STATUS "Configuring for Windows")
add_definitions(-DWINDOWS_OS)
endif()


# Add local CMake modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")

Expand Down Expand Up @@ -84,6 +88,7 @@ src/landmark_tools/math/point_line_plane_util.c
src/landmark_tools/utils/parse_args.c
src/landmark_tools/utils/endian_read_write.c
src/math/mat3/mat3.c
src/landmark_tools/utils/write_array.c
)

add_executable( create_landmark
Expand Down Expand Up @@ -123,6 +128,7 @@ src/landmark_tools/landmark_util/estimate_homography.c
src/landmark_tools/feature_tracking/feature_match.c
src/landmark_tools/feature_tracking/corr_image_long.c
src/landmark_tools/feature_tracking/parameters.c
src/landmark_tools/feature_tracking/correlation_results.c
src/landmark_tools/math/homography_util.c
src/landmark_tools/utils/two_level_yaml_parser.c
)
Expand All @@ -131,6 +137,7 @@ add_dependencies(landmark_comparison link_public_headers)
add_executable( landmark_registration
src/main/landmark_registration_main.c
${common_sources}
src/landmark_tools/landmark_registration/landmark_registration.c
src/landmark_tools/landmark_util/estimate_homography.c
src/landmark_tools/feature_selection/int_forstner_extended.c
src/landmark_tools/feature_tracking/corr_image_long.c
Expand Down Expand Up @@ -204,6 +211,7 @@ if (WITH_OPENCV)
add_library(landmark_tools_opencv_tools
src/landmark_tools/opencv_tools/opencv_feature_matching.cpp
src/landmark_tools/opencv_tools/opencv_image_io.cpp
src/landmark_tools/opencv_tools/homography_estimation.c
)
target_compile_features(landmark_tools_opencv_tools PUBLIC cxx_std_11)
target_include_directories(landmark_tools_opencv_tools PRIVATE ${OpenCV_INCLUDE_DIRS})
Expand All @@ -213,9 +221,14 @@ if (WITH_OPENCV)
add_executable(image_comparison
src/main/image_comparison_main.c
${common_sources}
src/landmark_tools/landmark_util/estimate_homography.c
src/landmark_tools/feature_tracking/feature_match.c
src/landmark_tools/feature_tracking/corr_image_long.c
src/landmark_tools/feature_tracking/parameters.c
src/landmark_tools/opencv_tools/opencv_feature_matching.cpp
src/landmark_tools/opencv_tools/homography_estimation.c
src/landmark_tools/opencv_tools/feature_matching_2d.c
src/landmark_tools/feature_tracking/correlation_results.c
src/landmark_tools/math/homography_util.c
src/landmark_tools/utils/two_level_yaml_parser.c
)
Expand All @@ -232,28 +245,35 @@ file(GLOB_RECURSE library_sources
"${CMAKE_CURRENT_SOURCE_DIR}/src/math/*.c"
"${CMAKE_CURRENT_SOURCE_DIR}/src/img/*.c")

## Shared library
# Remove cpp files
list(REMOVE_ITEM library_sources
"${CMAKE_CURRENT_SOURCE_DIR}/src/landmark_tools/opencv_tools/homography_estimation.c"
"${CMAKE_CURRENT_SOURCE_DIR}/src/landmark_tools/opencv_tools/feature_matching_2d.c"
)

add_library(landmark_tools
SHARED
${library_sources}
${CMAKE_CURRENT_SOURCE_DIR}/submodules/librply/src/lib/rply.c
# Build the landmark_tools library first
add_library(landmark_tools SHARED
${library_sources}
${CMAKE_CURRENT_SOURCE_DIR}/submodules/librply/src/lib/rply.c
)

target_include_directories(landmark_tools PUBLIC
${PNG_INCLUDE_DIRS})

target_include_directories(landmark_tools INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> # During build
$<INSTALL_INTERFACE:include> # During installation
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

if(GDAL_FOUND)
target_link_libraries( landmark_tools PUBLIC GDAL::GDAL ${yaml_LIBRARIES} ${PNG_LIBRARIES} ${GSL_LIBRARIES} m -lz)
target_link_libraries(landmark_tools PUBLIC GDAL::GDAL ${yaml_LIBRARIES} ${PNG_LIBRARIES} ${GSL_LIBRARIES} m -lz)
else()
target_link_libraries( landmark_tools PUBLIC ${yaml_LIBRARIES} ${PNG_LIBRARIES} ${GSL_LIBRARIES} m -lz)
target_link_libraries(landmark_tools PUBLIC ${yaml_LIBRARIES} ${PNG_LIBRARIES} ${GSL_LIBRARIES} m -lz)
endif()

# Then add the tests
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests/cpp)

install(TARGETS landmark_tools EXPORT LandmarkTools
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "d236b7d9-0991-4e00-b27d-f60671cbaefc",
"metadata": {},
"source": [
"# Distortion Impact\n",
"\n",
"Recreate the analysis from \n",
"\n",
"Cecilia Mauceri, Yang Cheng, Yumi Iwashita and Adnan Ansar. \"A Validation Pipeline for Lunar Digital Elevation Models,\" AIAA 2025-2072. AIAA SCITECH 2025 Forum. January 2025. [link](https://arc.aiaa.org/doi/abs/10.2514/6.2025-2072)\n",
"\n",
"This script artificially distorts DEMs to create map distortion with known parameters and then demonstrates how the correlator can detect this distortion.\n",
"\n",
"## Setup"
]
},
{
"cell_type": "code",
"execution_count": 1,
Expand Down Expand Up @@ -45,6 +61,14 @@
"plt.rcParams['figure.figsize'] = [10, 3]"
]
},
{
"cell_type": "markdown",
"id": "09cbfc1c-cb87-4d87-8eed-95db43566dff",
"metadata": {},
"source": [
"## Render DEM for visual comparison"
]
},
{
"cell_type": "code",
"execution_count": 3,
Expand Down Expand Up @@ -231,7 +255,7 @@
"source": [
"## Self-compare\n",
"\n",
"Landmark compared to itself should have near zero deltas"
"Landmark compared to itself without distortion should have near zero deltas"
]
},
{
Expand Down
Loading