当前位置:网站首页>opencv 将16位图像数据转为8位、8转16
opencv 将16位图像数据转为8位、8转16
2022-07-07 05:48:00 【xiaozhu丶】
1、16位图像数据转为8位
函数 Mat(int rows, int cols, int type, void* data, size_t step=AUTO_STEP);
/** @overload @param rows Number of rows in a 2D array. @param cols Number of columns in a 2D array. @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. @param data Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. This operation is very efficient and can be used to process external data using OpenCV functions. The external data is not automatically deallocated, so you should take care of it. @param step Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize(). See Mat::elemSize. */
Mat(int rows, int cols, int type, void* data, size_t step=AUTO_STEP);
rows 二维数组的行数
cols 二维数组的列数
type 数组的类型
data 指向用户数据的指针
step 矩阵每行占据的字节数。这个值必须包含每行补齐的数据。如果不提供这个参数,就假设没有补齐,实际的步长就是等于cols*elemSize()
Mat tmp;
Mat mat(dwCount, dwProfileDataCount, CV_16UC1, (void*)pHeightProfileArray, image_info.width*2);
mat.convertTo(tmp, CV_8UC1, 255.0 / 65535, 0.5);
2、8位图像数据转为16位
Mat mat(1000, 3200, CV_8UC1, (void*)image->getMatPtr()->data, 3200);
Mat tep;
mat.convertTo(tep, CV_16UC1, 255.0);
边栏推荐
- GFS分布式文件系统
- Basic data types and string types are converted to each other
- Infix keyword infix expression and the use of generic extension function in kotlin
- IP-guard助力能源企业完善终端防泄密措施,保护机密资料安全
- BiSeNet的特點
- 单场带货涨粉10万,农村主播竟将男装卖爆单?
- 【无标题】
- GFS distributed file system
- 使用BiSeNet实现自己的数据集
- Through the "last mile" of legal services for the masses, fangzheng Puhua labor and personnel law self-service consulting service platform has been frequently "praised"
猜你喜欢
Using nocalhost to develop microservice application on rainbow
Rainbow combines neuvector to practice container safety management
The truth of robot education in hands-on practice
登山小分队(dfs)
A single game with goods increased by 100000, and the rural anchor sold men's clothes on top of the list?
Installation and configuration of PLSQL
[Yu Yue education] basic reference materials of electrical and electronic technology of Nanjing Institute of information technology
Practice of combining rook CEPH and rainbow, a cloud native storage solution
GFS distributed file system
Merge sort and non comparison sort
随机推荐
grpc、oauth2、openssl、双向认证、单向认证等专栏文章目录
Golan idea IntelliJ cannot input Chinese characters
Using nocalhost to develop microservice application on rainbow
Data type - floating point (C language)
SSM 整合
GFS分布式文件系统
Open3D ISS关键点
National standard gb28181 protocol video platform easygbs adds streaming timeout configuration
Practice of combining rook CEPH and rainbow, a cloud native storage solution
Caractéristiques de bisenet
Coquette data completes the cloud native transformation through rainbow to realize offline continuous delivery to customers
Lua programming learning notes
Arm GIC (IV) GIC V3 register class analysis notes.
Low success rate of unit test report
Using helm to install rainbow in various kubernetes
Ebpf cilium practice (1) - team based network isolation
Composer change domestic image
23 Chengdu instrument customization undertaking_ Discussion on automatic wiring method of PCB in Protel DXP
[Chongqing Guangdong education] audio visual language reference materials of Xinyang Normal University
AVL平衡二叉搜索树