import type { NormalizedPhoto } from '../providers/model'; import { type LngLat } from '../viewpoints/geometry'; /** * Which image shows a target (a traffic sign, a traffic light, a junction) best, and where the * target is in it. From the iD Radnetz fork (feature 26), generalized from signs to any target. * Pure; image positions are Mapillary JS "basic" coordinates (`[0, 0]` top left, `[1, 1]` bottom * right; for 360° images the whole panorama). */ export type TargetImage = { id: string; /** Mapillary's computed position (used for the view math; map features are located from it). */ lngLat: LngLat; /** The camera's GPS position, where image markers are usually drawn. */ originalLngLat?: LngLat | null; /** Capture time in ms. */ capturedAt: number; isPano: boolean; username?: string | null; /** The target's outline in this image, if Mapillary detected it there. */ outline?: [number, number][]; }; export type TargetImageDay = { /** `YYYY-MM-DD` (UTC). */ day: string; images: TargetImage[]; /** The day's image that shows the target best (`compareTargetImages`). */ best: TargetImage; }; export type ViewTarget = { center: [number, number]; zoom: number; }; export type TargetShape = { /** Width of the target in meters; decides the zoom. */ widthMeters: number; /** Height of the target's center above the camera in meters (negative: below, e.g. markings). */ aboveCameraMeters: number; /** Images about this far away show the target best. */ goodDistanceMeters: number; maxZoom: number; }; /** A traffic sign: 65 cm wide, slightly above a 360° camera, best seen from ~10 m. */ export declare const SIGN_TARGET: TargetShape; /** A junction or another place on the ground: wide, below the camera, best seen from ~20 m. */ export declare const PLACE_TARGET: TargetShape; /** * Better images first: those where Mapillary outlined the target (the view can be aimed exactly), * then those nearest to the good distance (an image right below a sign does not show it). */ export declare const compareTargetImages: (a: TargetImage, b: TargetImage, target: LngLat, shape?: TargetShape) => number; /** The images grouped by capture day, newest day first, each day's images best first. */ export declare const targetImagesByDay: (images: readonly TargetImage[], target: LngLat, shape?: TargetShape) => TargetImageDay[]; /** * The image to show first: the newest day's best image; from `minCapturedAt` on if any image is * that recent, else from all. */ export declare const bestTargetImage: (images: readonly TargetImage[], target: LngLat, { shape, minCapturedAt }?: { shape?: TargetShape; minCapturedAt?: number; }) => TargetImage | undefined; /** View on the target from its outline in the image. */ export declare const viewFromOutline: (outline: readonly [number, number][], isPano: boolean, maxZoom?: number) => ViewTarget | undefined; /** * Horizontal position of a compass bearing in a 360° image whose center looks along * `compassAngle` (a rough estimate; the viewer's own projection is more exact). */ export declare const panoX: (bearing: number, compassAngle: number) => number; /** * View on the target in a 360° image: `x` is the target's horizontal position (from the viewer's * projection, or `panoX`); height and zoom come from the distance. */ export declare const viewFromLocation: (x: number, image: Pick, target: LngLat, shape?: TargetShape) => ViewTarget; /** A flat (perspective) camera as Mapillary describes it. */ export type FlatCamera = { /** Focal length relative to the larger image side. */ focal: number; width: number; height: number; /** Compass direction the camera looks at. */ compassAngle: number; /** Degrees, negative = looking down. */ pitch: number; }; /** * View on the target in a flat image (pinhole model, without lens distortion); `undefined` when * the target is outside the image. The zoom stays moderate because locations are a few meters off. */ export declare const viewFromFlatCamera: (camera: FlatCamera, imageLngLat: LngLat, target: LngLat, shape?: TargetShape) => ViewTarget | undefined; /** * Pitch in degrees of a camera from Mapillary's rotation (axis-angle, world to camera; world z is * up, the camera looks along its z axis). */ export declare const cameraPitch: (rotation: readonly number[]) => number; /** The Mapillary photo of a target image, for the viewer and the map's photo selection. */ export declare const targetImageToPhoto: (image: TargetImage) => NormalizedPhoto;