@react-opencv/fiber 0.1.1 → 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 +33 -4
- package/dist/components/OpenCvProvider.d.ts +8 -0
- package/dist/data/opencv-signatures.json +15313 -0
- package/dist/fiber/executePipeline.d.ts +2 -2
- package/dist/fiber/matDebug.d.ts +2 -0
- package/dist/fiber/types.d.ts +26 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +643 -593
- package/dist/types.d.ts +9 -0
- package/package.json +23 -3
- package/dist/components/OpenCVProvider.d.ts +0 -5
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# react-opencv-fiber
|
|
2
2
|
|
|
3
|
+
[](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
|
-
##
|
|
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
|
-
|
|
131
|
+
To run locally:
|
|
103
132
|
|
|
104
133
|
```sh
|
|
105
134
|
npm install
|
|
106
|
-
|
|
107
|
-
npm
|
|
135
|
+
npm run build
|
|
136
|
+
cd examples && npm install && npx vite
|
|
108
137
|
```
|
|
109
138
|
|
|
110
139
|
## Acknowledgements
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CvDebugConfig, OpenCVContextValue } from "../types";
|
|
2
|
+
export declare function useOpenCv(): OpenCVContextValue;
|
|
3
|
+
export declare const OpenCvProvider: ({ openCvVersion, openCvPath, debug, children, }: {
|
|
4
|
+
openCvVersion?: string;
|
|
5
|
+
openCvPath?: string;
|
|
6
|
+
debug?: CvDebugConfig;
|
|
7
|
+
children: any;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|