当前位置:网站首页>Opencv converts 16 bit image data to 8 bits and 8 to 16
Opencv converts 16 bit image data to 8 bits and 8 to 16
2022-07-07 08:43:00 【Xiaozhu】
1、16 Bit image data is converted to 8 position
function 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 The number of rows in a two-dimensional array
cols The number of columns in a two-dimensional array
type The type of array
data Pointer to user data
step The number of bytes occupied by each row of the matrix . This value must contain the data supplemented by each row . If you don't provide this parameter , Just assume that there is no supplement , The actual step size is equal to 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 Bit image data is converted to 16 position
Mat mat(1000, 3200, CV_8UC1, (void*)image->getMatPtr()->data, 3200);
Mat tep;
mat.convertTo(tep, CV_16UC1, 255.0);
边栏推荐
猜你喜欢
Xcit learning notes
Three series of BOM elements
Componentspace2022, assertions, protocols, bindings, and configuration files
指针进阶,字符串函数
[Yugong series] February 2022 U3D full stack class 005 unity engine view
登山小分队(dfs)
About using CDN based on Kangle and EP panel
Arm GIC (IV) GIC V3 register class analysis notes.
【踩坑】nacos注册一直连接localhost:8848,no available server
南京商品房买卖启用电子合同,君子签助力房屋交易在线网签备案
随机推荐
路由信息协议——RIP
Input of mathematical formula of obsidan
opencv之图像分割
[Chongqing Guangdong education] organic electronics (Bilingual) reference materials of Nanjing University of Posts and Telecommunications
说一个软件创业项目,有谁愿意投资的吗?
Go write a program that runs within a certain period of time
Greenplum6.x常用语句
Golang 编译约束/条件编译 ( // +build <tags> )
MES system is a necessary choice for enterprise production
基本数据类型和string类型互相转化
mysql分区讲解及操作语句
Novice entry SCM must understand those things
What is the method of manual wiring in PCB design in 22protel DXP_ Chengdu electromechanical Development Undertaking
[Chongqing Guangdong education] accounting reference materials of Nanjing University of Information Engineering
Go语言中,函数是一种类型
Basic data types and string types are converted to each other
Train your dataset with swinunet
idea里使用module项目的一个bug
Greenplum6.x重新初始化
Low success rate of unit test report