From 0c4fd4f7ee2422678c5e0afeb7b3662fac4919bc Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Mon, 2 Dec 2024 17:13:25 +0300 Subject: [PATCH] Fixed cv::Mat type constants in ObjC and Swift. --- modules/core/misc/objc/common/CvTypeExt.swift | 2 +- modules/core/misc/objc/test/MatTestObjc.m | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/core/misc/objc/common/CvTypeExt.swift b/modules/core/misc/objc/common/CvTypeExt.swift index de065ea2de..dc0f11c429 100644 --- a/modules/core/misc/objc/common/CvTypeExt.swift +++ b/modules/core/misc/objc/common/CvTypeExt.swift @@ -53,7 +53,7 @@ public extension CvType { static let CV_16FC4: Int32 = CV_16FC(4) static let CV_CN_MAX = 512 - static let CV_CN_SHIFT = 3 + static let CV_CN_SHIFT = 5 static let CV_DEPTH_MAX = 1 << CV_CN_SHIFT static func CV_8UC(_ channels:Int32) -> Int32 { diff --git a/modules/core/misc/objc/test/MatTestObjc.m b/modules/core/misc/objc/test/MatTestObjc.m index 7654436b20..26a5aaa06f 100644 --- a/modules/core/misc/objc/test/MatTestObjc.m +++ b/modules/core/misc/objc/test/MatTestObjc.m @@ -8,14 +8,20 @@ #import #define CV_8U 0 +#define CV_8S 1 +#define CV_16U 2 #define CV_16S 3 #define CV_32S 4 #define CV_32F 5 -#define CV_CN_SHIFT 3 +#define CV_64F 6 +#define CV_16F 7 + +#define CV_CN_SHIFT 5 #define CV_DEPTH_MAX (1 << CV_CN_SHIFT) #define CV_MAT_DEPTH_MASK (CV_DEPTH_MAX - 1) #define CV_MAT_DEPTH(flags) ((flags) & CV_MAT_DEPTH_MASK) #define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT)) + #define CV_8UC3 CV_MAKETYPE(CV_8U,3) #define CV_32FC3 CV_MAKETYPE(CV_32F,3) #define CV_32SC3 CV_MAKETYPE(CV_32S,3)