From 851634f97b3db86b7a0f3cfbabb3765442efb4dd Mon Sep 17 00:00:00 2001 From: "T.H. Alex MAK" Date: Fri, 15 Mar 2024 15:32:22 +0800 Subject: [PATCH 1/2] feat: declare `Circle` class This class is used for `minEnclosingCircle` method as a return value. --- src/types/opencv/_hacks.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/types/opencv/_hacks.ts b/src/types/opencv/_hacks.ts index f62a512..40a7244 100644 --- a/src/types/opencv/_hacks.ts +++ b/src/types/opencv/_hacks.ts @@ -32,6 +32,12 @@ export declare class Point { public y: number; } +export declare class Circle { + public constructor(center: Point, radius: number); + public center: Point; + public radius: number; +} + export declare class Size { public constructor(width: number, height: number); public width: number; From 2c6ccec9121835aa11cff0a8f9667016cd0e363a Mon Sep 17 00:00:00 2001 From: "T.H. Alex MAK" Date: Fri, 15 Mar 2024 15:33:54 +0800 Subject: [PATCH 2/2] fix: fix signature of `minEnclosingCircle` The `minEnclosingCircle` in opencv.js does not accept 3 parameters. Instead, it accepts points only and return the enclosing circle like python, which is an object that has `center` and `radius`. --- src/types/opencv/imgproc_shape.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/types/opencv/imgproc_shape.ts b/src/types/opencv/imgproc_shape.ts index 5bc3def..8bf5e65 100644 --- a/src/types/opencv/imgproc_shape.ts +++ b/src/types/opencv/imgproc_shape.ts @@ -1,5 +1,6 @@ import { bool, + Circle, double, float, InputArray, @@ -12,6 +13,7 @@ import { Rect, RotatedRect, } from "./_types"; + /* * # Structural Analysis and Shape Descriptors * @@ -530,16 +532,10 @@ export declare function minAreaRect(points: InputArray): RotatedRect; * The function finds the minimal enclosing circle of a 2D point set using an iterative algorithm. * * @param points Input vector of 2D points, stored in std::vector<> or Mat - * - * @param center Output center of the circle. - * - * @param radius Output radius of the circle. */ export declare function minEnclosingCircle( points: InputArray, - center: any, - radius: any, -): void; +): Circle; /** * The function finds a triangle of minimum area enclosing the given set of 2D points and returns its