OpenCV中如何获取数据 矩阵cv::Mat的数据类型?一般有2个常用函数,
depth()
返回是基本的数据类型,也就是说每个数据元素的类型,该函数并不关心矩阵cv::Mat的维度,
//
#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_64F 6
#define CV_16F 7
type()
返回了 #矩阵相关的数据类型信息#,除元素的数据类型(低3们)外,还包括通道(channel)的个数(高3位),
举个例子来说,
cv::Mat test(100, 100, CV_32FC3); int type = test.type(); int depth = test.depth();
这里 type得到的是CV_32FC3 == 0x15, 因为CV_32F==>0x05, (3-1)
关注
打赏
热门博文
- 对CSDN网站关于抄袭的投诉的处理建议
- Tesseract OCR训练时碰到的问题和解决方案
- VSCODE在Jetson Nano上打不上断点,无法调试python源码
- ROS2进阶:在windows10上用vs2019编译rviz2
- ROS2 ERROR: OpenGL 1.5 is not supported in GLRenderSystem::initialiseContext at C:\ci\ws\build...
- ROS2 error: can‘t find examples_rclcpp_minimal_subscriber/Release/wait_set_subscriber_library.lib
- 在windows上安装 chocolatey.1.1.0.nupkg
- Qt开发高级进阶:如何在显示时适合视窗宽度和高度(fitWidth+fitHeight)
- PySpark ERROR: Python in worker has different version 3.9 than that in driver 3.8
- cv2.imshow error: The function is not implemented. Rebuild the library with Windows...