Skip to content

Commit d990398

Browse files
feat: clone function
1 parent 2d0a009 commit d990398

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

cpp/FOCV_Function.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,15 @@ jsi::Object FOCV_Function::invoke(jsi::Runtime& runtime, const jsi::Value* argum
193193
cv::checkRange(*a, quiet, &(*pos), minVal, maxVal);
194194
}
195195
} break;
196+
case hashString("clone", 5): {
197+
auto src = args.asMatPtr(1);
198+
199+
cv::Mat result = (*src).clone();
200+
std::string id = FOCV_Storage::save(result);
201+
202+
return FOCV_JsiObject::wrap(runtime, "mat", id);
203+
} break;
204+
196205
case hashString("compare", 7): {
197206
auto src1 = args.asMatPtr(1);
198207
auto src2 = args.asMatPtr(2);

docs/pages/availablefunctions.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,16 @@ invoke(
219219
): void;
220220
```
221221

222+
### clone
223+
224+
The method creates a full copy of the array.
225+
226+
- src input array.
227+
228+
```js
229+
invoke(name: 'clone', src: Mat): Mat;
230+
```
231+
222232
### compare
223233

224234
Performs the per-element comparison of two arrays or an array and scalar value

src/functions/Core.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,13 @@ export type Core = {
204204
maxVal: number
205205
): void;
206206

207+
/**
208+
* The method creates a full copy of the array.
209+
* @param name Function name.
210+
* @param src input array.
211+
*/
212+
invoke(name: 'clone', src: Mat): Mat;
213+
207214
/**
208215
* Performs the per-element comparison of two arrays or an array and scalar value
209216
* @param name Function name.

0 commit comments

Comments
 (0)