diff --git a/package.json b/package.json index 95bf355..3f79e16 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "4.12.0-release.1", "description": "OpenCV JavaScript version for node.js or browser", "main": "dist/opencv.js", - "types": "dist/src/index.d.ts", + "types": "src/index.d.ts", "files": [ "dist/", "src/" diff --git a/src/index.ts b/src/index.d.ts similarity index 100% rename from src/index.ts rename to src/index.d.ts diff --git a/src/types/_cv.ts b/src/types/_cv.d.ts similarity index 100% rename from src/types/_cv.ts rename to src/types/_cv.d.ts diff --git a/src/types/emscripten.ts b/src/types/emscripten.d.ts similarity index 100% rename from src/types/emscripten.ts rename to src/types/emscripten.d.ts diff --git a/src/types/opencv/Affine3.ts b/src/types/opencv/Affine3.d.ts similarity index 100% rename from src/types/opencv/Affine3.ts rename to src/types/opencv/Affine3.d.ts diff --git a/src/types/opencv/Algorithm.ts b/src/types/opencv/Algorithm.d.ts similarity index 100% rename from src/types/opencv/Algorithm.ts rename to src/types/opencv/Algorithm.d.ts diff --git a/src/types/opencv/AutoBuffer.ts b/src/types/opencv/AutoBuffer.d.ts similarity index 100% rename from src/types/opencv/AutoBuffer.ts rename to src/types/opencv/AutoBuffer.d.ts diff --git a/src/types/opencv/BFMatcher.ts b/src/types/opencv/BFMatcher.d.ts similarity index 100% rename from src/types/opencv/BFMatcher.ts rename to src/types/opencv/BFMatcher.d.ts diff --git a/src/types/opencv/BOWTrainer.ts b/src/types/opencv/BOWTrainer.d.ts similarity index 100% rename from src/types/opencv/BOWTrainer.ts rename to src/types/opencv/BOWTrainer.d.ts diff --git a/src/types/opencv/BackgroundSubtractor.ts b/src/types/opencv/BackgroundSubtractor.d.ts similarity index 100% rename from src/types/opencv/BackgroundSubtractor.ts rename to src/types/opencv/BackgroundSubtractor.d.ts diff --git a/src/types/opencv/BackgroundSubtractorMOG2.ts b/src/types/opencv/BackgroundSubtractorMOG2.d.ts similarity index 100% rename from src/types/opencv/BackgroundSubtractorMOG2.ts rename to src/types/opencv/BackgroundSubtractorMOG2.d.ts diff --git a/src/types/opencv/CascadeClassifier.ts b/src/types/opencv/CascadeClassifier.d.ts similarity index 100% rename from src/types/opencv/CascadeClassifier.ts rename to src/types/opencv/CascadeClassifier.d.ts diff --git a/src/types/opencv/DescriptorMatcher.ts b/src/types/opencv/DescriptorMatcher.d.ts similarity index 100% rename from src/types/opencv/DescriptorMatcher.ts rename to src/types/opencv/DescriptorMatcher.d.ts diff --git a/src/types/opencv/DynamicBitset.ts b/src/types/opencv/DynamicBitset.d.ts similarity index 100% rename from src/types/opencv/DynamicBitset.ts rename to src/types/opencv/DynamicBitset.d.ts diff --git a/src/types/opencv/Exception.ts b/src/types/opencv/Exception.d.ts similarity index 100% rename from src/types/opencv/Exception.ts rename to src/types/opencv/Exception.d.ts diff --git a/src/types/opencv/Feature2D.ts b/src/types/opencv/Feature2D.d.ts similarity index 86% rename from src/types/opencv/Feature2D.ts rename to src/types/opencv/Feature2D.d.ts index b585fff..509e8d8 100644 --- a/src/types/opencv/Feature2D.ts +++ b/src/types/opencv/Feature2D.d.ts @@ -1,7 +1,7 @@ import type { Algorithm, KeyPointVector, Mat, OutputArray } from "./_types"; /** - * https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html + * https://docs.opencv.org/4.12.0/d0/d13/classcv_1_1Feature2D.html */ export declare class Feature2D extends Algorithm { /** diff --git a/src/types/opencv/FlannBasedMatcher.ts b/src/types/opencv/FlannBasedMatcher.d.ts similarity index 100% rename from src/types/opencv/FlannBasedMatcher.ts rename to src/types/opencv/FlannBasedMatcher.d.ts diff --git a/src/types/opencv/HOGDescriptor.ts b/src/types/opencv/HOGDescriptor.d.ts similarity index 100% rename from src/types/opencv/HOGDescriptor.ts rename to src/types/opencv/HOGDescriptor.d.ts diff --git a/src/types/opencv/Logger.ts b/src/types/opencv/Logger.d.ts similarity index 100% rename from src/types/opencv/Logger.ts rename to src/types/opencv/Logger.d.ts diff --git a/src/types/opencv/LshTable.ts b/src/types/opencv/LshTable.d.ts similarity index 100% rename from src/types/opencv/LshTable.ts rename to src/types/opencv/LshTable.d.ts diff --git a/src/types/opencv/Mat.ts b/src/types/opencv/Mat.d.ts similarity index 100% rename from src/types/opencv/Mat.ts rename to src/types/opencv/Mat.d.ts diff --git a/src/types/opencv/MatExpr.ts b/src/types/opencv/MatExpr.d.ts similarity index 100% rename from src/types/opencv/MatExpr.ts rename to src/types/opencv/MatExpr.d.ts diff --git a/src/types/opencv/MatOp.ts b/src/types/opencv/MatOp.d.ts similarity index 100% rename from src/types/opencv/MatOp.ts rename to src/types/opencv/MatOp.d.ts diff --git a/src/types/opencv/Matx.ts b/src/types/opencv/Matx.d.ts similarity index 100% rename from src/types/opencv/Matx.ts rename to src/types/opencv/Matx.d.ts diff --git a/src/types/opencv/Node.ts b/src/types/opencv/Node.d.ts similarity index 100% rename from src/types/opencv/Node.ts rename to src/types/opencv/Node.d.ts diff --git a/src/types/opencv/ORB.ts b/src/types/opencv/ORB.d.ts similarity index 88% rename from src/types/opencv/ORB.ts rename to src/types/opencv/ORB.d.ts index 6acf187..48b58e6 100644 --- a/src/types/opencv/ORB.ts +++ b/src/types/opencv/ORB.d.ts @@ -1,7 +1,7 @@ import type { Feature2D, float, int } from "./_types"; /** - * https://docs.opencv.org/master/db/d95/classcv_1_1ORB.html + * https://docs.opencv.org/4.12.0/db/d95/classcv_1_1ORB.html */ export declare class ORB extends Feature2D { public constructor( diff --git a/src/types/opencv/PCA.ts b/src/types/opencv/PCA.d.ts similarity index 100% rename from src/types/opencv/PCA.ts rename to src/types/opencv/PCA.d.ts diff --git a/src/types/opencv/QRCodeDetector.ts b/src/types/opencv/QRCodeDetector.d.ts similarity index 100% rename from src/types/opencv/QRCodeDetector.ts rename to src/types/opencv/QRCodeDetector.d.ts diff --git a/src/types/opencv/QRCodeDetectorAruco.ts b/src/types/opencv/QRCodeDetectorAruco.d.ts similarity index 100% rename from src/types/opencv/QRCodeDetectorAruco.ts rename to src/types/opencv/QRCodeDetectorAruco.d.ts diff --git a/src/types/opencv/RotatedRect.ts b/src/types/opencv/RotatedRect.d.ts similarity index 98% rename from src/types/opencv/RotatedRect.ts rename to src/types/opencv/RotatedRect.d.ts index 241c6b4..7b99193 100644 --- a/src/types/opencv/RotatedRect.ts +++ b/src/types/opencv/RotatedRect.d.ts @@ -63,7 +63,8 @@ export declare class RotatedRect { public static boundingRect2f(rect: RotatedRect): Rect; /** - returns 4 vertices of the rectangle + * returns 4 vertices of the rectangle + * * @param rect The rotated rectangle * @returns Array of 4 points in order: bottomLeft, topLeft, topRight, bottomRight */ diff --git a/src/types/opencv/Tracker.ts b/src/types/opencv/Tracker.d.ts similarity index 100% rename from src/types/opencv/Tracker.ts rename to src/types/opencv/Tracker.d.ts diff --git a/src/types/opencv/TrackerMIL.ts b/src/types/opencv/TrackerMIL.d.ts similarity index 100% rename from src/types/opencv/TrackerMIL.ts rename to src/types/opencv/TrackerMIL.d.ts diff --git a/src/types/opencv/_hacks.ts b/src/types/opencv/_hacks.d.ts similarity index 97% rename from src/types/opencv/_hacks.ts rename to src/types/opencv/_hacks.d.ts index 98c8d4d..56456ad 100644 --- a/src/types/opencv/_hacks.ts +++ b/src/types/opencv/_hacks.d.ts @@ -1,5 +1,11 @@ // Scalar, Point, Rect, etc are defined by opencv.js (helpers.js) and we need to declare them manually: +import { Algorithm } from "./Algorithm"; +import { RotatedRect } from "./RotatedRect"; +import type { NormTypes } from './core_array' +import { Mat } from './Mat' +import type { LineTypes } from './imgproc_draw' + export declare class Range { public start: number; public end: number; @@ -92,9 +98,6 @@ export declare function FS_createDataFile( canOwn: boolean, ): any; -import { Algorithm, type LineTypes, Mat, type NormTypes, RotatedRect } from "."; -import "../_cv"; - /** * Base class for Contrast Limited Adaptive Histogram Equalization. */ diff --git a/src/types/opencv/_types.ts b/src/types/opencv/_types.d.ts similarity index 100% rename from src/types/opencv/_types.ts rename to src/types/opencv/_types.d.ts diff --git a/src/types/opencv/calib3d.ts b/src/types/opencv/calib3d.d.ts similarity index 100% rename from src/types/opencv/calib3d.ts rename to src/types/opencv/calib3d.d.ts diff --git a/src/types/opencv/core_array.ts b/src/types/opencv/core_array.d.ts similarity index 99% rename from src/types/opencv/core_array.ts rename to src/types/opencv/core_array.d.ts index 24f264a..7c1b622 100644 --- a/src/types/opencv/core_array.ts +++ b/src/types/opencv/core_array.d.ts @@ -3051,7 +3051,7 @@ export declare const ROTATE_90_COUNTERCLOCKWISE: RotateFlags; // initializer: = * [borderInterpolate], [copyMakeBorder] * */ -export type BorderTypes = any; +export type BorderTypes = number; /** * Various border types, image boundaries are denoted with `|` @@ -3059,7 +3059,7 @@ export type BorderTypes = any; * [borderInterpolate], [copyMakeBorder] * */ -export type CmpTypes = any; +export type CmpTypes = number; /** * Various border types, image boundaries are denoted with `|` @@ -3067,7 +3067,7 @@ export type CmpTypes = any; * [borderInterpolate], [copyMakeBorder] * */ -export type DecompTypes = any; +export type DecompTypes = number; /** * Various border types, image boundaries are denoted with `|` @@ -3075,7 +3075,7 @@ export type DecompTypes = any; * [borderInterpolate], [copyMakeBorder] * */ -export type DftFlags = any; +export type DftFlags = number; /** * Various border types, image boundaries are denoted with `|` @@ -3083,7 +3083,7 @@ export type DftFlags = any; * [borderInterpolate], [copyMakeBorder] * */ -export type GemmFlags = any; +export type GemmFlags = number; /** * Various border types, image boundaries are denoted with `|` @@ -3091,7 +3091,7 @@ export type GemmFlags = any; * [borderInterpolate], [copyMakeBorder] * */ -export type NormTypes = any; +export type NormTypes = number; /** * Various border types, image boundaries are denoted with `|` @@ -3099,4 +3099,4 @@ export type NormTypes = any; * [borderInterpolate], [copyMakeBorder] * */ -export type RotateFlags = any; +export type RotateFlags = number; diff --git a/src/types/opencv/core_cluster.ts b/src/types/opencv/core_cluster.d.ts similarity index 100% rename from src/types/opencv/core_cluster.ts rename to src/types/opencv/core_cluster.d.ts diff --git a/src/types/opencv/core_hal_interface.ts b/src/types/opencv/core_hal_interface.d.ts similarity index 100% rename from src/types/opencv/core_hal_interface.ts rename to src/types/opencv/core_hal_interface.d.ts diff --git a/src/types/opencv/core_utils.ts b/src/types/opencv/core_utils.d.ts similarity index 100% rename from src/types/opencv/core_utils.ts rename to src/types/opencv/core_utils.d.ts diff --git a/src/types/opencv/dnn.ts b/src/types/opencv/dnn.d.ts similarity index 100% rename from src/types/opencv/dnn.ts rename to src/types/opencv/dnn.d.ts diff --git a/src/types/opencv/features2d_draw.ts b/src/types/opencv/features2d_draw.d.ts similarity index 100% rename from src/types/opencv/features2d_draw.ts rename to src/types/opencv/features2d_draw.d.ts diff --git a/src/types/opencv/fisheye.ts b/src/types/opencv/fisheye.d.ts similarity index 100% rename from src/types/opencv/fisheye.ts rename to src/types/opencv/fisheye.d.ts diff --git a/src/types/opencv/imgproc_color_conversions.ts b/src/types/opencv/imgproc_color_conversions.d.ts similarity index 99% rename from src/types/opencv/imgproc_color_conversions.ts rename to src/types/opencv/imgproc_color_conversions.d.ts index 3bf45f6..4061df0 100644 --- a/src/types/opencv/imgproc_color_conversions.ts +++ b/src/types/opencv/imgproc_color_conversions.d.ts @@ -524,4 +524,4 @@ export declare const COLOR_COLORCVT_MAX: ColorConversionCodes; // initializer: = * [Color conversions] * */ -export type ColorConversionCodes = any; +export type ColorConversionCodes = number; diff --git a/src/types/opencv/imgproc_colormap.ts b/src/types/opencv/imgproc_colormap.d.ts similarity index 100% rename from src/types/opencv/imgproc_colormap.ts rename to src/types/opencv/imgproc_colormap.d.ts diff --git a/src/types/opencv/imgproc_draw.ts b/src/types/opencv/imgproc_draw.d.ts similarity index 100% rename from src/types/opencv/imgproc_draw.ts rename to src/types/opencv/imgproc_draw.d.ts diff --git a/src/types/opencv/imgproc_feature.ts b/src/types/opencv/imgproc_feature.d.ts similarity index 100% rename from src/types/opencv/imgproc_feature.ts rename to src/types/opencv/imgproc_feature.d.ts diff --git a/src/types/opencv/imgproc_filter.ts b/src/types/opencv/imgproc_filter.d.ts similarity index 99% rename from src/types/opencv/imgproc_filter.ts rename to src/types/opencv/imgproc_filter.d.ts index d528122..7cbc0bf 100644 --- a/src/types/opencv/imgproc_filter.ts +++ b/src/types/opencv/imgproc_filter.d.ts @@ -911,8 +911,8 @@ export declare const MORPH_HITMISS: MorphTypes; // initializer: = 7 export declare const FILTER_SCHARR: SpecialFilter; // initializer: = -1 -export type MorphShapes = any; +export type MorphShapes = number; -export type MorphTypes = any; +export type MorphTypes = number; -export type SpecialFilter = any; +export type SpecialFilter = number; diff --git a/src/types/opencv/imgproc_hist.ts b/src/types/opencv/imgproc_hist.d.ts similarity index 100% rename from src/types/opencv/imgproc_hist.ts rename to src/types/opencv/imgproc_hist.d.ts diff --git a/src/types/opencv/imgproc_misc.ts b/src/types/opencv/imgproc_misc.d.ts similarity index 98% rename from src/types/opencv/imgproc_misc.ts rename to src/types/opencv/imgproc_misc.d.ts index b46f435..ab2de54 100644 --- a/src/types/opencv/imgproc_misc.ts +++ b/src/types/opencv/imgproc_misc.d.ts @@ -557,7 +557,7 @@ export declare const THRESH_TRIANGLE: ThresholdTypes; // initializer: = 16 * [adaptiveThreshold] * */ -export type AdaptiveThresholdTypes = any; +export type AdaptiveThresholdTypes = number; /** * adaptive threshold algorithm @@ -565,7 +565,7 @@ export type AdaptiveThresholdTypes = any; * [adaptiveThreshold] * */ -export type DistanceTransformLabelTypes = any; +export type DistanceTransformLabelTypes = number; /** * adaptive threshold algorithm @@ -573,7 +573,7 @@ export type DistanceTransformLabelTypes = any; * [adaptiveThreshold] * */ -export type DistanceTransformMasks = any; +export type DistanceTransformMasks = number; /** * adaptive threshold algorithm @@ -581,7 +581,7 @@ export type DistanceTransformMasks = any; * [adaptiveThreshold] * */ -export type DistanceTypes = any; +export type DistanceTypes = number; /** * adaptive threshold algorithm @@ -589,7 +589,7 @@ export type DistanceTypes = any; * [adaptiveThreshold] * */ -export type FloodFillFlags = any; +export type FloodFillFlags = number; /** * adaptive threshold algorithm @@ -597,7 +597,7 @@ export type FloodFillFlags = any; * [adaptiveThreshold] * */ -export type GrabCutClasses = any; +export type GrabCutClasses = number; /** * adaptive threshold algorithm @@ -605,7 +605,7 @@ export type GrabCutClasses = any; * [adaptiveThreshold] * */ -export type GrabCutModes = any; +export type GrabCutModes = number; /** * adaptive threshold algorithm @@ -613,4 +613,4 @@ export type GrabCutModes = any; * [adaptiveThreshold] * */ -export type ThresholdTypes = any; +export type ThresholdTypes = number; diff --git a/src/types/opencv/imgproc_object.ts b/src/types/opencv/imgproc_object.d.ts similarity index 100% rename from src/types/opencv/imgproc_object.ts rename to src/types/opencv/imgproc_object.d.ts diff --git a/src/types/opencv/imgproc_shape.ts b/src/types/opencv/imgproc_shape.d.ts similarity index 99% rename from src/types/opencv/imgproc_shape.ts rename to src/types/opencv/imgproc_shape.d.ts index 66a9ce1..1c4bfc6 100644 --- a/src/types/opencv/imgproc_shape.ts +++ b/src/types/opencv/imgproc_shape.d.ts @@ -715,14 +715,14 @@ export declare const CONTOURS_MATCH_I2: ShapeMatchModes; // initializer: =2 export declare const CONTOURS_MATCH_I3: ShapeMatchModes; // initializer: =3 -export type ConnectedComponentsAlgorithmsTypes = any; +export type ConnectedComponentsAlgorithmsTypes = number; -export type ConnectedComponentsTypes = any; +export type ConnectedComponentsTypes = number; -export type ContourApproximationModes = any; +export type ContourApproximationModes = number; -export type RectanglesIntersectTypes = any; +export type RectanglesIntersectTypes = number; -export type RetrievalModes = any; +export type RetrievalModes = number; -export type ShapeMatchModes = any; +export type ShapeMatchModes = number; diff --git a/src/types/opencv/imgproc_transform.ts b/src/types/opencv/imgproc_transform.d.ts similarity index 99% rename from src/types/opencv/imgproc_transform.ts rename to src/types/opencv/imgproc_transform.d.ts index 1bb3d3e..f815acc 100644 --- a/src/types/opencv/imgproc_transform.ts +++ b/src/types/opencv/imgproc_transform.d.ts @@ -567,8 +567,8 @@ export declare const WARP_POLAR_LINEAR: WarpPolarMode; // initializer: = 0 export declare const WARP_POLAR_LOG: WarpPolarMode; // initializer: = 256 -export type InterpolationFlags = any; +export type InterpolationFlags = number; -export type InterpolationMasks = any; +export type InterpolationMasks = number; -export type WarpPolarMode = any; +export type WarpPolarMode = number; diff --git a/src/types/opencv/index.ts b/src/types/opencv/index.d.ts similarity index 100% rename from src/types/opencv/index.ts rename to src/types/opencv/index.d.ts diff --git a/src/types/opencv/objdetect.ts b/src/types/opencv/objdetect.d.ts similarity index 100% rename from src/types/opencv/objdetect.ts rename to src/types/opencv/objdetect.d.ts diff --git a/src/types/opencv/photo_inpaint.ts b/src/types/opencv/photo_inpaint.d.ts similarity index 100% rename from src/types/opencv/photo_inpaint.ts rename to src/types/opencv/photo_inpaint.d.ts diff --git a/src/types/opencv/softdouble.ts b/src/types/opencv/softdouble.d.ts similarity index 100% rename from src/types/opencv/softdouble.ts rename to src/types/opencv/softdouble.d.ts diff --git a/src/types/opencv/softfloat.ts b/src/types/opencv/softfloat.d.ts similarity index 100% rename from src/types/opencv/softfloat.ts rename to src/types/opencv/softfloat.d.ts diff --git a/src/types/opencv/video_track.ts b/src/types/opencv/video_track.d.ts similarity index 100% rename from src/types/opencv/video_track.ts rename to src/types/opencv/video_track.d.ts diff --git a/tsconfig.json b/tsconfig.json index 1da2a4c..361ce22 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,8 +8,10 @@ "sourceMap": true, "outDir": "./dist", "rootDir": ".", - "skipLibCheck": true, - "declaration": true + "noEmit": true, + "skipLibCheck": false, + "declaration": true, + "types": [], }, "include": ["src"] }