当前位置:网站首页>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);
边栏推荐
- Opencv learning notes 1 -- several methods of reading images
- Low success rate of unit test report
- SSM 整合
- Several ways of lambda used in functions in kotlin (higher-order functions)
- Transformation function map and flatmap in kotlin
- 国标GB28181协议视频平台EasyGBS新增拉流超时配置
- 打通法律服务群众“最后一公里”,方正璞华劳动人事法律自助咨询服务平台频获“点赞”
- Download and install orcale database11.2.0.4
- DeiT学习笔记
- National SMS center number inquiry
猜你喜欢

Ebpf cilium practice (2) - underlying network observability

調用華為遊戲多媒體服務的創建引擎接口返回錯誤碼1002,錯誤信息:the params is error

Iptables' state module (FTP service exercise)

Exercise arrangement 2.10, 11

Bisenet features

快速集成认证服务-HarmonyOS平台

Open3d ISS key points

21 general principles of wiring in circuit board design_ Provided by Chengdu circuit board design

Analysis of maker education in innovative education system

Xcit learning notes
随机推荐
Golang 编译约束/条件编译 ( // +build <tags> )
Leetcode 1984. Minimum difference in student scores
Obsidan之数学公式的输入
Implementation method of data platform landing
Arm GIC (IV) GIC V3 register class analysis notes.
[Chongqing Guangdong education] audio visual language reference materials of Xinyang Normal University
Golang compilation constraint / conditional compilation (/ / +build < tags>)
联想混合云Lenovo xCloud:4大产品线+IT服务门户
下载和安装orcale database11.2.0.4
MES系统,是企业生产的必要选择
Using helm to install rainbow in various kubernetes
Splunk查询csv lookup table数据动态查询
Coquette data completes the cloud native transformation through rainbow to realize offline continuous delivery to customers
21 general principles of wiring in circuit board design_ Provided by Chengdu circuit board design
Componentspace2022, assertions, protocols, bindings, and configuration files
Ebpf cilium practice (2) - underlying network observability
Tronapi-波场接口-源码无加密-可二开--附接口文档-基于ThinkPHP5封装-作者详细指导-2022年7月6日-新手快速上手-可无缝升级tp6版本
[Chongqing Guangdong education] accounting reference materials of Nanjing University of Information Engineering
Virtual address space
Give full play to the wide practicality of maker education space