当前位置:网站首页>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);
边栏推荐
- Practice of combining rook CEPH and rainbow, a cloud native storage solution
- Basic data types and string types are converted to each other
- Implementation of navigation bar at the bottom of applet
- POJ - 3616 Milking Time(DP+LIS)
- Merge sort and non comparison sort
- ES6_ Arrow function
- Xcit learning notes
- 为什么要选择云原生数据库
- 使用BiSeNet实现自己的数据集
- grpc、oauth2、openssl、双向认证、单向认证等专栏文章目录
猜你喜欢
Data type - integer (C language)
[IELTS speaking] Anna's oral learning records part2
The truth of robot education in hands-on practice
单元测试报告成功率低
Using helm to install rainbow in various kubernetes
Merge sort and non comparison sort
一种适用于应用频繁测试下快速查看Pod的日志的方法(grep awk xargs kuberctl)
調用華為遊戲多媒體服務的創建引擎接口返回錯誤碼1002,錯誤信息:the params is error
Componentspace2022, assertions, protocols, bindings, and configuration files
Opencv learning note 3 - image smoothing / denoising
随机推荐
[Yu Yue education] higher vocational English reference materials of Nanjing Polytechnic University
[untitled]
[IELTS speaking] Anna's oral learning records part2
Splunk中single value视图使用将数值替换为文字
Fluentd is easy to use. Combined with the rainbow plug-in market, log collection is faster
Exercise arrangement 2.10, 11
A single game with goods increased by 100000, and the rural anchor sold men's clothes on top of the list?
Componentspace2022, assertions, protocols, bindings, and configuration files
PLSQL的安装和配置
Virtual address space
【无标题】
Infix keyword infix expression and the use of generic extension function in kotlin
关于基于kangle和EP面板使用CDN
Famine cloud service management script
Input and output of floating point data (C language)
Implement your own dataset using bisenet
Golan idea IntelliJ cannot input Chinese characters
21 general principles of wiring in circuit board design_ Provided by Chengdu circuit board design
单元测试报告成功率低
Download and install orcale database11.2.0.4