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; ...
随机推荐
- python3 中 and 和 or 运算规律
一.包含一个逻辑运算符 首先从基本的概念着手,python中哪些对象会被当成 False 呢?而哪些又是 True 呢? 在Python中,None.任何数值类型中的0.空字符串“”.空元组().空列 ...
- 5.6(java学习笔记) queue
一.queue接口 queue的中文意思是队列,是一种以先进先出方式处理数据的集合. 队列还提供额外的插入.提取和检查操作.这些方法都以两种形式存在:一种在操作失败时抛出异常,另一种返回特殊值(根据操 ...
- 1.9(java学习笔记)object类及toString()与equals()方法
object类 java中objec是所有类公共的父类,一个类只要没有明显的继承某一类,那么它就是继承object类. 例如 class Person {......};和class Person e ...
- Android中的动态字符串的处理
1.效果显示 2. MainAcitivity.java package com.example.app2; import android.support.v7.app.AppCompatActivi ...
- NDK 调用对象属性
JNIEXPORT jbyteArrayJNICALL Java_com_lanhetech_iso8583_nativeLib_Iso8583NativeLib_pubPack8583 (JNIEn ...
- Spring Boot使用@Async实现异步调用
原文:http://blog.csdn.net/a286352250/article/details/53157822 项目GitHub地址 : https://github.com/FrameRes ...
- JS版汉字与拼音互转终极方案,附简单的JS拼音输入法
原文:http://www.cnblogs.com/liuxianan/p/pinyinjs.html 前言 网上关于JS实现汉字和拼音互转的文章很多,但是比较杂乱,都是互相抄来抄去,而且有的不支持多 ...
- 【转】谈基于SOA的应用系统设计和开发
注:在网上看到这篇文档,觉得写得很好,清晰实用.该博客其它文章也写得不错 地址:http://blog.sina.com.cn/s/blog_493a84550101gswn.html 现在对 ...
- golang构造单链表
原文地址:http://www.niu12.com/article/47package main import "fmt" type ListNode struct { Value ...
- js判断上传文件的大小、类型、修改日期等信息
1.找到上传文件的前端代码,下断点,进行调试,使用jquery获得上传文件对象 2.鼠标放到文件对象fielEl上,弹出文件对象具体内容,可以看大文件对象的:上次修改时间.名字.大小.类型等信息 3. ...