当前位置:网站首页>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!!!
边栏推荐
- SQL Lab (41~45) (continuous update later)
- Tutorial on principles and applications of database system (009) -- conceptual model and data model
- 广州市召开安全生产工作会议
- 【从 0 开始学微服务】【01】什么是微服务
- On valuation model (II): PE index II - PE band
- Static routing assignment of network reachable and telent connections
- [learn micro services from 0] [02] move from single application to service
- HZOJ #236. 递归实现组合型枚举
- The left-hand side of an assignment expression may not be an optional property access.ts(2779)
- layer弹出层的关闭问题
猜你喜欢

OSPF exercise Report

SQL Lab (36~40) includes stack injection, MySQL_ real_ escape_ The difference between string and addslashes (continuous update after)

Tutorial on principles and applications of database system (009) -- conceptual model and data model

About sqli lab less-15 using or instead of and parsing

【统计学习方法】学习笔记——第五章:决策树

Day-18 hash table, generic

Idea 2021 Chinese garbled code

Airserver automatically receives multi screen projection or cross device projection

Dialogue with Wang Wenyu, co-founder of ppio: integrate edge computing resources and explore more audio and video service scenarios

Static routing assignment of network reachable and telent connections
随机推荐
Vxlan static centralized gateway
Master formula. (used to calculate the time complexity of recursion.)
Day-19 IO stream
Tutorial on principles and applications of database system (010) -- exercises of conceptual model and data model
"Series after reading" my God! It's so simple to understand throttling and anti shake~
Financial data acquisition (III) when a crawler encounters a web page that needs to scroll with the mouse wheel to refresh the data (nanny level tutorial)
Static comprehensive experiment
Several ways to clear floating
用mysql查询某字段是否有索引
Multi row and multi column flex layout
【从 0 开始学微服务】【02】从单体应用走向服务化
MPLS experiment
Importance of database security
SQL lab 26~31 summary (subsequent continuous update) (including parameter pollution explanation)
解密GD32 MCU产品家族,开发板该怎么选?
爱可可AI前沿推介(7.7)
【统计学习方法】学习笔记——支持向量机(上)
解决 Server returns invalid timezone. Go to ‘Advanced’ tab and set ‘serverTimezone’ property manually
ACL 2022 | 序列标注的小样本NER:融合标签语义的双塔BERT模型
About sqli lab less-15 using or instead of and parsing