import { Canvas } from "ppu-ocv"; import { BaseDocLayoutService } from "../core/base-doclayout.service.js"; import type { DocLayoutOptions, DocLayoutResult, DocLayoutResultWithMasks } from "../interface.js"; /** * Document layout analysis service for Node.js and Bun. * * Analyzes document images to detect layout regions (text, tables, images, etc.) * with bounding boxes in reading order. * * @example * ```ts * const service = new DocLayoutService(); * await service.initialize(); * const result = await service.analyze(imageBuffer); * console.log(result.boxes); * await service.destroy(); * ``` */ export declare class DocLayoutService extends BaseDocLayoutService { constructor(options?: DocLayoutOptions); /** * Fetches a resource from a URL and caches it locally. */ private _fetchAndCache; /** * Loads a resource from a buffer, file path, URL, or default URL. */ private _loadResource; protected initSessions(): Promise; /** * Initializes the service by loading the ONNX model. * Must be called before {@link analyze}. */ initialize(): Promise; /** Checks if the service has been initialized with a model loaded. */ isInitialized(): boolean; /** * Swap the ONNX model at runtime without recreating the service. * * @param model - New model as a file path, URL, or ArrayBuffer. */ changeModel(model: ArrayBuffer | string): Promise; /** * Run layout analysis on an image. * * @param image - Source image as `ArrayBuffer` or `Canvas`. * @returns Layout analysis result with detected regions in reading order. */ analyze(image: ArrayBuffer | Canvas): Promise; /** Delete all locally cached ONNX model files. */ clearModelCache(): void; /** Release the ONNX session and free resources. */ destroy(): Promise; } export default DocLayoutService;