@react-opencv/fiber 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # react-opencv-fiber
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/@react-opencv/fiber.svg)](https://www.npmjs.com/package/@react-opencv/fiber)
4
+
3
5
  A React renderer for OpenCV.js. Write image-processing pipelines as JSX — each element maps to an OpenCV operation, and the tree executes bottom-up through a custom React reconciler.
4
6
 
5
7
  [**Live demo**](https://erasta.github.io/react-opencv-fiber/)
@@ -89,6 +91,19 @@ Operations are nested inside-out — the innermost element runs first:
89
91
 
90
92
  Props map directly to OpenCV function parameters. Array values are coerced to the appropriate OpenCV types (`Size`, `Point`, `Scalar`).
91
93
 
94
+ #### `__srcParam` / `__dstParam`
95
+
96
+ By default, each operation is called as `cv.op(src, dst, ...params)` — matching the OpenCV.js convention of `src` at position 0 and `dst` at position 1. Some functions use a different argument order. Use `__srcParam` and `__dstParam` to override the position:
97
+
98
+ ```tsx
99
+ {/* applyColorMap expects cv.applyColorMap(src, colormap, dst) */}
100
+ <cvApplyColorMap colormap={2} __dstParam={2}>
101
+ <cvCvtColor code={11}>
102
+ <cvImage src="photo.jpg" />
103
+ </cvCvtColor>
104
+ </cvApplyColorMap>
105
+ ```
106
+
92
107
  ### `<cvImage>`
93
108
 
94
109
  Special element that loads an image (URL or data URI) into a `Mat`.
@@ -97,14 +112,28 @@ Special element that loads an image (URL or data URI) into a `Mat`.
97
112
  <cvImage src="https://example.com/photo.jpg" />
98
113
  ```
99
114
 
100
- ## Demo
115
+ ## Examples
116
+
117
+ The `examples/` directory contains interactive demos with different filter combinations. [**Live demo**](https://erasta.github.io/react-opencv-fiber/)
118
+
119
+ <p>
120
+ <img src="gifs/canny-gaussian.gif" width="400" />
121
+ <img src="gifs/adaptive-threshold-blur.gif" width="400" />
122
+ </p>
123
+ <p>
124
+ <img src="gifs/edge-preserving-canny.gif" width="400" />
125
+ <img src="gifs/laplacian-blur.gif" width="400" />
126
+ </p>
127
+ <p>
128
+ <img src="gifs/median-equalize.gif" width="400" />
129
+ </p>
101
130
 
102
- The `demo/` directory contains a small app with a slider-driven pipeline (blur + grayscale + Canny edge detection). To run it:
131
+ To run locally:
103
132
 
104
133
  ```sh
105
134
  npm install
106
- cd demo && npm install
107
- npm run dev
135
+ npm run build
136
+ cd examples && npm install && npx vite
108
137
  ```
109
138
 
110
139
  ## Acknowledgements
@@ -1,8 +1,8 @@
1
- import type { OpenCVContextValue } from "../types";
1
+ import type { CvDebugConfig, OpenCVContextValue } from "../types";
2
2
  export declare function useOpenCv(): OpenCVContextValue;
3
- export declare const OpenCvProvider: ({ openCvVersion, openCvPath, verbose, children, }: {
3
+ export declare const OpenCvProvider: ({ openCvVersion, openCvPath, debug, children, }: {
4
4
  openCvVersion?: string;
5
5
  openCvPath?: string;
6
- verbose?: boolean;
6
+ debug?: CvDebugConfig;
7
7
  children: any;
8
8
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,3 @@
1
- import type { CV, Mat } from "../types";
1
+ import type { CV, Mat, CvDebugConfig } from "../types";
2
2
  import { CvNode } from "./CvNode";
3
- export declare function executePipeline(cv: CV, node: CvNode): Promise<Mat | null>;
3
+ export declare function executePipeline(cv: CV, node: CvNode, missingOps?: Set<string>, debug?: CvDebugConfig): Promise<Mat | null>;
@@ -0,0 +1,2 @@
1
+ import type { Mat } from "../types";
2
+ export declare const descMat: (m: Mat) => string;
package/dist/index.d.ts CHANGED
@@ -3,4 +3,4 @@ export { CvCanvas } from "./fiber/CvCanvas";
3
3
  export type { CvCanvasProps } from "./fiber/CvCanvas";
4
4
  export type { CvOpProps } from "./fiber/types";
5
5
  import "./fiber/types";
6
- export type { CV, Mat, OpenCVContextValue, ParamConfig, SignatureParam, SignatureOverload, SignatureEntry, } from "./types";
6
+ export type { CV, Mat, CvDebugConfig, OpenCVContextValue, ParamConfig, SignatureParam, SignatureOverload, SignatureEntry, } from "./types";