Skip to content
Open
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to use a fixed version of the link. The link with master might get broken when a new major version is released.

*/
export declare class Feature2D extends Algorithm {
/**
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/types/opencv/ORB.ts → src/types/opencv/ORB.d.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 6 additions & 3 deletions src/types/opencv/_hacks.ts → src/types/opencv/_hacks.d.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -92,9 +98,6 @@ export declare function FS_createDataFile(
canOwn: boolean,
): any;

import { Algorithm, type LineTypes, Mat, type NormTypes, RotatedRect } from ".";
import "../_cv";

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove cycling imports.

/**
* Base class for Contrast Limited Adaptive Histogram Equalization.
*/
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3051,52 +3051,52 @@ 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 `|`
*
* [borderInterpolate], [copyMakeBorder]
*
*/
export type CmpTypes = any;
export type CmpTypes = number;

/**
* Various border types, image boundaries are denoted with `|`
*
* [borderInterpolate], [copyMakeBorder]
*
*/
export type DecompTypes = any;
export type DecompTypes = number;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change some types from any to number


/**
* Various border types, image boundaries are denoted with `|`
*
* [borderInterpolate], [copyMakeBorder]
*
*/
export type DftFlags = any;
export type DftFlags = number;

/**
* Various border types, image boundaries are denoted with `|`
*
* [borderInterpolate], [copyMakeBorder]
*
*/
export type GemmFlags = any;
export type GemmFlags = number;

/**
* Various border types, image boundaries are denoted with `|`
*
* [borderInterpolate], [copyMakeBorder]
*
*/
export type NormTypes = any;
export type NormTypes = number;

/**
* Various border types, image boundaries are denoted with `|`
*
* [borderInterpolate], [copyMakeBorder]
*
*/
export type RotateFlags = any;
export type RotateFlags = number;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -524,4 +524,4 @@ export declare const COLOR_COLORCVT_MAX: ColorConversionCodes; // initializer: =
* [Color conversions]
*
*/
export type ColorConversionCodes = any;
export type ColorConversionCodes = number;
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -557,60 +557,60 @@ export declare const THRESH_TRIANGLE: ThresholdTypes; // initializer: = 16
* [adaptiveThreshold]
*
*/
export type AdaptiveThresholdTypes = any;
export type AdaptiveThresholdTypes = number;

/**
* adaptive threshold algorithm
*
* [adaptiveThreshold]
*
*/
export type DistanceTransformLabelTypes = any;
export type DistanceTransformLabelTypes = number;

/**
* adaptive threshold algorithm
*
* [adaptiveThreshold]
*
*/
export type DistanceTransformMasks = any;
export type DistanceTransformMasks = number;

/**
* adaptive threshold algorithm
*
* [adaptiveThreshold]
*
*/
export type DistanceTypes = any;
export type DistanceTypes = number;

/**
* adaptive threshold algorithm
*
* [adaptiveThreshold]
*
*/
export type FloodFillFlags = any;
export type FloodFillFlags = number;

/**
* adaptive threshold algorithm
*
* [adaptiveThreshold]
*
*/
export type GrabCutClasses = any;
export type GrabCutClasses = number;

/**
* adaptive threshold algorithm
*
* [adaptiveThreshold]
*
*/
export type GrabCutModes = any;
export type GrabCutModes = number;

/**
* adaptive threshold algorithm
*
* [adaptiveThreshold]
*
*/
export type ThresholdTypes = any;
export type ThresholdTypes = number;
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 4 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
"sourceMap": true,
"outDir": "./dist",
"rootDir": ".",
"skipLibCheck": true,
"declaration": true
"noEmit": true,
"skipLibCheck": false,
"declaration": true,
"types": [],
},
"include": ["src"]
}