Mat::operator =
Provides matrix assignment operators.
- C++: Mat& Mat::operator=(const Mat& m)
- C++: Mat& Mat::operator=(const MatExpr& expr)
- C++: Mat& Mat::operator=(const Scalar& s)
-
Parameters: - m – Assigned, right-hand-side matrix. Matrix assignment is an O(1) operation. This means that no data is copied but the data is shared and the reference counter, if any, is incremented. Before assigning new data, the old data is de-referenced via Mat::release() .
- expr – Assigned matrix expression object. As opposite to the first form of the assignment operation, the second form can reuse already allocated matrix if it has the right size and type to fit the matrix expression result. It is automatically handled by the real function that the matrix expressions is expanded to. For example, C=A+B is expanded to add(A, B, C), and add() takes care of automatic C reallocation.
- s – Scalar assigned to each matrix element. The matrix size or type is not changed.
These are available assignment operators. Since they all are very different, make sure to read the operator parameters description.
int main(int argc, char** argv)
{
Mat m = Mat(, , CV_8UC1); for (int i = ; i < m.rows; i++)
for (int j = ; j < m.cols; j++)
{
m.at<uchar>(i, j) = i;
} cout << "type:" << m.type() << endl;
cout << "CV_8UC1:" << CV_8UC1 << endl;
cout << "depth:" << m.depth() << endl;
cout << "channel:" << m.channels() << endl;
printf("m-data address:%p\n", m.data); //printMat(m); //cout << "m:" << endl;
//cout << m << endl; Mat imageR = Mat::zeros(,,CV_8UC1);
printf("imageR-data address:%p\n", imageR.data);
//cout << imageR << endl;
//cout << endl;
imageR = m;//会将imageR的数据指针指向m的数据地址
printf("imageR-data address:%p\n", imageR.data);
//cout << imageR << endl; //result
//m-data address:0x178d3e0
//imageR-data address:0x178d450
//imageR-data address:0x178d3e0 return ;
}
Mat::operator =的更多相关文章
- OpenCV MAT基本图像容器
参考博客: OpenCv中cv::Mat和IplImage,CvMat之间的转换 Mat - 基本图像容器 Mat类型较CvMat和IplImage有更强的矩阵运算能力,支持常见的矩阵运算(参照Mat ...
- CvMat and cv::Mat
CvMat: typedef struct CvMat { int type; int step; /* for internal use only */ int* refcount; int hdr ...
- OpenCV中Mat的详解
每次碰到Mat都得反复查具体的用法,网上的基础讲解不多,难得看到一篇,赶快转来收藏~ 原文地址:http://www.opencvchina.com/thread-1039-1-1.html 目标 我 ...
- Mat的详解
[转]OpenCV中Mat的详解 每次碰到Mat都得反复查具体的用法,网上的基础讲解不多,难得看到一篇,赶快转来收藏~ 原文地址:http://www.opencvchina.com/thread-1 ...
- ncnn 源码学习-Mat.h Mat.c
纯小白记录下腾讯的ncnn框架源码的学习.纯粹写给自己看的,不保证正确性. Mat 类似于 caffe中的blob,是一个张量的存储结构体. 一.数据成员: 1.void * data 多维数据按一位 ...
- Mat类具体解释(二)
Mat::~Mat Mat的析构函数. C++: Mat::~Mat() 析构函数调用Mat::release(). Mat::operator = 提供矩阵赋值操作. C++: Mat& M ...
- OPENCV mat类
OpenCV参考手册之Mat类详解 目标 我们有多种方法可以获得从现实世界的数字图像:数码相机.扫描仪.计算机体层摄影或磁共振成像就是其中的几种.在每种情况下我们(人类)看到了什么是图像.但是,转换图 ...
- mat 和IPIImage之间的转换
opencv2.3.1 Mat::operator IplImageCreates the IplImage header for the matrix.C++: Mat::operator IplI ...
- 【opencv 源码剖析】 四、 Mat的赋值构造函数 和 拷贝构造函数
1.赋值构造函数 右值引用 inline Mat& Mat::operator = (Mat&& m) { if (this == &m) return *this; ...
随机推荐
- 【点分治】bzoj2152 聪聪可可
模板题. #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> ...
- JQuery使用trigger模拟触发selete的选择change事件
<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8& ...
- 安装CentOS 6停在selinux-policy-targeted卡住的问题解决
在刚开始安装时,设置swap分区.设置swap分区.设置swap分区 参考: http://tieba.baidu.com/p/3817971339 http://blog.csdn.net/zhan ...
- [Javascript]js判断是否为undefined类型
概述 在项目获取某个元素的值会出现undefined,所以对这种情况要有特殊处理. 可通过下面的代码判断是否为undefined类型. if (typeof(reValue) == "und ...
- iOS -- 解决iOS11中navigationBar上使用initWithCustomView按钮图片错位 frame无效
在iOS11上当使用如下代码设置时 UIButton *shareButton = [UIButton buttonWithType:(UIButtonTypeCustom)]; shareButto ...
- VBA数组
基础用法,这篇写的不错:https://www.cnblogs.com/wuzhiblog/p/7137578.html
- Solr6.6.0 用 SimplePostTool索引文件 中文乱码
在用SimplePostTool工具导入CSV文件,文件内容如下: 启动solr ,利用命令导入:java -Dtype=text/csv -Dc=solr_test -jar post.jar .. ...
- scrapy-splash抓取动态数据例子十五
一.介绍 本例子用scrapy-splash爬取电视之家(http://www.tvhome.com/news/)网站的资讯信息,输入给定关键字抓取微信资讯信息. 给定关键字:数字:融合:电视 抓取信 ...
- tomcat环境部署
环境说明 系统版本 CentOS 7.2 x86_64 软件版本 jdk-8u171 tomcat-8.0.27 1.tomcat介绍及软件包准备 Tomcat是Apache软件基金会 ...
- mui 事件绑定(on)
除了可以使用addEventListener()方法监听某个特定元素上的事件外, 也可以使用.on()方法实现批量元素的事件绑定. 示例: 点击新闻列表,获取当前列表项的id,并将该id传给新闻详情页 ...