mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
Merge pull request #18059 from komakai:improve-swift-docs
This commit is contained in:
@@ -23,7 +23,19 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* The class Mat represents an n-dimensional dense numerical single-channel or multi-channel array.
|
||||
The class Mat represents an n-dimensional dense numerical single-channel or multi-channel array.
|
||||
####Swift Example
|
||||
```swift
|
||||
let mat = Mat(rows: 2, cols: 3, type: CvType.CV_8U)
|
||||
try! mat.put(row: 0, col: 0, data: [2, 3, 4, 4, 5, 6] as [Int8])
|
||||
print("mat: \(mat.dump())")
|
||||
```
|
||||
####Objective-C Example
|
||||
```objc
|
||||
Mat* mat = [[Mat alloc] initWithRows:2 cols:3 type: CV_8U];
|
||||
[m1 put:0 col:0 data:@[@2, @3, @4, @3, @4, @5]];
|
||||
NSLog(@"mat: %@", [m1 dump]);
|
||||
```
|
||||
*/
|
||||
CV_EXPORTS @interface Mat : NSObject
|
||||
|
||||
@@ -40,6 +52,12 @@ CV_EXPORTS @interface Mat : NSObject
|
||||
+ (instancetype)fromNativePtr:(cv::Ptr<cv::Mat>)nativePtr;
|
||||
+ (instancetype)fromNative:(cv::Mat&)nativeRef;
|
||||
#endif
|
||||
/**
|
||||
Creates a Mat object with the specified number of rows and columns and Mat type
|
||||
@param rows Number of rows
|
||||
@param cols Number of columns
|
||||
@param type Mat type (refer: `CvType`)
|
||||
*/
|
||||
- (instancetype)initWithRows:(int)rows cols:(int)cols type:(int)type;
|
||||
- (instancetype)initWithRows:(int)rows cols:(int)cols type:(int)type data:(NSData*)data;
|
||||
- (instancetype)initWithRows:(int)rows cols:(int)cols type:(int)type data:(NSData*)data step:(long)step;
|
||||
|
||||
Reference in New Issue
Block a user