UNPKG

sobel-ts

Version:

TypeScript implementation of Sobel edge detection algorithm for image processing

41 lines (40 loc) 1.23 kB
/** * Defines a type for the supported output formats of the Sobel operator. */ export type OutputFormat = 'magnitude' | 'x' | 'y' | 'direction'; /** * Defines the supported kernel sizes for the Sobel operator. */ export type KernelSize = 3 | 5; /** * Platform-agnostic interface for image data * Compatible with both browser's ImageData and Node.js buffers */ export interface ImageDataLike { width: number; height: number; data: Uint8ClampedArray; colorSpace?: string; } /** * Factory interface for creating ImageData objects */ export interface ImageDataFactory { create(data: Uint8ClampedArray, width: number, height: number): ImageDataLike; } /** * Browser-specific ImageData factory */ export declare class BrowserImageDataFactory implements ImageDataFactory { create(data: Uint8ClampedArray, width: number, height: number): ImageDataLike; } /** * Node.js-specific ImageData factory */ export declare class NodeImageDataFactory implements ImageDataFactory { create(data: Uint8ClampedArray, width: number, height: number): ImageDataLike; } /** * Get the appropriate ImageData factory for the current environment */ export declare function getImageDataFactory(): ImageDataFactory;