1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Add Objective-C/Swift wrappers for opencv_contrib modules

This commit is contained in:
Giles Payne
2020-07-21 19:19:08 +09:00
parent af9ee90091
commit 4cf76754d3
15 changed files with 282 additions and 163 deletions
+1 -1
View File
@@ -98,7 +98,7 @@
}
-(NSArray<NSNumber*>*)get {
return @[[NSNumber numberWithFloat:native[0]], [NSNumber numberWithFloat:native[1]], [NSNumber numberWithFloat:native[2]], [NSNumber numberWithFloat:native[3]]];
return @[[NSNumber numberWithFloat:native[0]], [NSNumber numberWithFloat:native[1]], [NSNumber numberWithFloat:native[2]], [NSNumber numberWithFloat:native[3]], [NSNumber numberWithFloat:native[4]], [NSNumber numberWithFloat:native[5]]];
}
- (BOOL)isEqual:(id)other {
+5
View File
@@ -39,6 +39,11 @@ CV_EXPORTS @interface Point3d : NSObject
- (instancetype)initWithPoint:(Point2d*)point;
- (instancetype)initWithVals:(NSArray<NSNumber*>*)vals;
#ifdef __cplusplus
+ (instancetype)fromNative:(cv::Point3d&)point;
- (void)update:(cv::Point3d&)point;
#endif
# pragma mark - Methods
/**
+10
View File
@@ -65,6 +65,16 @@
return self;
}
+ (instancetype)fromNative:(cv::Point3d&)point {
return [[Point3d alloc] initWithX:point.x y:point.y z:point.z];
}
- (void)update:(cv::Point3d&)point {
self.x = point.x;
self.y = point.y;
self.z = point.z;
}
- (void)set:(NSArray<NSNumber*>*)vals {
self.x = (vals != nil && vals.count > 0) ? vals[0].doubleValue : 0.0;
self.y = (vals != nil && vals.count > 1) ? vals[1].doubleValue : 0.0;
+4
View File
@@ -39,6 +39,10 @@ CV_EXPORTS @interface Point3f : NSObject
- (instancetype)initWithPoint:(Point2f*)point;
- (instancetype)initWithVals:(NSArray<NSNumber*>*)vals;
#ifdef __cplusplus
+ (instancetype)fromNative:(cv::Point3f&)point;
- (void)update:(cv::Point3f&)point;
#endif
# pragma mark - Methods
+10
View File
@@ -65,6 +65,16 @@
return self;
}
+ (instancetype)fromNative:(cv::Point3f&)point {
return [[Point3f alloc] initWithX:point.x y:point.y z:point.z];
}
- (void)update:(cv::Point3f&)point {
self.x = point.x;
self.y = point.y;
self.z = point.z;
}
- (void)set:(NSArray<NSNumber*>*)vals {
self.x = (vals != nil && vals.count > 0) ? vals[0].floatValue : 0.0;
self.y = (vals != nil && vals.count > 1) ? vals[1].floatValue : 0.0;
+5
View File
@@ -39,6 +39,11 @@ CV_EXPORTS @interface Point3i : NSObject
- (instancetype)initWithPoint:(Point2i*)point;
- (instancetype)initWithVals:(NSArray<NSNumber*>*)vals;
#ifdef __cplusplus
+ (instancetype)fromNative:(cv::Point3i&)point;
- (void)update:(cv::Point3i&)point;
#endif
# pragma mark - Methods
/**
+10
View File
@@ -66,6 +66,16 @@
return self;
}
+ (instancetype)fromNative:(cv::Point3i&)point {
return [[Point3i alloc] initWithX:point.x y:point.y z:point.z];
}
- (void)update:(cv::Point3i&)point {
self.x = point.x;
self.y = point.y;
self.z = point.z;
}
- (void)set:(NSArray<NSNumber*>*)vals {
self.x = (vals != nil && vals.count > 0) ? vals[0].intValue : 0;
self.y = (vals != nil && vals.count > 1) ? vals[1].intValue : 0;
+37 -22
View File
@@ -55,27 +55,28 @@
}
},
"func_arg_fix" : {
"randu" : { "low" : {"ctype" : "double"},
"high" : {"ctype" : "double"} },
"randn" : { "mean" : {"ctype" : "double"},
"stddev" : {"ctype" : "double"} },
"inRange" : { "lowerb" : {"ctype" : "Scalar"},
"upperb" : {"ctype" : "Scalar"} },
"boundingRect" : { "points" : {"ctype" : "vector_Point"} },
"hconcat" : { "src" : {"ctype" : "vector_Mat"} },
"vconcat" : { "src" : {"ctype" : "vector_Mat"} },
"checkRange" : {"pos" : {"ctype" : "*"} },
"meanStdDev" : { "mean" : {"ctype" : "vector_double"},
"stddev" : {"ctype" : "vector_double"} },
"mixChannels" : { "dst" : {"attrib" : []} },
"rotate" : { "rotateCode" : {"ctype" : "RotateFlags"} },
"norm" : { "normType" : {"ctype" : "NormTypes"} },
"batchDistance" : { "normType" : {"ctype" : "NormTypes"} },
"normalize" : { "norm_type" : {"ctype" : "NormTypes"} },
"compare" : { "cmpop" : {"ctype" : "CmpTypes"} },
"copyMakeBorder" : { "borderType" : {"ctype" : "BorderTypes"} },
"borderInterpolate" : { "borderType" : {"ctype" : "BorderTypes"} },
"(void)divide:(double)scale src2:(Mat*)src2 dst:(Mat*)dst dtype:(int)dtype" : { "src2" : {"name" : "src"} }
"Core": {
"randu" : { "low" : {"ctype" : "double"},
"high" : {"ctype" : "double"} },
"randn" : { "mean" : {"ctype" : "double"},
"stddev" : {"ctype" : "double"} },
"inRange" : { "lowerb" : {"ctype" : "Scalar"},
"upperb" : {"ctype" : "Scalar"} },
"hconcat" : { "src" : {"ctype" : "vector_Mat"} },
"vconcat" : { "src" : {"ctype" : "vector_Mat"} },
"checkRange" : {"pos" : {"ctype" : "*"} },
"meanStdDev" : { "mean" : {"ctype" : "vector_double"},
"stddev" : {"ctype" : "vector_double"} },
"mixChannels" : { "dst" : {"attrib" : []} },
"rotate" : { "rotateCode" : {"ctype" : "RotateFlags"} },
"norm" : { "normType" : {"ctype" : "NormTypes"} },
"batchDistance" : { "normType" : {"ctype" : "NormTypes"} },
"normalize" : { "norm_type" : {"ctype" : "NormTypes"} },
"compare" : { "cmpop" : {"ctype" : "CmpTypes"} },
"copyMakeBorder" : { "borderType" : {"ctype" : "BorderTypes"} },
"borderInterpolate" : { "borderType" : {"ctype" : "BorderTypes"} },
"(void)divide:(double)scale src2:(Mat*)src2 dst:(Mat*)dst dtype:(int)dtype" : { "src2" : {"name" : "src"} }
}
},
"type_dict" : {
"Algorithm": {
@@ -227,7 +228,9 @@
"from_cpp": "[Double3 fromNative:%(n)s]"
},
"c_string": {
"objc_type": "NSString*"
"objc_type": "NSString*",
"to_cpp": "%(n)s.UTF8String",
"from_cpp": "[NSString stringWithUTF8String:%(n)s]"
},
"vector_DMatch": {
"objc_type": "DMatch*",
@@ -355,6 +358,18 @@
"objc_type": "ByteVector*",
"v_type": "ByteVector"
},
"vector_vector_int": {
"objc_type": "IntVector*",
"v_type": "IntVector"
},
"vector_vector_float": {
"objc_type": "FloatVector*",
"v_type": "FloatVector"
},
"vector_vector_double": {
"objc_type": "DoubleVector*",
"v_type": "DoubleVector"
},
"ByteVector": {
"objc_type": "ByteVector*",
"cast_to": "std::vector<char>"