当前位置:网站首页>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);
边栏推荐
- A single game with goods increased by 100000, and the rural anchor sold men's clothes on top of the list?
- 打通法律服务群众“最后一公里”,方正璞华劳动人事法律自助咨询服务平台频获“点赞”
- Famine cloud service management script
- POJ - 3784 running medium
- 调用华为游戏多媒体服务的创建引擎接口返回错误码1002,错误信息:the params is error
- You should use Google related products with caution
- go写一个在一定时间内运行的程序
- Opencv learning note 4 - expansion / corrosion / open operation / close operation
- Composer change domestic image
- AVL平衡二叉搜索树
猜你喜欢

Opencv learning notes 1 -- several methods of reading images

Iptables' state module (FTP service exercise)

XCiT学习笔记

One click installation of highly available Nacos clusters in rainbow

The field value in Splunk subquery fuzzy matching CSV is*
![[IELTS speaking] Anna's oral learning records part2](/img/c4/ad7ba2394ee7a52b67b643aa45a7ae.png)
[IELTS speaking] Anna's oral learning records part2

Laravel8 uses passport login and JWT (generate token)

Coquette data completes the cloud native transformation through rainbow to realize offline continuous delivery to customers

Splunk query CSV lookup table data dynamic query

国标GB28181协议视频平台EasyGBS新增拉流超时配置
随机推荐
Analyzing the influence of robot science and technology development concept on Social Research
说一个软件创业项目,有谁愿意投资的吗?
redis故障处理 “Can‘t save in background: fork: Cannot allocate memory“
PVTV2--Pyramid Vision TransformerV2学习笔记
Splunk查询csv lookup table数据动态查询
[go ~ 0 to 1] obtain timestamp, time comparison, time format conversion, sleep and timer on the seventh day
2 - 3 arbre de recherche
一种适用于应用频繁测试下快速查看Pod的日志的方法(grep awk xargs kuberctl)
A method for quickly viewing pod logs under frequent tests (grep awk xargs kuberctl)
IELTS review progress and method use [daily revision]
Lua programming learning notes
[Yu Yue education] basic reference materials of electrical and electronic technology of Nanjing Institute of information technology
Open3d ISS key points
Obsidan之数学公式的输入
opencv学习笔记二——图像基本操作
[hard core science popularization] working principle of dynamic loop monitoring system
Go write a program that runs within a certain period of time
AVL平衡二叉搜索树
Fluentd is easy to use. Combined with the rainbow plug-in market, log collection is faster
Download and install orcale database11.2.0.4