diff --git a/cpp/FOCV_Function.cpp b/cpp/FOCV_Function.cpp index a048aa6..28fd6e9 100644 --- a/cpp/FOCV_Function.cpp +++ b/cpp/FOCV_Function.cpp @@ -1501,6 +1501,16 @@ jsi::Object FOCV_Function::invoke(jsi::Runtime& runtime, const jsi::Value* argum cv::warpPerspective(*src, *dst, *M, *size, flags, borderMode, *borderValue); } break; + case hashString("warpPolar", 9): { + auto src = args.asMatPtr(1); + auto dst = args.asMatPtr(2); + auto size = args.asSizePtr(3); + auto center = args.asPoint2fPtr(4); + auto maxRadius = args.asNumber(5); + auto flags = args.asNumber(6); + + cv::warpPolar(*src, *dst, *size, *center, maxRadius, flags); + } break; } } catch (cv::Exception& e) { std::string message(e.what()); diff --git a/docs/pages/availablefunctions.md b/docs/pages/availablefunctions.md index ac3a8bf..3802d11 100644 --- a/docs/pages/availablefunctions.md +++ b/docs/pages/availablefunctions.md @@ -2522,3 +2522,27 @@ invoke( borderValue: Scalar ): void; ``` + +### warpPolar + +Remaps an image to polar or semilog-polar coordinates space. + +- name Function name. +- src source image. +- dst destination image. It will have same type as src. +- dsize the destination image size. +- center the transformation center. +- maxRadius the radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too. +- flags a combination of interpolation methods, InterpolationFlags + WarpPolarMode. + +```js +invoke( + name: 'warpPolar', + src: Mat, + dst: Mat, + dsize: Size, + center: Point2f, + maxRadius: number, + flags: number +): void; +``` diff --git a/src/constants/ImageTransform.ts b/src/constants/ImageTransform.ts index 2d692b9..e798dea 100644 --- a/src/constants/ImageTransform.ts +++ b/src/constants/ImageTransform.ts @@ -11,3 +11,8 @@ export enum InterpolationFlags { WARP_INVERSE_MAP = 16, WARP_RELATIVE_MAP = 32, } + +export enum WarpPolarMode { + WARP_POLAR_LINEAR = 0, + WARP_POLAR_LOG = 256, +} diff --git a/src/functions/ImageProcessing/ImageTransform.ts b/src/functions/ImageProcessing/ImageTransform.ts index 8bdc29f..deb7298 100644 --- a/src/functions/ImageProcessing/ImageTransform.ts +++ b/src/functions/ImageProcessing/ImageTransform.ts @@ -1,6 +1,12 @@ import type { BorderTypes, DecompTypes } from '../../constants/Core'; import type { InterpolationFlags } from '../../constants/ImageTransform'; -import type { Mat, PointVector, Scalar, Size } from '../../objects/Objects'; +import type { + Mat, + Point2f, + PointVector, + Scalar, + Size, +} from '../../objects/Objects'; export type ImageTransform = { /** @@ -48,4 +54,24 @@ export type ImageTransform = { borderMode: BorderTypes.BORDER_CONSTANT | BorderTypes.BORDER_REPLICATE, borderValue: Scalar ): void; + + /** + * Remaps an image to polar or semilog-polar coordinates space. + * @param name Function name. + * @param src source image. + * @param dst destination image. It will have same type as src. + * @param dsize the destination image size. + * @param center the transformation center. + * @param maxRadius the radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too. + * @param flags a combination of interpolation methods, InterpolationFlags + WarpPolarMode. + */ + invoke( + name: 'warpPolar', + src: Mat, + dst: Mat, + dsize: Size, + center: Point2f, + maxRadius: number, + flags: number + ): void; };