当前位置:网站首页>Creation and assignment of graphic objects
Creation and assignment of graphic objects
2022-07-07 12:46:00 【When will we get ashore?】
Here is the sample code :
void demo::tuxiang_creation()
{
Mat m3 = Mat::ones(Size(400, 400), CV_8UC3);
//std::cout << "width " << m3.cols << "height " << m3.rows << "channels " << m3.channels() << std::endl;
m3 = Scalar(0,255,0);
//std::cout << m3 << std::endl;
//imshow(" Create an image ", m3);
//Mat m4 = m3;
Mat m4;
m4=m3.clone();
m4 = Scalar(255, 0, 0);
imshow(" Images ", m3);
imshow(" Images 4", m4);
}
stay opencv The basic calculation unit is matrix , use Mat As a prefix, you can define the matrix , stay C++ The most important concept is the concept of class , We can Mat As a matrix class , The class contains some basic operations on the class , and ones( Image size , Channel type ), It is such an operation , It creates a pixel for 400x400, Three channel images , Assign the return value to m3.
std::cout << "width " << m3.cols << "height " << m3.rows << "channels " << m3.channels() << std::endl;
// The president of the output matrix , Column length , Element length
give the result as follows :
Assign a value to a matrix , If you assign a value to the matrix directly , for example m3=255, Just give m3 The first value of the element is assigned 255, The rest of the element remains unchanged ,
m3 = 255;
std::cout << m3 << std::endl;
Mat m4=m3;
m4 And m3 Share one data ,m4 When the change ,m3 Also change at the same time , Empathy ,m3 change ,m4 It will change too. , Like C++ The concepts cited in it .
Another point was discovered today , Namely imshow() If the name of the created window is the same , He will only show one window , The latter window will overwrite the previous window .
over!!!
边栏推荐
- 2022危险化学品生产单位安全生产管理人员考题及在线模拟考试
- About web content security policy directive some test cases specified through meta elements
- xshell评估期已过怎么办
- Object. Simple implementation of assign()
- What if does not match your user account appears when submitting the code?
- GCC compilation error
- 编译 libssl 报错
- [pytorch practice] write poetry with RNN
- leetcode刷题:二叉树24(二叉树的最近公共祖先)
- [statistical learning methods] learning notes - Chapter 4: naive Bayesian method
猜你喜欢
【PyTorch实战】用PyTorch实现基于神经网络的图像风格迁移
Customize the web service configuration file
[statistical learning methods] learning notes - Chapter 5: Decision Tree
SQL lab 11~20 summary (subsequent continuous update) contains the solution that Firefox can't catch local packages after 18 levels
Configure an encrypted web server
Aike AI frontier promotion (7.7)
ps链接图层的使用方法和快捷键,ps图层链接怎么做的
Preorder, inorder and postorder traversal of binary tree
Day-18 hash table, generic
Tutorial on principles and applications of database system (010) -- exercises of conceptual model and data model
随机推荐
layer弹出层的关闭问题
Day-19 IO stream
sql-lab (54-65)
【PyTorch实战】图像描述——让神经网络看图讲故事
leetcode刷题:二叉树27(删除二叉搜索树中的节点)
Vxlan static centralized gateway
用mysql查询某字段是否有索引
通讯协议设计与实现
【从 0 开始学微服务】【00】课程概述
ps链接图层的使用方法和快捷键,ps图层链接怎么做的
Sorting, dichotomy
Static comprehensive experiment
leetcode刷题:二叉树19(合并二叉树)
"Series after reading" my God! It's so simple to understand throttling and anti shake~
visual stdio 2017关于opencv4.1的环境配置
Session
SQL Lab (46~53) (continuous update later) order by injection
JS to convert array to tree data
Processing strategy of message queue message loss and repeated message sending
HZOJ #236. 递归实现组合型枚举