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 开发面试题(常用模块以及第三方库)6.5
""" 1. os和sys都是干什么的? 2. 你工作中都用过哪些内置模块? 3. 有没有用过functools模块? """ #sys模块 ...
- Java高级架构师(一)第20节:X-gen生成需要的Action
package cn.javass.themes.smvcsm.actions; import cn.javass.xgen.genconf.vo.ModuleConfModel; import cn ...
- 触摸事件onTouchListener
1.效果图: (1)MainAcivity.java package com.example.app3; import android.content.DialogInterface; import ...
- 查看Java代码对应的汇编指令又一利器,JITWatch 转
http://www.tuicool.com/articles/IRrIRb3 时间 2015-05-13 08:00:00 Liuxinglanyue's Blog 原文 http://java ...
- 微信 JS SDK 的 chooseImage 接口在部分安卓机上容易造成页面刷新
该问题的症状是,当调用 chooseImage 接口并选择拍照,选择照片确定之后,然后从相机返回后,当前web页面就刷新了一次,导致拍照的图片无法选择上传:但是如果直接从相册中选择图片,则不会出现这个 ...
- Android 多线程之IntentService 完全详解
关联文章: Android 多线程之HandlerThread 完全详解 Android 多线程之IntentService 完全详解 android多线程-AsyncTask之工作原理深入解析(上) ...
- Go测试,功能测试,性能测试,测试辅助,go test 工具,高级测试,IO相关测试,黑盒测试,HTTP测试,进程测试
go命令教程: http://wiki.jikexueyuan.com/project/go-command-tutorial/0.5.html Go测试 第一个测试 “Hello Test!” 首先 ...
- DELPHI MAKEWORD的用法
WORD MAKEWORD( BYTE bLow, // low-order byte of short value BYTE bHigh // high-order byte of ...
- HTC相关开发所需SDK等工具都在这里了。 【转】
OpenVR SDK https://github.com/ValveSoftware/openvr OpenVR SDK是由原本的SteamWorks SDK更新而来,新增对HTC VIVE开发者 ...
- 《深入理解Java虚拟机》笔记2
都知道Java对内存是自动垃圾回收的,什么样的内存是可以回收的? 这个问题是值得思考的. 对象已死的判定方法有两种: (1)引用计数器法 给对象添加一个引用计数器,有一个地方用到此对象,计数器加一. ...