当前位置:网站首页>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++; }
边栏推荐
- Programmers spend most of their time not writing code, but...
- It's so difficult for me. Have you met these interview questions?
- 5分+的单基因泛癌纯生信思路!
- 《opencv学习笔记》-- 感兴趣区域(ROI)、图像混合
- 不用做实验的6分+基因家族纯生信思路~
- 我真傻,招了一堆只会“谷歌”的程序员!
- LS-DYNA新手入门经验
- PHP短信通知+语音播报自动双呼
- What code did the full stack programmer write this month?
- 怎么可以打新债 开户是安全的吗
猜你喜欢
![[live review] battle code pioneer phase 7: how third-party application developers contribute to open source](/img/fa/e52bd8a1a404a759ef6ba88e8da0f0.png)
[live review] battle code pioneer phase 7: how third-party application developers contribute to open source

Qt: 判断字符串是否为数字格式

Qt: judge whether the string is in numeric format

万名校园开发者花式玩AI,亮点看这张图就够啦!

How is the e-commerce red envelope realized? For interview (typical high concurrency)

Linker --- linker

2D 照片变身 3D 模型,来看英伟达的 AI 新“魔法”!

GLOG from getting started to getting started

软件测试 对前一日函数的基本路径测试

Beauty of script │ VBS introduction interactive practice
随机推荐
怎么可以打新债 开户是安全的吗
A fault record of misoperation dhclient script
Tools and methods - use code formatting tools in source insight
Give you a server. Can you deploy your code online?
11+的基于甲基化组和转录组综合分析识别葡萄膜黑色素瘤中新的预后 DNA 甲基化特征~
Identification of new prognostic DNA methylation features in uveal melanoma by 11+ based on methylation group and transcriptome analysis~
Jenkins performance test
Libuv的安装及运行使用
[deep learning][pytorch][original]crnn trains loss on the higher version of pytorch as a solution for Nan
mRNA疫苗的研制怎么做?27+ 胰腺癌抗原和免疫亚型的解析来告诉你答案!
How stupid of me to hire a bunch of programmers who can only "Google"!
炒伦敦金短线稳定赚钱技巧?在哪里炒伦敦金安全靠谱?
Nacos source code - configure automatic update
怎么申请打新债 开户是安全的吗
Cause analysis of frequent crash and restart of easynvr-arm cloud terminal
Ten thousand campus developers play AI in a fancy way. It's enough to see this picture!
我真傻,招了一堆只会“谷歌”的程序员!
9+! Predicting lymph node status from histology of colorectal cancer by deep learning
5分+的单基因泛癌纯生信思路!
【老卫搞机】090期:键盘?主机?全功能键盘主机!