Skip to content

Commit 0c3d672

Browse files
Merge pull request #15 from lukaszkurantdev/feat/rotate-func
feat: rotate function
2 parents 67d297a + a077384 commit 0c3d672

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

cpp/FOCV_Function.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,13 @@ jsi::Object FOCV_Function::invoke(jsi::Runtime& runtime, const jsi::Value* argum
637637

638638
cv::repeat(*src, ny, nx, *dst);
639639
} break;
640+
case hashString("rotate", 6): {
641+
auto src = args.asMatPtr(1);
642+
auto dst = args.asMatPtr(2);
643+
auto code = args.asNumber(3);
644+
645+
cv::rotate(*src, *dst, code);
646+
} break;
640647
case hashString("scaleAdd", 8): {
641648
auto src1 = args.asMatPtr(1);
642649
auto alpha = args.asNumber(2);
@@ -1366,4 +1373,4 @@ jsi::Object FOCV_Function::invoke(jsi::Runtime& runtime, const jsi::Value* argum
13661373
}
13671374

13681375
return value;
1369-
}
1376+
}

docs/pages/availablefunctions.md

+13
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,19 @@ Fills the output array with repeated copies of the input array
936936
invoke(name: 'repeat', src: Mat, ny: number, nx: number, dst: Mat): void;
937937
```
938938

939+
### rotate
940+
941+
Rotates matrix.
942+
943+
- src input array to replicate
944+
- dst output array of the same type as src.
945+
- code rotate flag
946+
947+
948+
```js
949+
invoke(name: 'repeat', src: Mat, dst: Mat, code: RotateFlags): void;
950+
```
951+
939952
### scaleAdd
940953

941954
Calculates the sum of a scaled array and another array

src/functions/Core.ts

+10
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type {
77
GemmFlags,
88
NormTypes,
99
ReduceTypes,
10+
RotateFlags,
1011
SortFlags,
1112
} from '../constants/Core';
1213
import type { DataTypes } from '../constants/DataTypes';
@@ -769,6 +770,15 @@ export type Core = {
769770
*/
770771
invoke(name: 'repeat', src: Mat, ny: number, nx: number, dst: Mat): void;
771772

773+
/**
774+
* Rotates matrix.
775+
* @param name Function name.
776+
* @param src input array to replicate
777+
* @param dst output array of the same type as src
778+
* @param code rotate flag
779+
*/
780+
invoke(name: 'rotate', src: Mat, dst: Mat, code: RotateFlags): void;
781+
772782
/**
773783
* Calculates the sum of a scaled array and another array
774784
* @param name Function name.

0 commit comments

Comments
 (0)