1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

More data types support in Obj-C and Swift bindings.

This commit is contained in:
Alexander Smorkalov
2024-12-04 12:55:56 +03:00
parent 3b1ec72cf5
commit 644cf0de08
4 changed files with 76 additions and 1 deletions
+12
View File
@@ -568,10 +568,22 @@ template<typename T> void putData(uchar* dataDest, int count, T (^readData)(int)
putData(dest, count, ^short (int index) { return cv::saturate_cast<short>(data[offset + index].doubleValue);} );
} else if (depth == CV_32S) {
putData(dest, count, ^int32_t (int index) { return cv::saturate_cast<int32_t>(data[offset + index].doubleValue);} );
} else if (depth == CV_32U) {
putData(dest, count, ^uint32_t (int index) { return cv::saturate_cast<uint32_t>(data[offset + index].doubleValue);} );
} else if (depth == CV_64U) {
putData(dest, count, ^uint64_t (int index) { return cv::saturate_cast<uint64_t>(data[offset + index].doubleValue);} );
} else if (depth == CV_64S) {
putData(dest, count, ^int64_t (int index) { return cv::saturate_cast<int64_t>(data[offset + index].doubleValue);} );
} else if (depth == CV_32F) {
putData(dest, count, ^float (int index) { return cv::saturate_cast<float>(data[offset + index].doubleValue);} );
} else if (depth == CV_64F) {
putData(dest, count, ^double (int index) { return data[offset + index].doubleValue;} );
} else if (depth == CV_Bool) {
putData(dest, count, ^double (int index) { return data[offset + index].boolValue;} );
} else if (depth == CV_16F || depth == CV_16BF) {
@throw [NSException exceptionWithName:@"NotImplementedError"
reason:@"Can not put data to Mat with CV_16F or CV_16BF underlying type."
userInfo:nil];
}
}