MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / getConversionPreview

Function getConversionPreview

src/utils/cameraModelConversions.ts:213–248  ·  view source on GitHub ↗
(
  camera: Camera,
  targetModelId: CameraModelId,
  threshold: number = DEFAULT_CONVERSION_THRESHOLD
)

Source from the content-addressed store, hash-verified

211 * @returns Preview information or null if conversion is incompatible
212 */
213export function getConversionPreview(
214 camera: Camera,
215 targetModelId: CameraModelId,
216 threshold: number = DEFAULT_CONVERSION_THRESHOLD
217): ConversionPreview | null {
218 const result = convertCameraModel(camera, targetModelId, threshold);
219
220 if (result.type === 'incompatible') {
221 return null;
222 }
223
224 const sourceParamNames = PARAM_NAMES[camera.modelId] ?? [];
225 const targetParamNames = PARAM_NAMES[targetModelId] ?? [];
226
227 const { characterization, isLossy, isExpansion, description } = characterizeCameraModelConversion({
228 fromModel: camera.modelId,
229 toModel: targetModelId,
230 sourceParams: camera.params,
231 targetParams: result.params,
232 resultType: result.type,
233 threshold,
234 aspectRatioThreshold: ASPECT_RATIO_THRESHOLD,
235 });
236
237 return {
238 sourceParamNames,
239 sourceParams: [...camera.params],
240 targetParamNames,
241 targetParams: result.params,
242 characterization,
243 isLossy,
244 isExpansion,
245 description,
246 warning: result.type === 'approximate' ? result.warning : undefined,
247 };
248}

Calls 2

convertCameraModelFunction · 0.85

Tested by

no test coverage detected