当前位置:网站首页>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
- Using helm to install rainbow in various kubernetes
- Are you holding back on the publicity of the salary system for it posts such as testing, development, operation and maintenance?
- GOLand idea intellij 无法输入汉字
- National SMS center number inquiry
- 国标GB28181协议视频平台EasyGBS新增拉流超时配置
- 如何理解分布式架构和微服务架构呢
- AVL balanced binary search tree
- [Yu Yue education] higher vocational English reference materials of Nanjing Polytechnic University
- 基本数据类型和string类型互相转化
猜你喜欢
Go语言中,函数是一种类型
The single value view in Splunk uses to replace numeric values with text
Input and output of floating point data (C language)
Exercise arrangement 2.10, 11
Analyzing the influence of robot science and technology development concept on Social Research
下载和安装orcale database11.2.0.4
All about PDF crack, a complete solution to meet all your PDF needs
Lua programming learning notes
National standard gb28181 protocol video platform easygbs adds streaming timeout configuration
Opencv learning note 4 - expansion / corrosion / open operation / close operation
随机推荐
Lua programming learning notes
字符串操作
You should use Google related products with caution
Implementation method of data platform landing
联想混合云Lenovo xCloud:4大产品线+IT服务门户
POJ - 3784 running medium
Laravel8 uses passport login and JWT (generate token)
[IELTS speaking] Anna's oral learning records Part3
23 Chengdu instrument customization undertaking_ Discussion on automatic wiring method of PCB in Protel DXP
Interface as a parameter (interface callback)
Using nocalhost to develop microservice application on rainbow
MES系统,是企业生产的必要选择
Kotlin combines flatmap for filtering and zip merge operators
Rainbow combines neuvector to practice container safety management
详解华为应用市场2022年逐步减少32位包体上架应用和策略
Deit learning notes
Composer change domestic image
[go ~ 0 to 1] obtain timestamp, time comparison, time format conversion, sleep and timer on the seventh day
归并排序和非比较排序
iptables 之 state模块(ftp服务练习)