当前位置:网站首页>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);
边栏推荐
- Using nocalhost to develop microservice application on rainbow
- IP-guard助力能源企业完善终端防泄密措施,保护机密资料安全
- How to understand distributed architecture and micro service architecture
- You should use Google related products with caution
- go写一个在一定时间内运行的程序
- [Chongqing Guangdong education] audio visual language reference materials of Xinyang Normal University
- Several ways of lambda used in functions in kotlin (higher-order functions)
- Go语言中,函数是一种类型
- POJ - 3616 Milking Time(DP+LIS)
- Famine cloud service management script
猜你喜欢

Automatic upgrading of database structure in rainbow

使用SwinUnet训练自己的数据集

Tuowei information uses the cloud native landing practice of rainbow

Opencv learning note 5 - gradient calculation / edge detection

Laravel8 uses passport login and JWT (generate token)

Practice of implementing cloud native Devops based on rainbow library app

关于基于kangle和EP面板使用CDN

Opencv learning note 3 - image smoothing / denoising

【无标题】

Caractéristiques de bisenet
随机推荐
Data type - floating point (C language)
Virtual address space
Golan idea IntelliJ cannot input Chinese characters
Rsync remote synchronization
基本数据类型和string类型互相转化
国标GB28181协议视频平台EasyGBS新增拉流超时配置
Xcit learning notes
2 - 3 arbre de recherche
南京商品房买卖启用电子合同,君子签助力房屋交易在线网签备案
Tuowei information uses the cloud native landing practice of rainbow
How to realize the high temperature alarm of the machine room in the moving ring monitoring system
[hard core science popularization] working principle of dynamic loop monitoring system
POJ - 3616 Milking Time(DP+LIS)
grpc、oauth2、openssl、双向认证、单向认证等专栏文章目录
BiSeNet的特點
Detailed explanation of apply, also, let, run functions and principle analysis of internal source code in kotlin
Are you holding back on the publicity of the salary system for it posts such as testing, development, operation and maintenance?
IELTS review progress and method use [daily revision]
23 Chengdu instrument customization undertaking_ Discussion on automatic wiring method of PCB in Protel DXP
Opencv learning note 4 - expansion / corrosion / open operation / close operation