feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake
1.项目后端整体迁移至PaddleOCR-NCNN算法,已通过基本的兼容性测试 2.工程改为使用CMake组织,后续为了更好地兼容第三方库,不再提供QMake工程 3.重整权利声明文件,重整代码工程,确保最小化侵权风险 Log: 切换后端至PaddleOCR-NCNN,切换工程为CMake Change-Id: I4d5d2c5d37505a4a24b389b1a4c5d12f17bfa38c
This commit is contained in:
68
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/common/Moments.h
vendored
Normal file
68
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/common/Moments.h
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
//
|
||||
// Moments.h
|
||||
//
|
||||
// Created by Giles Payne on 2019/10/06.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv2/core.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
CV_EXPORTS @interface Moments : NSObject
|
||||
|
||||
@property double m00;
|
||||
@property double m10;
|
||||
@property double m01;
|
||||
@property double m20;
|
||||
@property double m11;
|
||||
@property double m02;
|
||||
@property double m30;
|
||||
@property double m21;
|
||||
@property double m12;
|
||||
@property double m03;
|
||||
|
||||
@property double mu20;
|
||||
@property double mu11;
|
||||
@property double mu02;
|
||||
@property double mu30;
|
||||
@property double mu21;
|
||||
@property double mu12;
|
||||
@property double mu03;
|
||||
|
||||
@property double nu20;
|
||||
@property double nu11;
|
||||
@property double nu02;
|
||||
@property double nu30;
|
||||
@property double nu21;
|
||||
@property double nu12;
|
||||
@property double nu03;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@property(readonly) cv::Moments& nativeRef;
|
||||
#endif
|
||||
|
||||
-(instancetype)initWithM00:(double)m00 m10:(double)m10 m01:(double)m01 m20:(double)m20 m11:(double)m11 m02:(double)m02 m30:(double)m30 m21:(double)m21 m12:(double)m12 m03:(double)m03;
|
||||
|
||||
-(instancetype)init;
|
||||
|
||||
-(instancetype)initWithVals:(NSArray<NSNumber*>*)vals;
|
||||
|
||||
#ifdef __cplusplus
|
||||
+(instancetype)fromNative:(cv::Moments&)moments;
|
||||
#endif
|
||||
|
||||
-(void)set:(NSArray<NSNumber*>*)vals;
|
||||
-(void)completeState;
|
||||
-(NSString *)description;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
304
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/common/Moments.mm
vendored
Normal file
304
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/common/Moments.mm
vendored
Normal file
@ -0,0 +1,304 @@
|
||||
//
|
||||
// Moments.mm
|
||||
//
|
||||
// Created by Giles Payne on 2019/10/09.
|
||||
//
|
||||
|
||||
#import "Moments.h"
|
||||
|
||||
@implementation Moments {
|
||||
cv::Moments native;
|
||||
}
|
||||
|
||||
-(cv::Moments&)nativeRef {
|
||||
return native;
|
||||
}
|
||||
|
||||
- (double)m00 {
|
||||
return native.m00;
|
||||
}
|
||||
|
||||
- (void)setM00:(double)val {
|
||||
native.m00 = val;
|
||||
}
|
||||
|
||||
- (double)m10 {
|
||||
return native.m10;
|
||||
}
|
||||
|
||||
- (void)setM10:(double)val {
|
||||
native.m10 = val;
|
||||
}
|
||||
|
||||
- (double)m01 {
|
||||
return native.m01;
|
||||
}
|
||||
|
||||
- (void)setM01:(double)val {
|
||||
native.m01 = val;
|
||||
}
|
||||
|
||||
- (double)m20 {
|
||||
return native.m20;
|
||||
}
|
||||
|
||||
- (void)setM20:(double)val {
|
||||
native.m20 = val;
|
||||
}
|
||||
|
||||
- (double)m11 {
|
||||
return native.m11;
|
||||
}
|
||||
|
||||
- (void)setM11:(double)val {
|
||||
native.m11 = val;
|
||||
}
|
||||
|
||||
- (double)m02 {
|
||||
return native.m02;
|
||||
}
|
||||
|
||||
- (void)setM02:(double)val {
|
||||
native.m02 = val;
|
||||
}
|
||||
|
||||
- (double)m30 {
|
||||
return native.m30;
|
||||
}
|
||||
|
||||
- (void)setM30:(double)val {
|
||||
native.m30 = val;
|
||||
}
|
||||
|
||||
- (double)m21 {
|
||||
return native.m21;
|
||||
}
|
||||
|
||||
- (void)setM21:(double)val {
|
||||
native.m21 = val;
|
||||
}
|
||||
|
||||
- (double)m12 {
|
||||
return native.m12;
|
||||
}
|
||||
|
||||
- (void)setM12:(double)val {
|
||||
native.m12 = val;
|
||||
}
|
||||
|
||||
- (double)m03 {
|
||||
return native.m03;
|
||||
}
|
||||
|
||||
- (void)setM03:(double)val {
|
||||
native.m03 = val;
|
||||
}
|
||||
|
||||
- (double)mu20 {
|
||||
return native.mu20;
|
||||
}
|
||||
|
||||
- (void)setMu20:(double)val {
|
||||
native.mu20 = val;
|
||||
}
|
||||
|
||||
- (double)mu11 {
|
||||
return native.mu11;
|
||||
}
|
||||
|
||||
- (void)setMu11:(double)val {
|
||||
native.mu11 = val;
|
||||
}
|
||||
|
||||
- (double)mu02 {
|
||||
return native.mu02;
|
||||
}
|
||||
|
||||
- (void)setMu02:(double)val {
|
||||
native.mu02 = val;
|
||||
}
|
||||
|
||||
- (double)mu30 {
|
||||
return native.mu30;
|
||||
}
|
||||
|
||||
- (void)setMu30:(double)val {
|
||||
native.mu30 = val;
|
||||
}
|
||||
|
||||
- (double)mu21 {
|
||||
return native.mu21;
|
||||
}
|
||||
|
||||
- (void)setMu21:(double)val {
|
||||
native.mu21 = val;
|
||||
}
|
||||
- (double)mu12 {
|
||||
return native.mu12;
|
||||
}
|
||||
|
||||
- (void)setMu12:(double)val {
|
||||
native.mu12 = val;
|
||||
}
|
||||
|
||||
- (double)mu03 {
|
||||
return native.mu03;
|
||||
}
|
||||
|
||||
- (void)setMu03:(double)val {
|
||||
native.mu03 = val;
|
||||
}
|
||||
|
||||
- (double)nu20 {
|
||||
return native.nu20;
|
||||
}
|
||||
|
||||
- (void)setNu20:(double)val {
|
||||
native.nu20 = val;
|
||||
}
|
||||
|
||||
- (double)nu11 {
|
||||
return native.nu11;
|
||||
}
|
||||
|
||||
- (void)setNu11:(double)val {
|
||||
native.nu11 = val;
|
||||
}
|
||||
|
||||
- (double)nu02 {
|
||||
return native.nu02;
|
||||
}
|
||||
|
||||
- (void)setNu02:(double)val {
|
||||
native.nu02 = val;
|
||||
}
|
||||
|
||||
- (double)nu30 {
|
||||
return native.nu30;
|
||||
}
|
||||
|
||||
- (void)setNu30:(double)val {
|
||||
native.nu30 = val;
|
||||
}
|
||||
|
||||
- (double)nu21 {
|
||||
return native.nu21;
|
||||
}
|
||||
|
||||
- (void)setNu21:(double)val {
|
||||
native.nu21 = val;
|
||||
}
|
||||
|
||||
- (double)nu12 {
|
||||
return native.nu12;
|
||||
}
|
||||
|
||||
- (void)setNu12:(double)val {
|
||||
native.nu12 = val;
|
||||
}
|
||||
|
||||
- (double)nu03 {
|
||||
return native.nu03;
|
||||
}
|
||||
|
||||
- (void)setNu03:(double)val {
|
||||
native.nu03 = val;
|
||||
}
|
||||
|
||||
-(instancetype)initWithM00:(double)m00 m10:(double)m10 m01:(double)m01 m20:(double)m20 m11:(double)m11 m02:(double)m02 m30:(double)m30 m21:(double)m21 m12:(double)m12 m03:(double)m03 {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.m00 = m00;
|
||||
self.m10 = m10;
|
||||
self.m01 = m01;
|
||||
self.m20 = m20;
|
||||
self.m11 = m11;
|
||||
self.m02 = m02;
|
||||
self.m30 = m30;
|
||||
self.m21 = m21;
|
||||
self.m12 = m12;
|
||||
self.m03 = m03;
|
||||
[self completeState];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(instancetype)init {
|
||||
return [self initWithM00:0 m10:0 m01:0 m20:0 m11:0 m02:0 m30:0 m21:0 m12:0 m03:0];
|
||||
}
|
||||
|
||||
-(instancetype)initWithVals:(NSArray<NSNumber*>*)vals {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[self set:vals];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+(instancetype)fromNative:(cv::Moments&)moments {
|
||||
return [[Moments alloc] initWithM00:moments.m00 m10:moments.m10 m01:moments.m01 m20:moments.m20 m11:moments.m11 m02:moments.m02 m30:moments.m30 m21:moments.m21 m12:moments.m12 m03:moments.m03];
|
||||
}
|
||||
|
||||
-(void)set:(NSArray<NSNumber*>*)vals {
|
||||
self.m00 = (vals != nil && vals.count > 0) ? vals[0].doubleValue : 0;
|
||||
self.m10 = (vals != nil && vals.count > 1) ? vals[1].doubleValue : 0;
|
||||
self.m01 = (vals != nil && vals.count > 2) ? vals[2].doubleValue : 0;
|
||||
self.m20 = (vals != nil && vals.count > 3) ? vals[3].doubleValue : 0;
|
||||
self.m11 = (vals != nil && vals.count > 4) ? vals[4].doubleValue : 0;
|
||||
self.m02 = (vals != nil && vals.count > 5) ? vals[5].doubleValue : 0;
|
||||
self.m30 = (vals != nil && vals.count > 6) ? vals[6].doubleValue : 0;
|
||||
self.m21 = (vals != nil && vals.count > 7) ? vals[7].doubleValue : 0;
|
||||
self.m12 = (vals != nil && vals.count > 8) ? vals[8].doubleValue : 0;
|
||||
self.m03 = (vals != nil && vals.count > 9) ? vals[9].doubleValue : 0;
|
||||
[self completeState];
|
||||
}
|
||||
|
||||
-(void)completeState {
|
||||
double cx = 0, cy = 0;
|
||||
double mu20, mu11, mu02;
|
||||
double inv_m00 = 0.0;
|
||||
|
||||
if (abs(self.m00) > 0.00000001) {
|
||||
inv_m00 = 1. / self.m00;
|
||||
cx = self.m10 * inv_m00;
|
||||
cy = self.m01 * inv_m00;
|
||||
}
|
||||
|
||||
// mu20 = m20 - m10*cx
|
||||
mu20 = self.m20 - self.m10 * cx;
|
||||
// mu11 = m11 - m10*cy
|
||||
mu11 = self.m11 - self.m10 * cy;
|
||||
// mu02 = m02 - m01*cy
|
||||
mu02 = self.m02 - self.m01 * cy;
|
||||
|
||||
self.mu20 = mu20;
|
||||
self.mu11 = mu11;
|
||||
self.mu02 = mu02;
|
||||
|
||||
// mu30 = m30 - cx*(3*mu20 + cx*m10)
|
||||
self.mu30 = self.m30 - cx * (3 * mu20 + cx * self.m10);
|
||||
mu11 += mu11;
|
||||
// mu21 = m21 - cx*(2*mu11 + cx*m01) - cy*mu20
|
||||
self.mu21 = self.m21 - cx * (mu11 + cx * self.m01) - cy * mu20;
|
||||
// mu12 = m12 - cy*(2*mu11 + cy*m10) - cx*mu02
|
||||
self.mu12 = self.m12 - cy * (mu11 + cy * self.m10) - cx * mu02;
|
||||
// mu03 = m03 - cy*(3*mu02 + cy*m01)
|
||||
self.mu03 = self.m03 - cy * (3 * mu02 + cy * self.m01);
|
||||
|
||||
|
||||
double inv_sqrt_m00 = sqrt(abs(inv_m00));
|
||||
double s2 = inv_m00*inv_m00, s3 = s2*inv_sqrt_m00;
|
||||
|
||||
self.nu20 = self.mu20*s2;
|
||||
self.nu11 = self.mu11*s2;
|
||||
self.nu02 = self.mu02*s2;
|
||||
self.nu30 = self.mu30*s3;
|
||||
self.nu21 = self.mu21*s3;
|
||||
self.nu12 = self.mu12*s3;
|
||||
self.nu03 = self.mu03*s3;
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return [NSString stringWithFormat:@"Moments [ \nm00=%lf, \nm10=%lf, m01=%lf, \nm20=%lf, m11=%lf, m02=%lf, \nm30=%lf, m21=%lf, m12=%lf, m03=%lf, \nmu20=%lf, mu11=%lf, mu02=%lf, \nmu30=%lf, mu21=%lf, mu12=%lf, mu03=%lf, \nnu20=%lf, nu11=%lf, nu02=%lf, \nnu30=%lf, nu21=%lf, nu12=%lf, nu03=%lf, \n]", self.m00, self.m10, self.m01, self.m20, self.m11, self.m02, self.m30, self.m21, self.m12, self.m03, self.mu20, self.mu11, self.mu02, self.mu30, self.mu21, self.mu12, self.mu03, self.nu20, self.nu11, self.nu02, self.nu30, self.nu21, self.nu12, self.nu03];
|
||||
}
|
||||
|
||||
@end
|
132
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/gen_dict.json
vendored
Normal file
132
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/gen_dict.json
vendored
Normal file
@ -0,0 +1,132 @@
|
||||
{
|
||||
"AdditionalImports" : {
|
||||
"Imgproc" : [ "\"imgproc/bindings.hpp\"" ]
|
||||
},
|
||||
"enum_ignore_list" : [
|
||||
"MorphShapes_c",
|
||||
"SmoothMethod_c"
|
||||
],
|
||||
"module_imports": ["Size2i"],
|
||||
"const_ignore_list": [
|
||||
"CV_TM_.+",
|
||||
"CV_COLORCVT_MAX",
|
||||
"CV_.*Bayer.*",
|
||||
"CV_YUV420(i|sp|p)2.+",
|
||||
"CV_L?(BGRA?|RGBA?|GRAY|XYZ|YCrCb|Luv|Lab|HLS|YUV|HSV)\\d*2L?(BGRA?|RGBA?|GRAY|XYZ|YCrCb|Luv|Lab|HLS|YUV|HSV).*",
|
||||
"CV_FLOODFILL_.+",
|
||||
"CV_ADAPTIVE_THRESH_.+",
|
||||
"CV_DIST_.+",
|
||||
"CV_HOUGH_.+",
|
||||
"CV_CONTOURS_MATCH_.+",
|
||||
"CV_COMP_.+"
|
||||
],
|
||||
"const_private_list" : [
|
||||
"CV_MOP_.+",
|
||||
"CV_INTER_.+",
|
||||
"CV_THRESH_.+",
|
||||
"CV_INPAINT_.+",
|
||||
"CV_RETR_.+",
|
||||
"CV_CHAIN_APPROX_.+"
|
||||
],
|
||||
"missing_consts" : {
|
||||
"Imgproc" : {
|
||||
"private" : [
|
||||
["IPL_BORDER_CONSTANT", 0 ],
|
||||
["IPL_BORDER_REPLICATE", 1 ],
|
||||
["IPL_BORDER_REFLECT", 2 ],
|
||||
["IPL_BORDER_WRAP", 3 ],
|
||||
["IPL_BORDER_REFLECT_101", 4 ],
|
||||
["IPL_BORDER_TRANSPARENT", 5 ]
|
||||
]
|
||||
}
|
||||
},
|
||||
"func_arg_fix" : {
|
||||
"Imgproc" : {
|
||||
"goodFeaturesToTrack" : { "corners" : {"ctype" : "vector_Point"} },
|
||||
"minEnclosingCircle" : { "points" : {"ctype" : "vector_Point2f"} },
|
||||
"fitEllipse" : { "points" : {"ctype" : "vector_Point2f"} },
|
||||
"fillPoly" : { "pts" : {"ctype" : "vector_vector_Point"},
|
||||
"lineType" : {"ctype" : "LineTypes"}},
|
||||
"polylines" : { "pts" : {"ctype" : "vector_vector_Point"},
|
||||
"lineType" : {"ctype" : "LineTypes"} },
|
||||
"fillConvexPoly" : { "points" : {"ctype" : "vector_Point"},
|
||||
"lineType" : {"ctype" : "LineTypes"} },
|
||||
"approxPolyDP" : { "curve" : {"ctype" : "vector_Point2f"},
|
||||
"approxCurve" : {"ctype" : "vector_Point2f"} },
|
||||
"arcLength" : { "curve" : {"ctype" : "vector_Point2f"} },
|
||||
"pointPolygonTest" : { "contour" : {"ctype" : "vector_Point2f"} },
|
||||
"minAreaRect" : { "points" : {"ctype" : "vector_Point2f"} },
|
||||
"getAffineTransform" : { "src" : {"ctype" : "vector_Point2f"},
|
||||
"dst" : {"ctype" : "vector_Point2f"} },
|
||||
"drawContours" : { "contours" : {"ctype" : "vector_vector_Point"},
|
||||
"lineType" : {"ctype" : "LineTypes"} },
|
||||
"findContours" : { "contours" : {"ctype" : "vector_vector_Point"},
|
||||
"mode" : {"ctype" : "RetrievalModes"},
|
||||
"method" : {"ctype" : "ContourApproximationModes"} },
|
||||
"convexityDefects" : { "contour" : {"ctype" : "vector_Point"},
|
||||
"convexhull" : {"ctype" : "vector_int"},
|
||||
"convexityDefects" : {"ctype" : "vector_Vec4i"} },
|
||||
"isContourConvex" : { "contour" : {"ctype" : "vector_Point"} },
|
||||
"convexHull" : { "points" : {"ctype" : "vector_Point"},
|
||||
"hull" : {"ctype" : "vector_int"},
|
||||
"returnPoints" : {"ctype" : ""} },
|
||||
"getStructuringElement" : { "shape" : {"ctype" : "MorphShapes"} },
|
||||
"EMD" : {"lowerBound" : {"defval" : "cv::Ptr<float>()"},
|
||||
"distType" : {"ctype" : "DistanceTypes"}},
|
||||
"createLineSegmentDetector" : { "_refine" : {"ctype" : "LineSegmentDetectorModes"}},
|
||||
"compareHist" : { "method" : {"ctype" : "HistCompMethods"}},
|
||||
"matchShapes" : { "method" : {"ctype" : "ShapeMatchModes"}},
|
||||
"threshold" : { "type" : {"ctype" : "ThresholdTypes"}},
|
||||
"connectedComponentsWithStatsWithAlgorithm" : { "ccltype" : {"ctype" : "ConnectedComponentsAlgorithmsTypes"}},
|
||||
"GaussianBlur" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"HoughCircles" : { "method" : {"ctype" : "HoughModes"}},
|
||||
"Laplacian" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"Scharr" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"Sobel" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"adaptiveThreshold" : { "adaptiveMethod" : {"ctype" : "AdaptiveThresholdTypes"},
|
||||
"thresholdType" : {"ctype" : "ThresholdTypes"}},
|
||||
"applyColorMap" : { "colormap" : {"ctype" : "ColormapTypes"}},
|
||||
"arrowedLine" : { "line_type" : {"ctype" : "LineTypes"}},
|
||||
"bilateralFilter" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"blur" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"boxFilter" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"circle" : { "lineType" : {"ctype" : "LineTypes"}},
|
||||
"cornerEigenValsAndVecs" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"cornerHarris" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"cornerMinEigenVal" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"cvtColor" : { "code" : {"ctype" : "ColorConversionCodes"}},
|
||||
"dilate" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"distanceTransformWithLabels" : { "labelType" : {"ctype" : "DistanceTransformLabelTypes"},
|
||||
"distanceType" : {"ctype" : "DistanceTypes"},
|
||||
"maskSize" : {"ctype" : "DistanceTransformMasks"}},
|
||||
"distanceTransform" : { "distanceType" : {"ctype" : "DistanceTypes"},
|
||||
"maskSize" : {"ctype" : "DistanceTransformMasks"}},
|
||||
"drawMarker" : { "markerType" : {"ctype" : "MarkerTypes"},
|
||||
"line_type" : {"ctype" : "LineTypes"}},
|
||||
"ellipse" : { "lineType" : {"ctype" : "LineTypes"}},
|
||||
"erode" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"filter2D" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"fitLine" : { "distType" : {"ctype" : "DistanceTypes"}},
|
||||
"line" : { "lineType" : {"ctype" : "LineTypes"}},
|
||||
"matchTemplate" : { "method" : {"ctype" : "TemplateMatchModes"}},
|
||||
"morphologyEx" : { "op" : {"ctype" : "MorphTypes"},
|
||||
"borderType" : {"ctype" : "BorderTypes"}},
|
||||
"preCornerDetect" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"putText" : { "fontFace" : {"ctype" : "HersheyFonts"},
|
||||
"lineType" : {"ctype" : "LineTypes"}},
|
||||
"pyrDown" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"pyrUp" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"rectangle" : { "lineType" : {"ctype" : "LineTypes"}},
|
||||
"remap" : { "borderMode": {"ctype" : "BorderTypes"}},
|
||||
"sepFilter2D" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"spatialGradient" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"sqrBoxFilter" : { "borderType" : {"ctype" : "BorderTypes"}},
|
||||
"warpAffine" : { "borderMode": {"ctype" : "BorderTypes"}},
|
||||
"warpPerspective" : { "borderMode": {"ctype" : "BorderTypes"}},
|
||||
"getTextSize" : { "fontFace": {"ctype" : "HersheyFonts"}}
|
||||
},
|
||||
"Subdiv2D" : {
|
||||
"(void)insert:(NSArray<Point2f*>*)ptvec" : { "insert" : {"name" : "insertVector"} }
|
||||
}
|
||||
}
|
||||
}
|
1744
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/test/ImgprocTest.swift
vendored
Normal file
1744
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/test/ImgprocTest.swift
vendored
Normal file
File diff suppressed because it is too large
Load Diff
42
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/test/MomentsTest.swift
vendored
Normal file
42
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/test/MomentsTest.swift
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
//
|
||||
// MomentsTest.swift
|
||||
//
|
||||
// Created by Giles Payne on 2020/02/10.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import OpenCV
|
||||
|
||||
class MomentsTest: XCTestCase {
|
||||
|
||||
func testAll() {
|
||||
let data = Mat(rows: 3,cols: 3, type: CvType.CV_8UC1, scalar: Scalar(1))
|
||||
data.row(1).setTo(scalar: Scalar(5))
|
||||
let res = Imgproc.moments(array: data)
|
||||
XCTAssertEqual(res.m00, 21.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m10, 21.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m01, 21.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m20, 35.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m11, 21.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m02, 27.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m30, 63.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m21, 35.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m12, 27.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.m03, 39.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.mu20, 14.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.mu11, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.mu02, 6.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.mu30, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.mu21, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.mu12, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.mu03, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.nu20, 0.031746031746031744, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.nu11, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.nu02, 0.013605442176870746, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.nu30, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.nu21, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.nu12, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
XCTAssertEqual(res.nu03, 0.0, accuracy: OpenCVTestCase.EPS);
|
||||
}
|
||||
|
||||
}
|
23
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/test/Subdiv2DTest.swift
vendored
Normal file
23
3rdparty/opencv-4.5.4/modules/imgproc/misc/objc/test/Subdiv2DTest.swift
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// Subdiv2DTest.swift
|
||||
//
|
||||
// Created by Giles Payne on 2020/02/10.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import OpenCV
|
||||
|
||||
class Subdiv2DTest: OpenCVTestCase {
|
||||
|
||||
func testGetTriangleList() {
|
||||
let s2d = Subdiv2D(rect: Rect(x: 0, y: 0, width: 50, height: 50))
|
||||
s2d.insert(pt: Point2f(x: 10, y: 10))
|
||||
s2d.insert(pt: Point2f(x: 20, y: 10))
|
||||
s2d.insert(pt: Point2f(x: 20, y: 20))
|
||||
s2d.insert(pt: Point2f(x: 10, y: 20))
|
||||
var triangles = [Float6]()
|
||||
s2d.getTriangleList(triangleList: &triangles)
|
||||
XCTAssertEqual(2, triangles.count)
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user