File tree 1 file changed +18
-8
lines changed
1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -140,16 +140,26 @@ base64ToMat(data: string): Mat;
140
140
### Mat to Buffer
141
141
Convert Mat object to Uint8Array or Float32Array based on value of parameter and returns with number of cols, rows and channels.
142
142
143
- ``` js
144
- matToBuffer (
143
+ ``` ts
144
+ matToBuffer < T extends keyof BufferType > (
145
145
mat : Mat ,
146
- type: ' uint8'
147
- ): { cols: number; rows: number; channels: number; buffer: Uint8Array };
146
+ type : T
147
+ ): { cols: number ; rows : number ; channels : number ; buffer : BufferType [T ] };
148
+ ```
148
149
149
- matToBuffer (
150
- mat: Mat,
151
- type: ' float32'
152
- ): { cols: number; rows: number; channels: number; buffer: Float32Array };
150
+ where ` BufferType ` is:
151
+
152
+ ``` ts
153
+ type BufferType = {
154
+ uint8: Uint8Array ;
155
+ uint16: Uint16Array ;
156
+ uint32: Uint32Array ;
157
+ int8: Int8Array ;
158
+ int16: Int16Array ;
159
+ int32: Int32Array ;
160
+ float32: Float32Array ;
161
+ float64: Float64Array ;
162
+ };
153
163
```
154
164
155
165
## Functions
You can’t perform that action at this time.
0 commit comments