romaine
Version:
React OpenCV Manipulation and Image Narration & Editing
30 lines • 1.21 kB
TypeScript
import { ImagePtr, OpenCV } from "../../types";
export interface BrushStrokeData {
points: Array<{
x: number;
y: number;
}>;
mode: "fg" | "bg";
brushRadius: number;
}
export declare const clearGrabCutState: () => void;
export declare const hasGrabCutMask: () => boolean;
export declare const getGrabCutScaleFactor: () => number;
export declare const getGrabCutDims: () => {
w: number;
h: number;
};
export declare const setLastAppliedStrokes: (s: BrushStrokeData[]) => void;
export declare const getLastAppliedStrokes: () => BrushStrokeData[];
/**
* Remove the background from an image using OpenCV's GrabCut algorithm.
* Stores the GrabCut mask for subsequent refinement via refineBackground().
*/
export declare const removeBackground: (cv: OpenCV, canvas: HTMLCanvasElement, src: ImagePtr) => void;
/**
* Refine the background removal using user-supplied brush strokes.
* Strokes mark pixels as definite foreground or background, then
* GrabCut re-runs with GC_INIT_WITH_MASK.
*/
export declare const refineBackground: (cv: OpenCV, canvas: HTMLCanvasElement, src: ImagePtr, strokes: BrushStrokeData[]) => void;
//# sourceMappingURL=removeBackground.d.ts.map