当前位置:网站首页>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++; }
边栏推荐
- Adobe Photoshop using the box selection tool for selection tutorial
- Give you a server. Can you deploy your code online?
- 12+!不同癌症中TMB与ICI反应之间的免疫相关因素研究
- I just did it! Visualization of character relationships in Douluo continent
- 嵌入式必学!硬件资源接口详解——基于ARM AM335X开发板 (上)
- 数据标注科普:十种常见的图像标注方法
- 怎样申请打新债 开户是安全的吗
- 如何开发短信通知和语音功能医院信息系统(HIS系统)
- 【206】使用php语言去生成go语言的代码
- How to open a video number?
猜你喜欢

Insurance app aging service evaluation analysis 2022 issue 06

Beauty of script │ VBS introduction interactive practice

@Requestbody annotation

Install Kali on the U disk and persist it

Qt: judge whether the string is in numeric format

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

如何优雅的写 Controller 层代码?

AXI低功耗接口

工具及方法 - 在Source Insight中使用代码格式化工具
[Old Wei makes machines] issue 090: keyboard? host? Full function keyboard host!
随机推荐
广发证券靠谱吗?开证券账户安全吗?
计组-总复习
How stupid of me to hire a bunch of programmers who can only "Google"!
Database migration tool flyway vs liquibase (II)
为什么虚拟机ping的通主机,主机ping不通虚拟机
How to improve the quality of Baidu keyword?
Basic path test of software test on the function of the previous day
Google ranging for PHP wechat development
Influence of DEX optimization on arouter lookup path
Istio best practice: graceful termination
电商红包雨是如何实现的?拿去面试用(典型高并发)
[206] use PHP language to generate the code of go language
8 types of API automated testing that technicians must know
[deep learning][pytorch][original]crnn trains loss on the higher version of pytorch as a solution for Nan
Embedded must learn! Detailed explanation of hardware resource interface - based on arm am335x development board (Part 1)
【直播回顾】战码先锋第七期:三方应用开发者如何为开源做贡献
Example of PHP observer mode [useful in the laravel framework]
How to purchase new bonds is it safe to open an account
ArrayList # sublist these four holes, you get caught accidentally
TP-LINK 1208 router tutorial (2)