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; ...
随机推荐
- 【AC自动机】【矩阵乘法】poj2778 DNA Sequence
http://blog.csdn.net/morgan_xww/article/details/7834801 讲得很好~可以理解自动机的本质,就是一个用来状态转移的东西~对于确定的输入而言,可以从初 ...
- pandas操作,感觉不错,复制过来的
整理pandas操作 本文原创,转载请标识出处: http://www.cnblogs.com/xiaoxuebiye/p/7223774.html 导入数据: pd.read_csv(filenam ...
- GAILS里面的SAVE方法
用途 保存一个domain类的实例到数据库,需要的话会级联保存所有的子实例. 举例 def b = new Book(title:"The Shining") b.save() 描 ...
- [HTML/CSS]盒子模型,块级元素和行内元素
目录 概述 盒子模型 块级元素 行内元素 可变元素 总结 概述 在div+css中,了解块级元素和行内元素还是非常有必要的,比如:对行内元素使用width属性就会失效.虽然自己不是做前端的,但是,在项 ...
- JavaScript字符串api简单说明
1.可返回指定位置的字符 stringObject.charAt(index); 2.返回的是位于指定位置的字符的编码 stringObject.charCodeAt(index); 3.用于连接两个 ...
- python之web路径扫描工具
# coding: UTF-8 import sys, os, time, httplibimport relist_http=[] #http数组 def open_httptxt(): #打开 ...
- 创建 git仓库
首先创建一个文件夹作为git仓库,创建一个test文件夹,并在文件夹下创建一个test.c的文件用以测试: git init git使用git init来初始化一个git仓库,git的很多命令都是在g ...
- cinemachine unity
scrips extending timeline Extending Timeline with your own playables Data Audio ----playable beh ...
- 怎样在点击li时添加样式,移除兄弟样式
<style type="text/css"> .add{ color:#ff0} </style> <div> <ul> < ...
- 【CloudFoundry】架构、设计参考
参考资料: Cloud Foundry:http://baike.baidu.com/link?url=eIfPiUI8UlsqwnnSmmZ-WFyzrf38P33lJae4Hipsd0ynwXZp ...