MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / getImagesDirScore

Function getImagesDirScore

src/utils/colmapPathResolver.ts:168–189  ·  view source on GitHub ↗

* Prefer directories canonically named `images`, and among those the one * nearest the COLMAP model directory (images may sit beside the bins). Falls * back to the directory holding the most images for non-conventional layouts.

(dir: string, modelDir?: string)

Source from the content-addressed store, hash-verified

166 * back to the directory holding the most images for non-conventional layouts.
167 */
168function getImagesDirScore(dir: string, modelDir?: string): number {
169 let score = 0;
170 if (isImagesNamedDir(dir)) {
171 score += 1000;
172 }
173 if (modelDir !== undefined) {
174 const parent = getParentDir(dir);
175 if (dir === modelDir) {
176 score += 200; // images sit in the same directory as the bins
177 } else if (parent === modelDir) {
178 score += 300; // an images/ directory directly under the model dir
179 } else if (modelDir !== '' && dir.startsWith(`${modelDir}/`)) {
180 score += 250; // nested somewhere under the model dir
181 } else {
182 const modelParent = getParentDir(modelDir);
183 if (modelParent !== '' && (dir === modelParent || dir.startsWith(`${modelParent}/`))) {
184 score += 150; // a sibling subtree of the model dir (e.g. corrected/images vs colmap/)
185 }
186 }
187 }
188 return score;
189}
190
191export interface ResolveImagesDirOptions {
192 /** Directory of the COLMAP model, used to prefer a nearby images directory. */

Callers 1

resolveImagesDirFunction · 0.85

Calls 2

isImagesNamedDirFunction · 0.85
getParentDirFunction · 0.85

Tested by

no test coverage detected