1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Smorkalov
2023-06-01 09:37:38 +03:00
565 changed files with 84396 additions and 17589 deletions
+39
View File
@@ -14,6 +14,14 @@
#import <Foundation/Foundation.h>
#ifdef AVAILABLE_IMGCODECS
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#elif TARGET_OS_MAC
#import <AppKit/AppKit.h>
#endif
#endif
@class Size2i;
@class Scalar;
@class Range;
@@ -181,6 +189,37 @@ CV_EXPORTS @interface Mat : NSObject
- (int)put:(NSArray<NSNumber*>*)indices count:(int)count intBuffer:(const int*)buffer NS_REFINED_FOR_SWIFT;
- (int)put:(NSArray<NSNumber*>*)indices count:(int)count shortBuffer:(const short*)buffer NS_REFINED_FOR_SWIFT;
#pragma mark - Converters
#ifdef AVAILABLE_IMGCODECS
- (CGImageRef)toCGImage CF_RETURNS_RETAINED;
- (instancetype)initWithCGImage:(CGImageRef)image;
- (instancetype)initWithCGImage:(CGImageRef)image alphaExist:(BOOL)alphaExist;
#if TARGET_OS_IPHONE
- (UIImage*)toUIImage;
- (instancetype)initWithUIImage:(UIImage*)image;
- (instancetype)initWithUIImage:(UIImage*)image alphaExist:(BOOL)alphaExist;
#elif TARGET_OS_MAC
- (NSImage*)toNSImage;
- (instancetype)initWithNSImage:(NSImage*)image;
- (instancetype)initWithNSImage:(NSImage*)image alphaExist:(BOOL)alphaExist;
#endif
#endif
#pragma mark - QuickLook
#ifdef AVAILABLE_IMGCODECS
- (id)debugQuickLookObject;
#endif
@end
+55
View File
@@ -13,6 +13,11 @@
#import "CvType.h"
#import "CVObjcUtil.h"
#ifdef AVAILABLE_IMGCODECS
#import "MatConverters.h"
#import "MatQuickLook.h"
#endif
static int idx2Offset(cv::Mat* mat, std::vector<int>& indices) {
int offset = indices[0];
for (int dim=1; dim < mat->dims; dim++) {
@@ -932,4 +937,54 @@ template<typename T> int putData(NSArray<NSNumber*>* indices, cv::Mat* mat, int
return [self cols];
}
#ifdef AVAILABLE_IMGCODECS
-(CGImageRef)toCGImage {
return [MatConverters convertMatToCGImageRef:self];
}
-(instancetype)initWithCGImage:(CGImageRef)image {
return [MatConverters convertCGImageRefToMat:image];
}
-(instancetype)initWithCGImage:(CGImageRef)image alphaExist:(BOOL)alphaExist {
return [MatConverters convertCGImageRefToMat:image alphaExist:alphaExist];
}
#if TARGET_OS_IPHONE
-(UIImage*)toUIImage {
return [MatConverters converMatToUIImage:self];
}
-(instancetype)initWithUIImage:(UIImage*)image {
return [MatConverters convertUIImageToMat:image];
}
-(instancetype)initWithUIImage:(UIImage*)image alphaExist:(BOOL)alphaExist {
return [MatConverters convertUIImageToMat:image alphaExist:alphaExist];
}
#elif TARGET_OS_MAC
-(NSImage*)toNSImage {
return [MatConverters converMatToNSImage:self];
}
-(instancetype)initWithNSImage:(NSImage*)image {
return [MatConverters convertNSImageToMat:image];
}
-(instancetype)initWithNSImage:(NSImage*)image alphaExist:(BOOL)alphaExist {
return [MatConverters convertNSImageToMat:image alphaExist:alphaExist];
}
#endif
- (id)debugQuickLookObject {
return [MatQuickLook matDebugQuickLookObject:self];
}
#endif
@end