Skip to content

Commit 18e2a44

Browse files
committed
Completed cv2.Error and cv2.error types
1 parent 0aa15dd commit 18e2a44

File tree

2 files changed

+120
-1
lines changed

2 files changed

+120
-1
lines changed

cv2/Error.pyi

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
BadAlign = -21
2+
BAD_ALIGN = -21
3+
BadAlphaChannel = -18
4+
BAD_ALPHA_CHANNEL = -18
5+
BadCOI = -24
6+
BAD_COI = -24
7+
BadCallBack = -22
8+
BAD_CALL_BACK = -22
9+
BadDataPtr = -12
10+
BAD_DATA_PTR = -12
11+
BadDepth = -17
12+
BAD_DEPTH = -17
13+
BadImageSize = -10
14+
BAD_IMAGE_SIZE = -10
15+
BadModelOrChSeq = -14
16+
BAD_MODEL_OR_CH_SEQ = -14
17+
BadNumChannel1U = -16
18+
BAD_NUM_CHANNEL1U = -16
19+
BadNumChannels = -15
20+
BAD_NUM_CHANNELS = -15
21+
BadOffset = -11
22+
BAD_OFFSET = -11
23+
BadOrder = -19
24+
BAD_ORDER = -19
25+
BadOrigin = -20
26+
BAD_ORIGIN = -20
27+
BadROISize = -25
28+
BAD_ROISIZE = -25
29+
BadStep = -13
30+
BAD_STEP = -13
31+
BadTileSize = -23
32+
BAD_TILE_SIZE = -23
33+
GpuApiCallError = -217
34+
GPU_API_CALL_ERROR = -217
35+
GpuNotSupported = -216
36+
GPU_NOT_SUPPORTED = -216
37+
HeaderIsNull = -9
38+
HEADER_IS_NULL = -9
39+
MaskIsTiled = -26
40+
MASK_IS_TILED = -26
41+
OpenCLApiCallError = -220
42+
OPEN_CLAPI_CALL_ERROR = -220
43+
OpenCLDoubleNotSupported = -221
44+
OPEN_CLDOUBLE_NOT_SUPPORTED = -221
45+
OpenCLInitError = -222
46+
OPEN_CLINIT_ERROR = -222
47+
OpenCLNoAMDBlasFft = -223
48+
OPEN_CLNO_AMDBLAS_FFT = -223
49+
OpenGlApiCallError = -219
50+
OPEN_GL_API_CALL_ERROR = -219
51+
OpenGlNotSupported = -218
52+
OPEN_GL_NOT_SUPPORTED = -218
53+
StsAssert = -215
54+
STS_ASSERT = -215
55+
StsAutoTrace = -8
56+
STS_AUTO_TRACE = -8
57+
StsBackTrace = -1
58+
STS_BACK_TRACE = -1
59+
StsBadArg = -5
60+
STS_BAD_ARG = -5
61+
StsBadFlag = -206
62+
STS_BAD_FLAG = -206
63+
StsBadFunc = -6
64+
STS_BAD_FUNC = -6
65+
StsBadMask = -208
66+
STS_BAD_MASK = -208
67+
StsBadMemBlock = -214
68+
STS_BAD_MEM_BLOCK = -214
69+
StsBadPoint = -207
70+
STS_BAD_POINT = -207
71+
StsBadSize = -201
72+
STS_BAD_SIZE = -201
73+
StsDivByZero = -202
74+
STS_DIV_BY_ZERO = -202
75+
StsError = -2
76+
STS_ERROR = -2
77+
StsFilterOffsetErr = -31
78+
STS_FILTER_OFFSET_ERR = -31
79+
StsFilterStructContentErr = -29
80+
STS_FILTER_STRUCT_CONTENT_ERR = -29
81+
StsInplaceNotSupported = -203
82+
STS_INPLACE_NOT_SUPPORTED = -203
83+
StsInternal = -3
84+
STS_INTERNAL = -3
85+
StsKernelStructContentErr = -30
86+
STS_KERNEL_STRUCT_CONTENT_ERR = -30
87+
StsNoConv = -7
88+
STS_NO_CONV = -7
89+
StsNoMem = -4
90+
STS_NO_MEM = -4
91+
StsNotImplemented = -213
92+
STS_NOT_IMPLEMENTED = -213
93+
StsNullPtr = -27
94+
STS_NULL_PTR = -27
95+
StsObjectNotFound = -204
96+
STS_OBJECT_NOT_FOUND = -204
97+
StsOk = 0 # noqa: Y015
98+
STS_OK = 0 # noqa: Y015
99+
StsOutOfRange = -211
100+
STS_OUT_OF_RANGE = -211
101+
StsParseError = -212
102+
STS_PARSE_ERROR = -212
103+
StsUnmatchedFormats = -205
104+
STS_UNMATCHED_FORMATS = -205
105+
StsUnmatchedSizes = -209
106+
STS_UNMATCHED_SIZES = -209
107+
StsUnsupportedFormat = -210
108+
STS_UNSUPPORTED_FORMAT = -210
109+
StsVecLengthErr = -28
110+
STS_VEC_LENGTH_ERR = -28

cv2/__init__.pyi

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import typing
55
import builtins as _mod_builtins
66
import cv2 as _mod_cv2
77
import numpy as np
8+
import cv2.Error as Error
9+
__all__ = ["Error"]
810

911
Mat = np.ndarray[int, np.dtype[np.generic]]
1012

@@ -2222,7 +2224,14 @@ def erode(src: Mat, kernel, dts: Mat = ..., anchor=..., iterations=..., borderTy
22222224
"erode(src, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]]) -> dst\n. @brief Erodes an image by using a specific structuring element.\n. \n. The function erodes the source image using the specified structuring element that determines the\n. shape of a pixel neighborhood over which the minimum is taken:\n. \n. \\f[\\texttt{dst} (x,y) = \\min _{(x',y'): \\, \\texttt{element} (x',y') \\ne0 } \\texttt{src} (x+x',y+y')\\f]\n. \n. The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In\n. case of multi-channel images, each channel is processed independently.\n. \n. @param src input image; the number of channels can be arbitrary, but the depth should be one of\n. CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.\n. @param dst output image of the same size and type as src.\n. @param kernel structuring element used for erosion; if `element=Mat()`, a `3 x 3` rectangular\n. structuring element is used. Kernel can be created using #getStructuringElement.\n. @param anchor position of the anchor within the element; default value (-1, -1) means that the\n. anchor is at the element center.\n. @param iterations number of times erosion is applied.\n. @param borderType pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.\n. @param borderValue border value in case of a constant border\n. @sa dilate, morphologyEx, getStructuringElement"
22232225
...
22242226

2225-
error = _mod_cv2.error
2227+
class error(Exception):
2228+
code: int
2229+
err: str
2230+
file: str
2231+
func: str
2232+
line: int
2233+
msg: str
2234+
22262235
def estimateAffine2D(from_, to, inliers=..., method: int = ..., ransacReprojThreshold=..., maxIters=..., confidence=..., refineIters=...) -> typing.Any:
22272236
'estimateAffine2D(from, to[, inliers[, method[, ransacReprojThreshold[, maxIters[, confidence[, refineIters]]]]]]) -> retval, inliers\n. @brief Computes an optimal affine transformation between two 2D point sets.\n. \n. It computes\n. \\f[\n. \\begin{bmatrix}\n. x\\\\\n. y\\\\\n. \\end{bmatrix}\n. =\n. \\begin{bmatrix}\n. a_{11} & a_{12}\\\\\n. a_{21} & a_{22}\\\\\n. \\end{bmatrix}\n. \\begin{bmatrix}\n. X\\\\\n. Y\\\\\n. \\end{bmatrix}\n. +\n. \\begin{bmatrix}\n. b_1\\\\\n. b_2\\\\\n. \\end{bmatrix}\n. \\f]\n. \n. @param from First input 2D point set containing \\f$(X,Y)\\f$.\n. @param to Second input 2D point set containing \\f$(x,y)\\f$.\n. @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).\n. @param method Robust method used to compute transformation. The following methods are possible:\n. - cv::RANSAC - RANSAC-based robust method\n. - cv::LMEDS - Least-Median robust method\n. RANSAC is the default method.\n. @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider\n. a point as an inlier. Applies only to RANSAC.\n. @param maxIters The maximum number of robust method iterations.\n. @param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything\n. between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation\n. significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.\n. @param refineIters Maximum number of iterations of refining algorithm (Levenberg-Marquardt).\n. Passing 0 will disable refining, so the output matrix will be output of robust method.\n. \n. @return Output 2D affine transformation matrix \\f$2 \\times 3\\f$ or empty matrix if transformation\n. could not be estimated. The returned matrix has the following form:\n. \\f[\n. \\begin{bmatrix}\n. a_{11} & a_{12} & b_1\\\\\n. a_{21} & a_{22} & b_2\\\\\n. \\end{bmatrix}\n. \\f]\n. \n. The function estimates an optimal 2D affine transformation between two 2D point sets using the\n. selected robust algorithm.\n. \n. The computed transformation is then refined further (using only inliers) with the\n. Levenberg-Marquardt method to reduce the re-projection error even more.\n. \n. @note\n. The RANSAC method can handle practically any ratio of outliers but needs a threshold to\n. distinguish inliers from outliers. The method LMeDS does not need any threshold but it works\n. correctly only when there are more than 50% of inliers.\n. \n. @sa estimateAffinePartial2D, getAffineTransform'
22282237
...

0 commit comments

Comments
 (0)