Merge pull request #26559 from asmorkalov:as/mattype_fix_ios

Fixed cv::Mat type constants in ObjC and Swift.
This commit is contained in:
Alexander Smorkalov 2024-12-03 12:58:59 +03:00 committed by GitHub
commit 3b1ec72cf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -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 {

View File

@ -8,14 +8,20 @@
#import <OpenCV/OpenCV.h>
#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)