/** * A saccade target representing where attention should be directed */ export type SaccadeTarget = { /** * - X coordinate */ x: number; /** * - Y coordinate */ y: number; /** * - Priority (0 = highest) */ priority: number; /** * - Why this target was selected */ reason: string; /** * - Saliency score at this location */ saliency: number; }; /** * Saccadic Controller * * Mimics human eye saccades - rapid movements that redirect foveal attention * to areas of interest. The human eye makes 3-4 saccades per second to * build a complete picture of the visual scene. * * Strategy: * 1. Compute saliency map to find "interesting" regions * 2. Use tracking state to predict where features should be * 3. Generate priority-ordered list of "glance" targets * 4. Limit saccades per frame to balance coverage vs. efficiency */ /** * A saccade target representing where attention should be directed * @typedef {Object} SaccadeTarget * @property {number} x - X coordinate * @property {number} y - Y coordinate * @property {number} priority - Priority (0 = highest) * @property {string} reason - Why this target was selected * @property {number} saliency - Saliency score at this location */ export class SaccadicController { /** * @param {number} width - Image width * @param {number} height - Image height * @param {Object} config - Configuration */ constructor(width: number, height: number, config: Object); width: number; height: number; config: Object; recentTargets: any[]; inhibitionRadius: number; velocityHistory: any[]; lastCenter: { x: number; y: number; }; gridCells: { x: number; y: number; index: number; lastVisit: number; }[]; lastVisitedCell: number; lastSaccadeTime: number; saccadeCount: number; /** * Build a grid for systematic coverage during tracking loss * @private */ private _buildCoverageGrid; /** * Compute saccade targets based on current state * * @param {Object} saliency - Saliency map result * @param {Object} currentFovea - Current fovea center {x, y} * @param {Object} trackingState - Current tracking state (optional) * @returns {SaccadeTarget[]} Priority-ordered list of targets */ computeTargets(saliency: Object, currentFovea: Object, trackingState?: Object): SaccadeTarget[]; /** * Predict center of tracking based on current state and velocity * @private */ private _predictTrackingCenter; /** * Compute average velocity from history * @private */ private _computeAverageVelocity; /** * Check if a location is inhibited (too close to recent targets) * @private */ private _isInhibited; /** * Get next grid cell for systematic search * @private */ private _getNextGridCell; /** * Update history with new targets * @private */ private _updateHistory; /** * Get the most likely location of interest based on history * @returns {Object} {x, y} of predicted location */ getPredictedLocation(): Object; /** * Reset controller state */ reset(): void; /** * Update configuration */ configure(config: any): void; }