@opencvjs/types 4.10.0-release.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +23 -0
- package/lib/index.d.ts +2 -0
- package/lib/opencv/Affine3.d.ts +206 -0
- package/lib/opencv/Algorithm.d.ts +126 -0
- package/lib/opencv/AutoBuffer.d.ts +50 -0
- package/lib/opencv/BFMatcher.d.ts +37 -0
- package/lib/opencv/BOWTrainer.d.ts +43 -0
- package/lib/opencv/CascadeClassifier.d.ts +153 -0
- package/lib/opencv/DescriptorMatcher.d.ts +236 -0
- package/lib/opencv/DynamicBitset.d.ts +68 -0
- package/lib/opencv/Exception.d.ts +54 -0
- package/lib/opencv/Feature2D.d.ts +20 -0
- package/lib/opencv/FlannBasedMatcher.d.ts +57 -0
- package/lib/opencv/HOGDescriptor.d.ts +401 -0
- package/lib/opencv/Logger.d.ts +34 -0
- package/lib/opencv/LshTable.d.ts +81 -0
- package/lib/opencv/Mat.d.ts +1793 -0
- package/lib/opencv/MatExpr.d.ts +107 -0
- package/lib/opencv/MatOp.d.ts +72 -0
- package/lib/opencv/Matx.d.ts +228 -0
- package/lib/opencv/Node.d.ts +33 -0
- package/lib/opencv/ORB.d.ts +23 -0
- package/lib/opencv/PCA.d.ts +198 -0
- package/lib/opencv/RotatedRect.d.ts +73 -0
- package/lib/opencv/Tracker.d.ts +1 -0
- package/lib/opencv/TrackerMIL.d.ts +3 -0
- package/lib/opencv/_types.d.ts +48 -0
- package/lib/opencv/calib3d.d.ts +2937 -0
- package/lib/opencv/core_array.d.ts +3102 -0
- package/lib/opencv/core_cluster.d.ts +80 -0
- package/lib/opencv/core_hal_interface.d.ts +159 -0
- package/lib/opencv/core_utils.d.ts +748 -0
- package/lib/opencv/dnn.d.ts +505 -0
- package/lib/opencv/features2d_draw.d.ts +114 -0
- package/lib/opencv/fisheye.d.ts +26 -0
- package/lib/opencv/helpers.d.ts +274 -0
- package/lib/opencv/imgproc_color_conversions.d.ts +527 -0
- package/lib/opencv/imgproc_draw.d.ts +732 -0
- package/lib/opencv/imgproc_feature.d.ts +681 -0
- package/lib/opencv/imgproc_filter.d.ts +918 -0
- package/lib/opencv/imgproc_hist.d.ts +399 -0
- package/lib/opencv/imgproc_misc.d.ts +616 -0
- package/lib/opencv/imgproc_object.d.ts +58 -0
- package/lib/opencv/imgproc_shape.d.ts +724 -0
- package/lib/opencv/imgproc_transform.d.ts +574 -0
- package/lib/opencv/missing.d.ts +58 -0
- package/lib/opencv/objdetect.d.ts +103 -0
- package/lib/opencv/photo_inpaint.d.ts +39 -0
- package/lib/opencv/softdouble.d.ts +71 -0
- package/lib/opencv/softfloat.d.ts +71 -0
- package/lib/opencv/video_track.d.ts +370 -0
- package/package.json +18 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,616 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
double,
|
|
3
|
+
InputArray,
|
|
4
|
+
InputOutputArray,
|
|
5
|
+
int,
|
|
6
|
+
OutputArray,
|
|
7
|
+
Point,
|
|
8
|
+
Rect,
|
|
9
|
+
Scalar,
|
|
10
|
+
} from "./_types";
|
|
11
|
+
/*
|
|
12
|
+
* # Miscellaneous Image Transformations
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The function transforms a grayscale image to a binary image according to the formulae:
|
|
17
|
+
*
|
|
18
|
+
* **THRESH_BINARY** `\\[dst(x,y) = \\fork{\\texttt{maxValue}}{if \\(src(x,y) >
|
|
19
|
+
* T(x,y)\\)}{0}{otherwise}\\]`
|
|
20
|
+
* **THRESH_BINARY_INV** `\\[dst(x,y) = \\fork{0}{if \\(src(x,y) >
|
|
21
|
+
* T(x,y)\\)}{\\texttt{maxValue}}{otherwise}\\]` where `$T(x,y)$` is a threshold calculated
|
|
22
|
+
* individually for each pixel (see adaptiveMethod parameter).
|
|
23
|
+
*
|
|
24
|
+
* The function can process the image in-place.
|
|
25
|
+
*
|
|
26
|
+
* [threshold], [blur], [GaussianBlur]
|
|
27
|
+
*
|
|
28
|
+
* @param src Source 8-bit single-channel image.
|
|
29
|
+
*
|
|
30
|
+
* @param dst Destination image of the same size and the same type as src.
|
|
31
|
+
*
|
|
32
|
+
* @param maxValue Non-zero value assigned to the pixels for which the condition is satisfied
|
|
33
|
+
*
|
|
34
|
+
* @param adaptiveMethod Adaptive thresholding algorithm to use, see AdaptiveThresholdTypes. The
|
|
35
|
+
* BORDER_REPLICATE | BORDER_ISOLATED is used to process boundaries.
|
|
36
|
+
*
|
|
37
|
+
* @param thresholdType Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV, see
|
|
38
|
+
* ThresholdTypes.
|
|
39
|
+
*
|
|
40
|
+
* @param blockSize Size of a pixel neighborhood that is used to calculate a threshold value for the
|
|
41
|
+
* pixel: 3, 5, 7, and so on.
|
|
42
|
+
*
|
|
43
|
+
* @param C Constant subtracted from the mean or weighted mean (see the details below). Normally, it is
|
|
44
|
+
* positive but may be zero or negative as well.
|
|
45
|
+
*/
|
|
46
|
+
export declare function adaptiveThreshold(
|
|
47
|
+
src: InputArray,
|
|
48
|
+
dst: OutputArray,
|
|
49
|
+
maxValue: double,
|
|
50
|
+
adaptiveMethod: int,
|
|
51
|
+
thresholdType: int,
|
|
52
|
+
blockSize: int,
|
|
53
|
+
C: double,
|
|
54
|
+
): void;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Performs linear blending of two images: `\\[ \\texttt{dst}(i,j) =
|
|
58
|
+
* \\texttt{weights1}(i,j)*\\texttt{src1}(i,j) + \\texttt{weights2}(i,j)*\\texttt{src2}(i,j) \\]`
|
|
59
|
+
*
|
|
60
|
+
* @param src1 It has a type of CV_8UC(n) or CV_32FC(n), where n is a positive integer.
|
|
61
|
+
*
|
|
62
|
+
* @param src2 It has the same type and size as src1.
|
|
63
|
+
*
|
|
64
|
+
* @param weights1 It has a type of CV_32FC1 and the same size with src1.
|
|
65
|
+
*
|
|
66
|
+
* @param weights2 It has a type of CV_32FC1 and the same size with src1.
|
|
67
|
+
*
|
|
68
|
+
* @param dst It is created if it does not have the same size and type with src1.
|
|
69
|
+
*/
|
|
70
|
+
export declare function blendLinear(
|
|
71
|
+
src1: InputArray,
|
|
72
|
+
src2: InputArray,
|
|
73
|
+
weights1: InputArray,
|
|
74
|
+
weights2: InputArray,
|
|
75
|
+
dst: OutputArray,
|
|
76
|
+
): void;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The function [cv::distanceTransform] calculates the approximate or precise distance from every
|
|
80
|
+
* binary image pixel to the nearest zero pixel. For zero image pixels, the distance will obviously be
|
|
81
|
+
* zero.
|
|
82
|
+
*
|
|
83
|
+
* When maskSize == [DIST_MASK_PRECISE] and distanceType == [DIST_L2] , the function runs the algorithm
|
|
84
|
+
* described in Felzenszwalb04 . This algorithm is parallelized with the TBB library.
|
|
85
|
+
*
|
|
86
|
+
* In other cases, the algorithm Borgefors86 is used. This means that for a pixel the function finds
|
|
87
|
+
* the shortest path to the nearest zero pixel consisting of basic shifts: horizontal, vertical,
|
|
88
|
+
* diagonal, or knight's move (the latest is available for a `$5\\times 5$` mask). The overall distance
|
|
89
|
+
* is calculated as a sum of these basic distances. Since the distance function should be symmetric,
|
|
90
|
+
* all of the horizontal and vertical shifts must have the same cost (denoted as a ), all the diagonal
|
|
91
|
+
* shifts must have the same cost (denoted as `b`), and all knight's moves must have the same cost
|
|
92
|
+
* (denoted as `c`). For the [DIST_C] and [DIST_L1] types, the distance is calculated precisely,
|
|
93
|
+
* whereas for [DIST_L2] (Euclidean distance) the distance can be calculated only with a relative error
|
|
94
|
+
* (a `$5\\times 5$` mask gives more accurate results). For `a`,`b`, and `c`, OpenCV uses the values
|
|
95
|
+
* suggested in the original paper:
|
|
96
|
+
*
|
|
97
|
+
* DIST_L1: `a = 1, b = 2`
|
|
98
|
+
* DIST_L2:
|
|
99
|
+
*
|
|
100
|
+
* `3 x 3`: `a=0.955, b=1.3693`
|
|
101
|
+
* `5 x 5`: `a=1, b=1.4, c=2.1969`
|
|
102
|
+
*
|
|
103
|
+
* DIST_C: `a = 1, b = 1`
|
|
104
|
+
*
|
|
105
|
+
* Typically, for a fast, coarse distance estimation [DIST_L2], a `$3\\times 3$` mask is used. For a
|
|
106
|
+
* more accurate distance estimation [DIST_L2], a `$5\\times 5$` mask or the precise algorithm is used.
|
|
107
|
+
* Note that both the precise and the approximate algorithms are linear on the number of pixels.
|
|
108
|
+
*
|
|
109
|
+
* This variant of the function does not only compute the minimum distance for each pixel `$(x, y)$`
|
|
110
|
+
* but also identifies the nearest connected component consisting of zero pixels
|
|
111
|
+
* (labelType==[DIST_LABEL_CCOMP]) or the nearest zero pixel (labelType==[DIST_LABEL_PIXEL]). Index of
|
|
112
|
+
* the component/pixel is stored in `labels(x, y)`. When labelType==[DIST_LABEL_CCOMP], the function
|
|
113
|
+
* automatically finds connected components of zero pixels in the input image and marks them with
|
|
114
|
+
* distinct labels. When labelType==[DIST_LABEL_CCOMP], the function scans through the input image and
|
|
115
|
+
* marks all the zero pixels with distinct labels.
|
|
116
|
+
*
|
|
117
|
+
* In this mode, the complexity is still linear. That is, the function provides a very fast way to
|
|
118
|
+
* compute the Voronoi diagram for a binary image. Currently, the second variant can use only the
|
|
119
|
+
* approximate distance transform algorithm, i.e. maskSize=[DIST_MASK_PRECISE] is not supported yet.
|
|
120
|
+
*
|
|
121
|
+
* @param src 8-bit, single-channel (binary) source image.
|
|
122
|
+
*
|
|
123
|
+
* @param dst Output image with calculated distances. It is a 8-bit or 32-bit floating-point,
|
|
124
|
+
* single-channel image of the same size as src.
|
|
125
|
+
*
|
|
126
|
+
* @param labels Output 2D array of labels (the discrete Voronoi diagram). It has the type CV_32SC1 and
|
|
127
|
+
* the same size as src.
|
|
128
|
+
*
|
|
129
|
+
* @param distanceType Type of distance, see DistanceTypes
|
|
130
|
+
*
|
|
131
|
+
* @param maskSize Size of the distance transform mask, see DistanceTransformMasks. DIST_MASK_PRECISE
|
|
132
|
+
* is not supported by this variant. In case of the DIST_L1 or DIST_C distance type, the parameter is
|
|
133
|
+
* forced to 3 because a $3\times 3$ mask gives the same result as $5\times 5$ or any larger aperture.
|
|
134
|
+
*
|
|
135
|
+
* @param labelType Type of the label array to build, see DistanceTransformLabelTypes.
|
|
136
|
+
*/
|
|
137
|
+
export declare function distanceTransform(
|
|
138
|
+
src: InputArray,
|
|
139
|
+
dst: OutputArray,
|
|
140
|
+
labels: OutputArray,
|
|
141
|
+
distanceType: int,
|
|
142
|
+
maskSize: int,
|
|
143
|
+
labelType?: int,
|
|
144
|
+
): void;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* This is an overloaded member function, provided for convenience. It differs from the above function
|
|
148
|
+
* only in what argument(s) it accepts.
|
|
149
|
+
*
|
|
150
|
+
* @param src 8-bit, single-channel (binary) source image.
|
|
151
|
+
*
|
|
152
|
+
* @param dst Output image with calculated distances. It is a 8-bit or 32-bit floating-point,
|
|
153
|
+
* single-channel image of the same size as src .
|
|
154
|
+
*
|
|
155
|
+
* @param distanceType Type of distance, see DistanceTypes
|
|
156
|
+
*
|
|
157
|
+
* @param maskSize Size of the distance transform mask, see DistanceTransformMasks. In case of the
|
|
158
|
+
* DIST_L1 or DIST_C distance type, the parameter is forced to 3 because a $3\times 3$ mask gives the
|
|
159
|
+
* same result as $5\times 5$ or any larger aperture.
|
|
160
|
+
*
|
|
161
|
+
* @param dstType Type of output image. It can be CV_8U or CV_32F. Type CV_8U can be used only for the
|
|
162
|
+
* first variant of the function and distanceType == DIST_L1.
|
|
163
|
+
*/
|
|
164
|
+
export declare function distanceTransform(
|
|
165
|
+
src: InputArray,
|
|
166
|
+
dst: OutputArray,
|
|
167
|
+
distanceType: int,
|
|
168
|
+
maskSize: int,
|
|
169
|
+
dstType?: int,
|
|
170
|
+
): void;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* This is an overloaded member function, provided for convenience. It differs from the above function
|
|
174
|
+
* only in what argument(s) it accepts.
|
|
175
|
+
*
|
|
176
|
+
* variant without `mask` parameter
|
|
177
|
+
*/
|
|
178
|
+
export declare function floodFill(
|
|
179
|
+
image: InputOutputArray,
|
|
180
|
+
seedPoint: Point,
|
|
181
|
+
newVal: Scalar,
|
|
182
|
+
rect?: any,
|
|
183
|
+
loDiff?: Scalar,
|
|
184
|
+
upDiff?: Scalar,
|
|
185
|
+
flags?: int,
|
|
186
|
+
): int;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* The function [cv::floodFill] fills a connected component starting from the seed point with the
|
|
190
|
+
* specified color. The connectivity is determined by the color/brightness closeness of the neighbor
|
|
191
|
+
* pixels. The pixel at `$(x,y)$` is considered to belong to the repainted domain if:
|
|
192
|
+
*
|
|
193
|
+
* in case of a grayscale image and floating range `\\[\\texttt{src} (x',y')- \\texttt{loDiff} \\leq
|
|
194
|
+
* \\texttt{src} (x,y) \\leq \\texttt{src} (x',y')+ \\texttt{upDiff}\\]`
|
|
195
|
+
* in case of a grayscale image and fixed range `\\[\\texttt{src} ( \\texttt{seedPoint} .x,
|
|
196
|
+
* \\texttt{seedPoint} .y)- \\texttt{loDiff} \\leq \\texttt{src} (x,y) \\leq \\texttt{src} (
|
|
197
|
+
* \\texttt{seedPoint} .x, \\texttt{seedPoint} .y)+ \\texttt{upDiff}\\]`
|
|
198
|
+
* in case of a color image and floating range `\\[\\texttt{src} (x',y')_r- \\texttt{loDiff} _r \\leq
|
|
199
|
+
* \\texttt{src} (x,y)_r \\leq \\texttt{src} (x',y')_r+ \\texttt{upDiff} _r,\\]` `\\[\\texttt{src}
|
|
200
|
+
* (x',y')_g- \\texttt{loDiff} _g \\leq \\texttt{src} (x,y)_g \\leq \\texttt{src} (x',y')_g+
|
|
201
|
+
* \\texttt{upDiff} _g\\]` and `\\[\\texttt{src} (x',y')_b- \\texttt{loDiff} _b \\leq \\texttt{src}
|
|
202
|
+
* (x,y)_b \\leq \\texttt{src} (x',y')_b+ \\texttt{upDiff} _b\\]`
|
|
203
|
+
* in case of a color image and fixed range `\\[\\texttt{src} ( \\texttt{seedPoint} .x,
|
|
204
|
+
* \\texttt{seedPoint} .y)_r- \\texttt{loDiff} _r \\leq \\texttt{src} (x,y)_r \\leq \\texttt{src} (
|
|
205
|
+
* \\texttt{seedPoint} .x, \\texttt{seedPoint} .y)_r+ \\texttt{upDiff} _r,\\]` `\\[\\texttt{src} (
|
|
206
|
+
* \\texttt{seedPoint} .x, \\texttt{seedPoint} .y)_g- \\texttt{loDiff} _g \\leq \\texttt{src} (x,y)_g
|
|
207
|
+
* \\leq \\texttt{src} ( \\texttt{seedPoint} .x, \\texttt{seedPoint} .y)_g+ \\texttt{upDiff} _g\\]` and
|
|
208
|
+
* `\\[\\texttt{src} ( \\texttt{seedPoint} .x, \\texttt{seedPoint} .y)_b- \\texttt{loDiff} _b \\leq
|
|
209
|
+
* \\texttt{src} (x,y)_b \\leq \\texttt{src} ( \\texttt{seedPoint} .x, \\texttt{seedPoint} .y)_b+
|
|
210
|
+
* \\texttt{upDiff} _b\\]`
|
|
211
|
+
*
|
|
212
|
+
* where `$src(x',y')$` is the value of one of pixel neighbors that is already known to belong to the
|
|
213
|
+
* component. That is, to be added to the connected component, a color/brightness of the pixel should
|
|
214
|
+
* be close enough to:
|
|
215
|
+
*
|
|
216
|
+
* Color/brightness of one of its neighbors that already belong to the connected component in case of a
|
|
217
|
+
* floating range.
|
|
218
|
+
* Color/brightness of the seed point in case of a fixed range.
|
|
219
|
+
*
|
|
220
|
+
* Use these functions to either mark a connected component with the specified color in-place, or build
|
|
221
|
+
* a mask and then extract the contour, or copy the region to another image, and so on.
|
|
222
|
+
*
|
|
223
|
+
* Since the mask is larger than the filled image, a pixel `$(x, y)$` in image corresponds to the pixel
|
|
224
|
+
* `$(x+1, y+1)$` in the mask .
|
|
225
|
+
*
|
|
226
|
+
* [findContours]
|
|
227
|
+
*
|
|
228
|
+
* @param image Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the
|
|
229
|
+
* function unless the FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See the
|
|
230
|
+
* details below.
|
|
231
|
+
*
|
|
232
|
+
* @param mask Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels
|
|
233
|
+
* taller than image. Since this is both an input and output parameter, you must take responsibility of
|
|
234
|
+
* initializing it. Flood-filling cannot go across non-zero pixels in the input mask. For example, an
|
|
235
|
+
* edge detector output can be used as a mask to stop filling at edges. On output, pixels in the mask
|
|
236
|
+
* corresponding to filled pixels in the image are set to 1 or to the a value specified in flags as
|
|
237
|
+
* described below. Additionally, the function fills the border of the mask with ones to simplify
|
|
238
|
+
* internal processing. It is therefore possible to use the same mask in multiple calls to the function
|
|
239
|
+
* to make sure the filled areas do not overlap.
|
|
240
|
+
*
|
|
241
|
+
* @param seedPoint Starting point.
|
|
242
|
+
*
|
|
243
|
+
* @param newVal New value of the repainted domain pixels.
|
|
244
|
+
*
|
|
245
|
+
* @param rect Optional output parameter set by the function to the minimum bounding rectangle of the
|
|
246
|
+
* repainted domain.
|
|
247
|
+
*
|
|
248
|
+
* @param loDiff Maximal lower brightness/color difference between the currently observed pixel and one
|
|
249
|
+
* of its neighbors belonging to the component, or a seed pixel being added to the component.
|
|
250
|
+
*
|
|
251
|
+
* @param upDiff Maximal upper brightness/color difference between the currently observed pixel and one
|
|
252
|
+
* of its neighbors belonging to the component, or a seed pixel being added to the component.
|
|
253
|
+
*
|
|
254
|
+
* @param flags Operation flags. The first 8 bits contain a connectivity value. The default value of 4
|
|
255
|
+
* means that only the four nearest neighbor pixels (those that share an edge) are considered. A
|
|
256
|
+
* connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner)
|
|
257
|
+
* will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill the
|
|
258
|
+
* mask (the default value is 1). For example, 4 | ( 255 << 8 ) will consider 4 nearest neighbours and
|
|
259
|
+
* fill the mask with a value of 255. The following additional options occupy higher bits and therefore
|
|
260
|
+
* may be further combined with the connectivity and mask fill values using bit-wise or (|), see
|
|
261
|
+
* FloodFillFlags.
|
|
262
|
+
*/
|
|
263
|
+
export declare function floodFill(
|
|
264
|
+
image: InputOutputArray,
|
|
265
|
+
mask: InputOutputArray,
|
|
266
|
+
seedPoint: Point,
|
|
267
|
+
newVal: Scalar,
|
|
268
|
+
rect?: any,
|
|
269
|
+
loDiff?: Scalar,
|
|
270
|
+
upDiff?: Scalar,
|
|
271
|
+
flags?: int,
|
|
272
|
+
): int;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* The function implements the .
|
|
276
|
+
*
|
|
277
|
+
* @param img Input 8-bit 3-channel image.
|
|
278
|
+
*
|
|
279
|
+
* @param mask Input/output 8-bit single-channel mask. The mask is initialized by the function when
|
|
280
|
+
* mode is set to GC_INIT_WITH_RECT. Its elements may have one of the GrabCutClasses.
|
|
281
|
+
*
|
|
282
|
+
* @param rect ROI containing a segmented object. The pixels outside of the ROI are marked as "obvious
|
|
283
|
+
* background". The parameter is only used when mode==GC_INIT_WITH_RECT .
|
|
284
|
+
*
|
|
285
|
+
* @param bgdModel Temporary array for the background model. Do not modify it while you are processing
|
|
286
|
+
* the same image.
|
|
287
|
+
*
|
|
288
|
+
* @param fgdModel Temporary arrays for the foreground model. Do not modify it while you are processing
|
|
289
|
+
* the same image.
|
|
290
|
+
*
|
|
291
|
+
* @param iterCount Number of iterations the algorithm should make before returning the result. Note
|
|
292
|
+
* that the result can be refined with further calls with mode==GC_INIT_WITH_MASK or mode==GC_EVAL .
|
|
293
|
+
*
|
|
294
|
+
* @param mode Operation mode that could be one of the GrabCutModes
|
|
295
|
+
*/
|
|
296
|
+
export declare function grabCut(
|
|
297
|
+
img: InputArray,
|
|
298
|
+
mask: InputOutputArray,
|
|
299
|
+
rect: Rect,
|
|
300
|
+
bgdModel: InputOutputArray,
|
|
301
|
+
fgdModel: InputOutputArray,
|
|
302
|
+
iterCount: int,
|
|
303
|
+
mode?: int,
|
|
304
|
+
): void;
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* This is an overloaded member function, provided for convenience. It differs from the above function
|
|
308
|
+
* only in what argument(s) it accepts.
|
|
309
|
+
*/
|
|
310
|
+
export declare function integral(
|
|
311
|
+
src: InputArray,
|
|
312
|
+
sum: OutputArray,
|
|
313
|
+
sdepth?: int,
|
|
314
|
+
): void;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* This is an overloaded member function, provided for convenience. It differs from the above function
|
|
318
|
+
* only in what argument(s) it accepts.
|
|
319
|
+
*/
|
|
320
|
+
export declare function integral(
|
|
321
|
+
src: InputArray,
|
|
322
|
+
sum: OutputArray,
|
|
323
|
+
sqsum: OutputArray,
|
|
324
|
+
sdepth?: int,
|
|
325
|
+
sqdepth?: int,
|
|
326
|
+
): void;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* The function calculates one or more integral images for the source image as follows:
|
|
330
|
+
*
|
|
331
|
+
* `\\[\\texttt{sum} (X,Y) = \\sum _{x<X,y<Y} \\texttt{image} (x,y)\\]`
|
|
332
|
+
*
|
|
333
|
+
* `\\[\\texttt{sqsum} (X,Y) = \\sum _{x<X,y<Y} \\texttt{image} (x,y)^2\\]`
|
|
334
|
+
*
|
|
335
|
+
* `\\[\\texttt{tilted} (X,Y) = \\sum _{y<Y,abs(x-X+1) \\leq Y-y-1} \\texttt{image} (x,y)\\]`
|
|
336
|
+
*
|
|
337
|
+
* Using these integral images, you can calculate sum, mean, and standard deviation over a specific
|
|
338
|
+
* up-right or rotated rectangular region of the image in a constant time, for example:
|
|
339
|
+
*
|
|
340
|
+
* `\\[\\sum _{x_1 \\leq x < x_2, \\, y_1 \\leq y < y_2} \\texttt{image} (x,y) = \\texttt{sum}
|
|
341
|
+
* (x_2,y_2)- \\texttt{sum} (x_1,y_2)- \\texttt{sum} (x_2,y_1)+ \\texttt{sum} (x_1,y_1)\\]`
|
|
342
|
+
*
|
|
343
|
+
* It makes possible to do a fast blurring or fast block correlation with a variable window size, for
|
|
344
|
+
* example. In case of multi-channel images, sums for each channel are accumulated independently.
|
|
345
|
+
*
|
|
346
|
+
* As a practical example, the next figure shows the calculation of the integral of a straight
|
|
347
|
+
* rectangle Rect(3,3,3,2) and of a tilted rectangle Rect(5,1,2,3) . The selected pixels in the
|
|
348
|
+
* original image are shown, as well as the relative pixels in the integral images sum and tilted .
|
|
349
|
+
*
|
|
350
|
+
* @param src input image as $W \times H$, 8-bit or floating-point (32f or 64f).
|
|
351
|
+
*
|
|
352
|
+
* @param sum integral image as $(W+1)\times (H+1)$ , 32-bit integer or floating-point (32f or 64f).
|
|
353
|
+
*
|
|
354
|
+
* @param sqsum integral image for squared pixel values; it is $(W+1)\times (H+1)$, double-precision
|
|
355
|
+
* floating-point (64f) array.
|
|
356
|
+
*
|
|
357
|
+
* @param tilted integral for the image rotated by 45 degrees; it is $(W+1)\times (H+1)$ array with the
|
|
358
|
+
* same data type as sum.
|
|
359
|
+
*
|
|
360
|
+
* @param sdepth desired depth of the integral and the tilted integral images, CV_32S, CV_32F, or
|
|
361
|
+
* CV_64F.
|
|
362
|
+
*
|
|
363
|
+
* @param sqdepth desired depth of the integral image of squared pixel values, CV_32F or CV_64F.
|
|
364
|
+
*/
|
|
365
|
+
export declare function integral(
|
|
366
|
+
src: InputArray,
|
|
367
|
+
sum: OutputArray,
|
|
368
|
+
sqsum: OutputArray,
|
|
369
|
+
tilted: OutputArray,
|
|
370
|
+
sdepth?: int,
|
|
371
|
+
sqdepth?: int,
|
|
372
|
+
): void;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* The function applies fixed-level thresholding to a multiple-channel array. The function is typically
|
|
376
|
+
* used to get a bi-level (binary) image out of a grayscale image ( [compare] could be also used for
|
|
377
|
+
* this purpose) or for removing a noise, that is, filtering out pixels with too small or too large
|
|
378
|
+
* values. There are several types of thresholding supported by the function. They are determined by
|
|
379
|
+
* type parameter.
|
|
380
|
+
*
|
|
381
|
+
* Also, the special values [THRESH_OTSU] or [THRESH_TRIANGLE] may be combined with one of the above
|
|
382
|
+
* values. In these cases, the function determines the optimal threshold value using the Otsu's or
|
|
383
|
+
* Triangle algorithm and uses it instead of the specified thresh.
|
|
384
|
+
*
|
|
385
|
+
* Currently, the Otsu's and Triangle methods are implemented only for 8-bit single-channel images.
|
|
386
|
+
*
|
|
387
|
+
* the computed threshold value if Otsu's or Triangle methods used.
|
|
388
|
+
*
|
|
389
|
+
* [adaptiveThreshold], [findContours], [compare], [min], [max]
|
|
390
|
+
*
|
|
391
|
+
* @param src input array (multiple-channel, 8-bit or 32-bit floating point).
|
|
392
|
+
*
|
|
393
|
+
* @param dst output array of the same size and type and the same number of channels as src.
|
|
394
|
+
*
|
|
395
|
+
* @param thresh threshold value.
|
|
396
|
+
*
|
|
397
|
+
* @param maxval maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding types.
|
|
398
|
+
*
|
|
399
|
+
* @param type thresholding type (see ThresholdTypes).
|
|
400
|
+
*/
|
|
401
|
+
export declare function threshold(
|
|
402
|
+
src: InputArray,
|
|
403
|
+
dst: OutputArray,
|
|
404
|
+
thresh: double,
|
|
405
|
+
maxval: double,
|
|
406
|
+
type: int,
|
|
407
|
+
): double;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* The function implements one of the variants of watershed, non-parametric marker-based segmentation
|
|
411
|
+
* algorithm, described in Meyer92 .
|
|
412
|
+
*
|
|
413
|
+
* Before passing the image to the function, you have to roughly outline the desired regions in the
|
|
414
|
+
* image markers with positive (>0) indices. So, every region is represented as one or more connected
|
|
415
|
+
* components with the pixel values 1, 2, 3, and so on. Such markers can be retrieved from a binary
|
|
416
|
+
* mask using [findContours] and [drawContours] (see the watershed.cpp demo). The markers are "seeds"
|
|
417
|
+
* of the future image regions. All the other pixels in markers , whose relation to the outlined
|
|
418
|
+
* regions is not known and should be defined by the algorithm, should be set to 0's. In the function
|
|
419
|
+
* output, each pixel in markers is set to a value of the "seed" components or to -1 at boundaries
|
|
420
|
+
* between the regions.
|
|
421
|
+
*
|
|
422
|
+
* Any two neighbor connected components are not necessarily separated by a watershed boundary (-1's
|
|
423
|
+
* pixels); for example, they can touch each other in the initial marker image passed to the function.
|
|
424
|
+
*
|
|
425
|
+
* [findContours]
|
|
426
|
+
*
|
|
427
|
+
* @param image Input 8-bit 3-channel image.
|
|
428
|
+
*
|
|
429
|
+
* @param markers Input/output 32-bit single-channel image (map) of markers. It should have the same
|
|
430
|
+
* size as image .
|
|
431
|
+
*/
|
|
432
|
+
export declare function watershed(
|
|
433
|
+
image: InputArray,
|
|
434
|
+
markers: InputOutputArray,
|
|
435
|
+
): void;
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* the threshold value `$T(x,y)$` is a mean of the `$\\texttt{blockSize} \\times \\texttt{blockSize}$`
|
|
439
|
+
* neighborhood of `$(x, y)$` minus C
|
|
440
|
+
*
|
|
441
|
+
*/
|
|
442
|
+
export declare const ADAPTIVE_THRESH_MEAN_C: AdaptiveThresholdTypes; // initializer: = 0
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* the threshold value `$T(x, y)$` is a weighted sum (cross-correlation with a Gaussian window) of the
|
|
446
|
+
* `$\\texttt{blockSize} \\times \\texttt{blockSize}$` neighborhood of `$(x, y)$` minus C . The default
|
|
447
|
+
* sigma (standard deviation) is used for the specified blockSize . See [getGaussianKernel]
|
|
448
|
+
*
|
|
449
|
+
*/
|
|
450
|
+
export declare const ADAPTIVE_THRESH_GAUSSIAN_C: AdaptiveThresholdTypes; // initializer: = 1
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* each connected component of zeros in src (as well as all the non-zero pixels closest to the
|
|
454
|
+
* connected component) will be assigned the same label
|
|
455
|
+
*
|
|
456
|
+
*/
|
|
457
|
+
export declare const DIST_LABEL_CCOMP: DistanceTransformLabelTypes; // initializer: = 0
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* each zero pixel (and all the non-zero pixels closest to it) gets its own label.
|
|
461
|
+
*
|
|
462
|
+
*/
|
|
463
|
+
export declare const DIST_LABEL_PIXEL: DistanceTransformLabelTypes; // initializer: = 1
|
|
464
|
+
|
|
465
|
+
export declare const DIST_MASK_3: DistanceTransformMasks; // initializer: = 3
|
|
466
|
+
|
|
467
|
+
export declare const DIST_MASK_5: DistanceTransformMasks; // initializer: = 5
|
|
468
|
+
|
|
469
|
+
export declare const DIST_MASK_PRECISE: DistanceTransformMasks; // initializer: = 0
|
|
470
|
+
|
|
471
|
+
export declare const DIST_USER: DistanceTypes; // initializer: = -1
|
|
472
|
+
|
|
473
|
+
export declare const DIST_L1: DistanceTypes; // initializer: = 1
|
|
474
|
+
|
|
475
|
+
export declare const DIST_L2: DistanceTypes; // initializer: = 2
|
|
476
|
+
|
|
477
|
+
export declare const DIST_C: DistanceTypes; // initializer: = 3
|
|
478
|
+
|
|
479
|
+
export declare const DIST_L12: DistanceTypes; // initializer: = 4
|
|
480
|
+
|
|
481
|
+
export declare const DIST_FAIR: DistanceTypes; // initializer: = 5
|
|
482
|
+
|
|
483
|
+
export declare const DIST_WELSCH: DistanceTypes; // initializer: = 6
|
|
484
|
+
|
|
485
|
+
export declare const DIST_HUBER: DistanceTypes; // initializer: = 7
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* If set, the difference between the current pixel and seed pixel is considered. Otherwise, the
|
|
489
|
+
* difference between neighbor pixels is considered (that is, the range is floating).
|
|
490
|
+
*
|
|
491
|
+
*/
|
|
492
|
+
export declare const FLOODFILL_FIXED_RANGE: FloodFillFlags; // initializer: = 1 << 16
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* If set, the function does not change the image ( newVal is ignored), and only fills the mask with
|
|
496
|
+
* the value specified in bits 8-16 of flags as described above. This option only make sense in
|
|
497
|
+
* function variants that have the mask parameter.
|
|
498
|
+
*
|
|
499
|
+
*/
|
|
500
|
+
export declare const FLOODFILL_MASK_ONLY: FloodFillFlags; // initializer: = 1 << 17
|
|
501
|
+
|
|
502
|
+
export declare const GC_BGD: GrabCutClasses; // initializer: = 0
|
|
503
|
+
|
|
504
|
+
export declare const GC_FGD: GrabCutClasses; // initializer: = 1
|
|
505
|
+
|
|
506
|
+
export declare const GC_PR_BGD: GrabCutClasses; // initializer: = 2
|
|
507
|
+
|
|
508
|
+
export declare const GC_PR_FGD: GrabCutClasses; // initializer: = 3
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* The function initializes the state and the mask using the provided rectangle. After that it runs
|
|
512
|
+
* iterCount iterations of the algorithm.
|
|
513
|
+
*
|
|
514
|
+
*/
|
|
515
|
+
export declare const GC_INIT_WITH_RECT: GrabCutModes; // initializer: = 0
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* The function initializes the state using the provided mask. Note that GC_INIT_WITH_RECT and
|
|
519
|
+
* GC_INIT_WITH_MASK can be combined. Then, all the pixels outside of the ROI are automatically
|
|
520
|
+
* initialized with GC_BGD .
|
|
521
|
+
*
|
|
522
|
+
*/
|
|
523
|
+
export declare const GC_INIT_WITH_MASK: GrabCutModes; // initializer: = 1
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* The value means that the algorithm should just resume.
|
|
527
|
+
*
|
|
528
|
+
*/
|
|
529
|
+
export declare const GC_EVAL: GrabCutModes; // initializer: = 2
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* The value means that the algorithm should just run the grabCut algorithm (a single iteration) with
|
|
533
|
+
* the fixed model
|
|
534
|
+
*
|
|
535
|
+
*/
|
|
536
|
+
export declare const GC_EVAL_FREEZE_MODEL: GrabCutModes; // initializer: = 3
|
|
537
|
+
|
|
538
|
+
export declare const THRESH_BINARY: ThresholdTypes; // initializer: = 0
|
|
539
|
+
|
|
540
|
+
export declare const THRESH_BINARY_INV: ThresholdTypes; // initializer: = 1
|
|
541
|
+
|
|
542
|
+
export declare const THRESH_TRUNC: ThresholdTypes; // initializer: = 2
|
|
543
|
+
|
|
544
|
+
export declare const THRESH_TOZERO: ThresholdTypes; // initializer: = 3
|
|
545
|
+
|
|
546
|
+
export declare const THRESH_TOZERO_INV: ThresholdTypes; // initializer: = 4
|
|
547
|
+
|
|
548
|
+
export declare const THRESH_MASK: ThresholdTypes; // initializer: = 7
|
|
549
|
+
|
|
550
|
+
export declare const THRESH_OTSU: ThresholdTypes; // initializer: = 8
|
|
551
|
+
|
|
552
|
+
export declare const THRESH_TRIANGLE: ThresholdTypes; // initializer: = 16
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* adaptive threshold algorithm
|
|
556
|
+
*
|
|
557
|
+
* [adaptiveThreshold]
|
|
558
|
+
*
|
|
559
|
+
*/
|
|
560
|
+
export type AdaptiveThresholdTypes = any;
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* adaptive threshold algorithm
|
|
564
|
+
*
|
|
565
|
+
* [adaptiveThreshold]
|
|
566
|
+
*
|
|
567
|
+
*/
|
|
568
|
+
export type DistanceTransformLabelTypes = any;
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* adaptive threshold algorithm
|
|
572
|
+
*
|
|
573
|
+
* [adaptiveThreshold]
|
|
574
|
+
*
|
|
575
|
+
*/
|
|
576
|
+
export type DistanceTransformMasks = any;
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* adaptive threshold algorithm
|
|
580
|
+
*
|
|
581
|
+
* [adaptiveThreshold]
|
|
582
|
+
*
|
|
583
|
+
*/
|
|
584
|
+
export type DistanceTypes = any;
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* adaptive threshold algorithm
|
|
588
|
+
*
|
|
589
|
+
* [adaptiveThreshold]
|
|
590
|
+
*
|
|
591
|
+
*/
|
|
592
|
+
export type FloodFillFlags = any;
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* adaptive threshold algorithm
|
|
596
|
+
*
|
|
597
|
+
* [adaptiveThreshold]
|
|
598
|
+
*
|
|
599
|
+
*/
|
|
600
|
+
export type GrabCutClasses = any;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* adaptive threshold algorithm
|
|
604
|
+
*
|
|
605
|
+
* [adaptiveThreshold]
|
|
606
|
+
*
|
|
607
|
+
*/
|
|
608
|
+
export type GrabCutModes = any;
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* adaptive threshold algorithm
|
|
612
|
+
*
|
|
613
|
+
* [adaptiveThreshold]
|
|
614
|
+
*
|
|
615
|
+
*/
|
|
616
|
+
export type ThresholdTypes = any;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { InputArray, int, OutputArray } from "./_types";
|
|
2
|
+
/*
|
|
3
|
+
* # Object Detection
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The function slides through image , compares the overlapped patches of size `$w \\times h$` against
|
|
8
|
+
* templ using the specified method and stores the comparison results in result . Here are the formulae
|
|
9
|
+
* for the available comparison methods ( `$I$` denotes image, `$T$` template, `$R$` result ). The
|
|
10
|
+
* summation is done over template and/or the image patch: `$x' = 0...w-1, y' = 0...h-1$`
|
|
11
|
+
*
|
|
12
|
+
* After the function finishes the comparison, the best matches can be found as global minimums (when
|
|
13
|
+
* [TM_SQDIFF] was used) or maximums (when [TM_CCORR] or [TM_CCOEFF] was used) using the [minMaxLoc]
|
|
14
|
+
* function. In case of a color image, template summation in the numerator and each sum in the
|
|
15
|
+
* denominator is done over all of the channels and separate mean values are used for each channel.
|
|
16
|
+
* That is, the function can take a color template and a color image. The result will still be a
|
|
17
|
+
* single-channel image, which is easier to analyze.
|
|
18
|
+
*
|
|
19
|
+
* @param image Image where the search is running. It must be 8-bit or 32-bit floating-point.
|
|
20
|
+
*
|
|
21
|
+
* @param templ Searched template. It must be not greater than the source image and have the same data
|
|
22
|
+
* type.
|
|
23
|
+
*
|
|
24
|
+
* @param result Map of comparison results. It must be single-channel 32-bit floating-point. If image
|
|
25
|
+
* is $W \times H$ and templ is $w \times h$ , then result is $(W-w+1) \times (H-h+1)$ .
|
|
26
|
+
*
|
|
27
|
+
* @param method Parameter specifying the comparison method, see TemplateMatchModes
|
|
28
|
+
*
|
|
29
|
+
* @param mask Mask of searched template. It must have the same datatype and size with templ. It is not
|
|
30
|
+
* set by default. Currently, only the TM_SQDIFF and TM_CCORR_NORMED methods are supported.
|
|
31
|
+
*/
|
|
32
|
+
export declare function matchTemplate(
|
|
33
|
+
image: InputArray,
|
|
34
|
+
templ: InputArray,
|
|
35
|
+
result: OutputArray,
|
|
36
|
+
method: int,
|
|
37
|
+
mask?: InputArray,
|
|
38
|
+
): void;
|
|
39
|
+
|
|
40
|
+
export declare const TM_SQDIFF: TemplateMatchModes; // initializer: = 0
|
|
41
|
+
|
|
42
|
+
export declare const TM_SQDIFF_NORMED: TemplateMatchModes; // initializer: = 1
|
|
43
|
+
|
|
44
|
+
export declare const TM_CCORR: TemplateMatchModes; // initializer: = 2
|
|
45
|
+
|
|
46
|
+
export declare const TM_CCORR_NORMED: TemplateMatchModes; // initializer: = 3
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* `\\[R(x,y)= \\sum _{x',y'} (T'(x',y') \\cdot I'(x+x',y+y'))\\]` where `\\[\\begin{array}{l}
|
|
50
|
+
* T'(x',y')=T(x',y') - 1/(w \\cdot h) \\cdot \\sum _{x'',y''} T(x'',y'') \\\\
|
|
51
|
+
* I'(x+x',y+y')=I(x+x',y+y') - 1/(w \\cdot h) \\cdot \\sum _{x'',y''} I(x+x'',y+y'') \\end{array}\\]`
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
export declare const TM_CCOEFF: TemplateMatchModes; // initializer: = 4
|
|
55
|
+
|
|
56
|
+
export declare const TM_CCOEFF_NORMED: TemplateMatchModes; // initializer: = 5
|
|
57
|
+
|
|
58
|
+
export type TemplateMatchModes = any;
|