Skip to content

Commit 07975de

Browse files
Merge pull request #82 from adriaanpardoel/warp-polar
feat: warpPolar function
2 parents 6605baa + 0dff2e2 commit 07975de

File tree

4 files changed

+66
-1
lines changed

4 files changed

+66
-1
lines changed

cpp/FOCV_Function.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -1501,6 +1501,16 @@ jsi::Object FOCV_Function::invoke(jsi::Runtime& runtime, const jsi::Value* argum
15011501

15021502
cv::warpPerspective(*src, *dst, *M, *size, flags, borderMode, *borderValue);
15031503
} break;
1504+
case hashString("warpPolar", 9): {
1505+
auto src = args.asMatPtr(1);
1506+
auto dst = args.asMatPtr(2);
1507+
auto size = args.asSizePtr(3);
1508+
auto center = args.asPoint2fPtr(4);
1509+
auto maxRadius = args.asNumber(5);
1510+
auto flags = args.asNumber(6);
1511+
1512+
cv::warpPolar(*src, *dst, *size, *center, maxRadius, flags);
1513+
} break;
15041514
}
15051515
} catch (cv::Exception& e) {
15061516
std::string message(e.what());

docs/pages/availablefunctions.md

+24
Original file line numberDiff line numberDiff line change
@@ -2522,3 +2522,27 @@ invoke(
25222522
borderValue: Scalar
25232523
): void;
25242524
```
2525+
2526+
### warpPolar
2527+
2528+
Remaps an image to polar or semilog-polar coordinates space.
2529+
2530+
- name Function name.
2531+
- src source image.
2532+
- dst destination image. It will have same type as src.
2533+
- dsize the destination image size.
2534+
- center the transformation center.
2535+
- maxRadius the radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too.
2536+
- flags a combination of interpolation methods, InterpolationFlags + WarpPolarMode.
2537+
2538+
```js
2539+
invoke(
2540+
name: 'warpPolar',
2541+
src: Mat,
2542+
dst: Mat,
2543+
dsize: Size,
2544+
center: Point2f,
2545+
maxRadius: number,
2546+
flags: number
2547+
): void;
2548+
```

src/constants/ImageTransform.ts

+5
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@ export enum InterpolationFlags {
1111
WARP_INVERSE_MAP = 16,
1212
WARP_RELATIVE_MAP = 32,
1313
}
14+
15+
export enum WarpPolarMode {
16+
WARP_POLAR_LINEAR = 0,
17+
WARP_POLAR_LOG = 256,
18+
}

src/functions/ImageProcessing/ImageTransform.ts

+27-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import type { BorderTypes, DecompTypes } from '../../constants/Core';
22
import type { InterpolationFlags } from '../../constants/ImageTransform';
3-
import type { Mat, PointVector, Scalar, Size } from '../../objects/Objects';
3+
import type {
4+
Mat,
5+
Point2f,
6+
PointVector,
7+
Scalar,
8+
Size,
9+
} from '../../objects/Objects';
410

511
export type ImageTransform = {
612
/**
@@ -48,4 +54,24 @@ export type ImageTransform = {
4854
borderMode: BorderTypes.BORDER_CONSTANT | BorderTypes.BORDER_REPLICATE,
4955
borderValue: Scalar
5056
): void;
57+
58+
/**
59+
* Remaps an image to polar or semilog-polar coordinates space.
60+
* @param name Function name.
61+
* @param src source image.
62+
* @param dst destination image. It will have same type as src.
63+
* @param dsize the destination image size.
64+
* @param center the transformation center.
65+
* @param maxRadius the radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too.
66+
* @param flags a combination of interpolation methods, InterpolationFlags + WarpPolarMode.
67+
*/
68+
invoke(
69+
name: 'warpPolar',
70+
src: Mat,
71+
dst: Mat,
72+
dsize: Size,
73+
center: Point2f,
74+
maxRadius: number,
75+
flags: number
76+
): void;
5177
};

0 commit comments

Comments
 (0)