Skip to content

feat: rotate function #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cpp/FOCV_Function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,13 @@ jsi::Object FOCV_Function::invoke(jsi::Runtime& runtime, const jsi::Value* argum

cv::repeat(*src, ny, nx, *dst);
} break;
case hashString("rotate", 6): {
auto src = args.asMatPtr(1);
auto dst = args.asMatPtr(2);
auto code = args.asNumber(3);

cv::rotate(*src, *dst, code);
} break;
case hashString("scaleAdd", 8): {
auto src1 = args.asMatPtr(1);
auto alpha = args.asNumber(2);
Expand Down Expand Up @@ -1366,4 +1373,4 @@ jsi::Object FOCV_Function::invoke(jsi::Runtime& runtime, const jsi::Value* argum
}

return value;
}
}
13 changes: 13 additions & 0 deletions docs/pages/availablefunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,19 @@ Fills the output array with repeated copies of the input array
invoke(name: 'repeat', src: Mat, ny: number, nx: number, dst: Mat): void;
```

### rotate

Rotates matrix.

- src input array to replicate
- dst output array of the same type as src.
- code rotate flag


```js
invoke(name: 'repeat', src: Mat, dst: Mat, code: RotateFlags): void;
```

### scaleAdd

Calculates the sum of a scaled array and another array
Expand Down
10 changes: 10 additions & 0 deletions src/functions/Core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type {
GemmFlags,
NormTypes,
ReduceTypes,
RotateFlags,
SortFlags,
} from '../constants/Core';
import type { DataTypes } from '../constants/DataTypes';
Expand Down Expand Up @@ -769,6 +770,15 @@ export type Core = {
*/
invoke(name: 'repeat', src: Mat, ny: number, nx: number, dst: Mat): void;

/**
* Rotates matrix.
* @param name Function name.
* @param src input array to replicate
* @param dst output array of the same type as src
* @param code rotate flag
*/
invoke(name: 'rotate', src: Mat, dst: Mat, code: RotateFlags): void;

/**
* Calculates the sum of a scaled array and another array
* @param name Function name.
Expand Down
Loading