introduce MAKETYPE and MAT_DEPTH
MODIFY
src/hub/manual/core.rs
src/hub/manual/core.rs
@@ -22,3 +22,15 @@ mod rect;
mod scalar;
mod size;
mod vec;
+
+#[inline(always)]
+pub const fn MAT_DEPTH(flags: i32) -> i32 {
+ #![allow(non_snake_case)]
+ flags & crate::hub::core::Mat_DEPTH_MASK
+}
+
+#[inline(always)]
+pub const fn MAKETYPE(depth: i32, cn: i32) -> i32 {
+ #![allow(non_snake_case)]
+ MAT_DEPTH(depth) + ((cn - 1) << crate::hub::core::CV_CN_SHIFT)
+}

ADD
tests/core.rs
+use opencv::core::{CV_32S, CV_32SC3, CV_64F, CV_64FC1, CV_8U, CV_8UC2, MAKETYPE};
+
+#[test]
+fn make_type() {
+ assert_eq!(MAKETYPE(CV_8U, 2), CV_8UC2);
+ assert_eq!(MAKETYPE(CV_32S, 3), CV_32SC3);
+ assert_eq!(MAKETYPE(CV_64F, 1), CV_64FC1);
+}

introduce MAKETYPE and MAT_DEPTH