当前位置:网站首页>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!!!
边栏推荐
- Master formula. (used to calculate the time complexity of recursion.)
- idm服务器响应显示您没有权限下载解决教程
- Tutorial on the principle and application of database system (011) -- relational database
- About sqli lab less-15 using or instead of and parsing
- [statistical learning methods] learning notes - improvement methods
- Session
- Solutions to cross domain problems
- How to apply @transactional transaction annotation to perfection?
- SQL blind injection (WEB penetration)
- Day-14 common APIs
猜你喜欢
Dialogue with Wang Wenyu, co-founder of ppio: integrate edge computing resources and explore more audio and video service scenarios
金融数据获取(三)当爬虫遇上要鼠标滚轮滚动才会刷新数据的网页(保姆级教程)
NPM instal reports agent or network problems
Day-16 set
【PyTorch实战】用RNN写诗
SQL lab 21~25 summary (subsequent continuous update) (including secondary injection explanation)
Static vxlan configuration
【PyTorch实战】用PyTorch实现基于神经网络的图像风格迁移
SQL Lab (32~35) contains the principle understanding and precautions of wide byte injection (continuously updated later)
Attack and defense world ----- summary of web knowledge points
随机推荐
Decrypt gd32 MCU product family, how to choose the development board?
Dialogue with Wang Wenyu, co-founder of ppio: integrate edge computing resources and explore more audio and video service scenarios
Static comprehensive experiment
sql-lab (54-65)
opencv的四个函数
Common knowledge of one-dimensional array and two-dimensional array
File upload vulnerability - upload labs (1~2)
[statistical learning methods] learning notes - improvement methods
[爬虫]使用selenium时,躲避脚本检测
ps链接图层的使用方法和快捷键,ps图层链接怎么做的
SQL lab 26~31 summary (subsequent continuous update) (including parameter pollution explanation)
Session
Several methods of checking JS to judge empty objects
Day-14 common APIs
About web content security policy directive some test cases specified through meta elements
HZOJ #236. 递归实现组合型枚举
【统计学习方法】学习笔记——逻辑斯谛回归和最大熵模型
Realize all, race, allsettled and any of the simple version of promise by yourself
[statistical learning methods] learning notes - Chapter 4: naive Bayesian method
How much does it cost to develop a small program mall?