import { type DetectionMask, type Point, type Rect, type TopLeftRect } from "#types/detections"; export declare enum DetectionMaskPayloadFormat { RawCocoRle = "rawCocoRle", DeflatedBase64 = "deflatedBase64" } /** Host adapter for the editor's optional pako + base64 transport format. */ export interface DetectionMaskCompressionCodec { deflate(value: string): string; inflate(value: string): string; } export type MaskRectRun = TopLeftRect; export interface EncodedBinaryMask { readonly bounds: Rect | null; readonly mask: DetectionMask; } export declare function encodeBinaryMask(data: Uint8Array, width: number, height: number): DetectionMask; /** Encodes a binary mask and derives its bounds in the same raster traversal. */ export declare function encodeBinaryMaskWithBounds(data: Uint8Array, width: number, height: number): EncodedBinaryMask; export declare function encodeDetectionMaskPayload(mask: DetectionMask, codec?: DetectionMaskCompressionCodec): string; export declare function decodeDetectionMaskPayload(payload: string, width: number, height: number, options?: { readonly codec?: DetectionMaskCompressionCodec; readonly format?: DetectionMaskPayloadFormat; }): DetectionMask; /** Matches the annotation editor's legacy transport-format heuristic. */ export declare function isDeflatedBase64DetectionMaskPayload(value: string): boolean; export declare function computeMaskBounds(data: Uint8Array, width: number, height: number): Rect | null; export declare function computeDetectionMaskRect(mask: DetectionMask): Rect | undefined; export declare function detectMaskBorders(data: Uint8Array, width: number, height: number): Uint8Array; export declare function extractMaskContour(data: Uint8Array, width: number, height: number): readonly Point[] | undefined; export declare function extractMaskRectRuns(data: Uint8Array, width: number, height: number): readonly MaskRectRun[] | undefined; /** * The rect runs of a compressed-RLE mask, without holding the mask's raster. * * A mask is the size of the whole frame, so reading a silhouette that covers a * fraction of one percent of it otherwise costs a megabytes-wide allocation and * a pass over every pixel. The counts carry the occupied box, so the raster and * the pass are that box. */ export declare function extractDetectionMaskRectRuns(mask: DetectionMask): readonly MaskRectRun[] | undefined; //# sourceMappingURL=detection-masks.d.ts.map