mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Add Objective-C/Swift wrappers for opencv_contrib modules
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user