当前位置:网站首页>Opencv learning notes - cv:: mat class
Opencv learning notes - cv:: mat class
2022-06-24 12:05:00 【cc_ rong】
Catalog
Mat Initialization function
// Default constructor cv::Mat // Copy structure cv::Mat(const Mat& mat) // Specify copy construction for rows and columns cv::Mat(const Mat& mat, const cv::Range& rows, const cv::Range& cols); // Appoint ROI( Areas of interest ) Copy construction of cv::Mat(const Mat& mat, const cv::Rect& roi); // Use n Copy construction of data within the specified range in the dimension group cv::Mat(const Mat& mat, const cv::Range* ranges); // A two-dimensional array of the specified type cv::Mat(int rows, int cols, int type); // Specify the type of 2D data , And specify the initialization value cv::Mat(int rows, int cols, int type, const Scalar& s); // Use pre-existing data , And specify a two-dimensional array of types cv::Mat(int rows, int cols, int type, void *data, size_t step = AUTO_STEP); // A two-dimensional array specifying size and type cv::Mat(cv::Size sz, int type) // A two-dimensional array specifying size and type , And specify the initial value cv::Mat(cv::Size sz, int type, const Scalar& s); // Use pre-existing data , A two-dimensional array of the specified type cv::Mat(cv::Size sz, int type, void *data, size_t step = AUTO_STEP); // Specify the type of multidimensional data cv::Mat(int ndims, const int *sizes, int type); // Specify the type of multidimensional data , And the initial value cv::Mat(int ndims, const int *sizes, int type, const Scalar& s); // Use pre-existing data , Multidimensional array of specified type cv::Mat(int ndims, const int* sizes, int type, void* data, size_t step = AUTO_STEP); //mat Template constructor for // Construction as cv::Vec The specified data type 、 The size is n One dimensional array of cv::Mat(const cv::Vec<T, n>& vec, bool copyData = true); // Construction as cv::Matx The specified data type 、 The size is mXn Two dimensional array of cv::Mat(const cv::Matx<T, m, n>& vec, bool copyData = true); // structure STL Of vector A one-dimensional array of the specified data type cv::Mat mat(const std::vector<T>& vec, bool copyData = true); // structure mat Static method of // Use zeros() The function definition specifies the size (rows X cols) And type (type) Of cv::Mat( All for 0) Matrix cv::Mat::zeros(int rows, int cols, int type); // Use ones() The function definition specifies the size (rows X cols) And type (type) Of cv::Mat( All for 1) Matrix cv::Mat::ones(int rows, int cols, int type); // Use eye() The function definition specifies the size (rows X cols) And type (type) The identity matrix of cv::Mat::eye(int rows, int cols, int type);
Access pixels
Method 1 : Use at function
// Direct access at function cv::Mat mat = cv::Mat::eye(10, 10, 32FC1); m.at<float>(3, 3) // Multi channel array operation cv::Mat mat = cv::Mat::eye(10, 10, 32FC2); m.at<cv::Vec2f>(3, 3)[0]; m.at<cv::Vec2f>(3, 3)[1];
Method 2 : Using Iterators
int sz[3] = {4, 4, 4}; Mat m(3, sz, CV_32FC3); cv::MatIterator<cv::Vec3b> it = m.begin(); while(it != m.end()) { cout << (*)it[0]; it++; }
边栏推荐
- 美团基于 Flink 的实时数仓平台建设新进展
- 计组-总复习
- The latest hot spot: the use of copper death related genes for tumor prognosis typing!
- [deep learning][pytorch][original]crnn trains loss on the higher version of pytorch as a solution for Nan
- How to develop hospital information system (his) with SMS notification and voice function
- Why does the virtual machine Ping the host but not the virtual machine
- Istio best practice: graceful termination
- Code is really - omnipotent! Refuse to fight
- PHP SMS notification + voice broadcast automatic double call
- 嵌入式必学!硬件资源接口详解——基于ARM AM335X开发板 (下)
猜你喜欢

Libuv的安装及运行使用

New progress in the construction of meituan's Flink based real-time data warehouse platform

计组-总复习

我真傻,招了一堆只会“谷歌”的程序员!

GLOG从入门到入门

"Meng Hua Lu" is about to have a grand finale. It's better to learn it first than to look ahead!

How stupid of me to hire a bunch of programmers who can only "Google"!

《opencv学习笔记》-- 分离颜色通道、多通道混合

PHP短信通知+语音播报自动双呼

Install Kali on the U disk and persist it
随机推荐
AXI低功耗接口
Google ranging for PHP wechat development
8 types of API automated testing that technicians must know
Insurance app aging service evaluation analysis 2022 issue 06
Code is really - omnipotent! Refuse to fight
FreeRTOS overview and experience
Variable parameter template implements max (accepts multiple parameters, two implementation methods)
Deep learning ~11+ a new perspective on disease-related miRNA research
GLOG from getting started to getting started
Audio knowledge (III) -- MFCCs code implementation
Why does the virtual machine Ping the host but not the virtual machine
How to write controller layer code gracefully?
夜晚读书 -- 关于微服务和容器
保险APP适老化服务评测分析2022第06期
怎么申请打新债 开户是安全的吗
math_ Summation and derivation of proportional series & derivation of sum and difference of equal powers / difference between two nth power numbers/
Why choose b+ tree as storage engine index structure
[deep learning][pytorch][original]crnn trains loss on the higher version of pytorch as a solution for Nan
Jenkins remote publishing products
I just did it! Visualization of character relationships in Douluo continent