Add data pointer bridge method to Mat for Objective-C/Swift

This commit is contained in:
mtfrctl 2020-10-11 19:16:03 +09:00
parent 199687a1c5
commit 16561ed71e
2 changed files with 5 additions and 0 deletions

View File

@ -97,6 +97,7 @@ CV_EXPORTS @interface Mat : NSObject
- (void)createEx:(NSArray<NSNumber*>*)sizes type:(int)type NS_SWIFT_NAME(create(sizes:type:));
- (void)copySize:(Mat*)mat;
- (Mat*)cross:(Mat*)mat;
- (unsigned char*)dataPtr NS_SWIFT_NAME(dataPointer());
- (int)depth;
- (Mat*)diag:(int)diagonal;
- (Mat*)diag;

View File

@ -286,6 +286,10 @@ static bool updateIdx(cv::Mat* mat, std::vector<int>& indices, int inc) {
return [[Mat alloc] initWithNativeMat:new cv::Mat(_nativePtr->cross(*(cv::Mat*)mat.nativePtr))];
}
- (unsigned char*)dataPtr {
return _nativePtr->data;
}
- (int)depth {
return _nativePtr->depth();
}