Improving Uniformity of Vertex Distributions in Spherical Sampling of Metamer Mismatch Body Boundaries
This repository contains the MATLAB implementation for the "pool-and-subset" algorithm described in the paper Improving Uniformity of Vertex Distributions in Spherical Sampling of Metamer Mismatch Body Boundaries.
Standard spherical sampling methods for computing Metamer Mismatch Body (MMB) boundaries often produce non-uniform vertex distributions, with significant clustering and sparse regions. Increasing the sampling density (
This project implements Algorithm 1 from the paper, a post-processing workflow that improves uniformity while preserving geometric fidelity:
-
Pool: Aggregates vertices from multiple independent spherical sampling runs to create a dense candidate set (
$V_{pool}$ ). - Identify Extremes: Identifies boundary-critical vertices (anchors) by maximizing support functions along quasi-uniform directions. These are force-included to preserve the hull geometry.
-
Subset: Fills the remaining vertex budget (
$N_{target}$ ) using Seeded Farthest Point Sampling (FPS), initialized from the retained extremes.
This approach substantially reduces the coefficient of variation (CV) of nearest-neighbor distances compared to baseline sampling, as shown in the figure above.
- MATLAB R2022a or later
- Statistics and Machine Learning Toolbox (for
pdist2) - Optimization Toolbox (for
linprog)
Tip: Click the "Open in MATLAB Online" badge above to run this project directly in your browser. This will automatically load the project and set up the path.
or
- Clone with submodules:
git clone --recursive https://github.com/sfu-cs-vision-lab/uniform-spherical-sampling.git
-
Open the project in MATLAB:
Opening the project will automatically set up the source paths.
openProject("uniform-spherical-sampling.prj")- Run the getting started example:
GettingStartedThe examples/GettingStarted.m file is saved in the Plain Text Live Script format (introduced in MATLAB R2025a).
- MATLAB R2025a+: The file will open automatically in the Live Editor with formatted text, equations, and inline output.
- Older Versions: The file will open as a standard
.mscript. It is fully executable, but the formatting (headers, descriptions) will appear as raw comments (e.g.,%[text]).
Generate uniform vertices using the method described in the paper (Algorithm 1).
data = loadMMBTestData();
[V, info] = poolSubsetMMB(data.mech1, data.mech2, data.z0, TargetN=1000, Scale=data.yNormScale);
Generate baseline vertices (single spherical sampling run) as described in the paper. Requires the reference interior point (intPoint) for the duality transform.
data = loadMMBTestData();
V_base = generateMMBVertices(data.sensors, data.nullEqCon, data.x0, data.intPoint, NumNormals=1e5, Scale=data.yNormScale);See examples/GettingStarted.m for a complete working example with visualization.
The paperFigures/ directory contains scripts to regenerate all figures and tables from the paper:
cd paperFigures
generateAll % Runs all figure and table generation scripts
Individual scripts:
generateFigure1.m- Convex hull visualizationgenerateFigure2.m- Single-run vertex distributiongenerateFigure3.m- Run-to-run variabilitygenerateFigure4.m- CV comparison swarm plotsgenerateFigure5.m- Baseline vs pool+subset comparisongenerateTable1.m- Baseline sweep resultsgenerateTable2.m- Pool+subset results
Outputs are saved to paperFigures/output/.
uniform-spherical-sampling/
├── src/ # Core algorithm implementation
│ ├── poolSubsetMMB.m
│ ├── generateMMBVertices.m
│ ├── seededFPS.m
│ ├── identifyExtremeVertices.m
│ └── computeNNStats.m
├── paperFigures/ # Paper figure/table generation
│ ├── generateFigure*.m
│ ├── generateTable*.m
│ ├── generateAll.m
│ └── utils/ # Shared plotting utilities
├── tests/ # Unit tests
├── examples/ # Usage examples
│ └── GettingStarted.m
├── buildUtilities/ # Build task helpers (badge generation)
├── reports/ # Generated test/coverage reports
├── resources/ # MATLAB Project configuration files
└── lib/ # External dependencies (submodules)
If you use this code in your research, please cite:
@inproceedings{Forsythe2026,
author = {Forsythe, Alexander G. and Funt, Brian},
title = {Improving Uniformity of Vertex Distributions in Spherical Sampling of Metamer Mismatch Body Boundaries},
booktitle = {Proceedings of the IS\&T Electronic Imaging Symposium (EI 2026)},
year = {2026},
note = {In Press}
}This algorithm makes use of the algorithm described in
@article{mackiewicz2018spherical,
title={Spherical sampling methods for the calculation of metamer mismatch volumes},
author={Mackiewicz, Michal and Rivertz, Hans Jakob and Finlayson, Graham},
journal={Journal of the Optical Society of America A},
volume={36},
number={1},
pages={96--104},
year={2018},
publisher={Optical Society of America}
}This code is provided under the AGPL v3 License terms specified in the LICENSE file
Copyright 2026 Alexander Forsythe and Brian Funt, Simon Fraser University.
