当前位置:网站首页>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!!!
边栏推荐
- Cookie
- The hoisting of the upper cylinder of the steel containment of the world's first reactor "linglong-1" reactor building was successful
- SQL Lab (46~53) (continuous update later) order by injection
- [爬虫]使用selenium时,躲避脚本检测
- 【统计学习方法】学习笔记——逻辑斯谛回归和最大熵模型
- 【PyTorch实战】图像描述——让神经网络看图讲故事
- Tutorial on the principle and application of database system (011) -- relational database
- [pytorch practice] write poetry with RNN
- Day-16 set
- ps链接图层的使用方法和快捷键,ps图层链接怎么做的
猜你喜欢
The hoisting of the upper cylinder of the steel containment of the world's first reactor "linglong-1" reactor building was successful
Session
Sorting, dichotomy
Static comprehensive experiment
MPLS experiment
File upload vulnerability - upload labs (1~2)
Decrypt gd32 MCU product family, how to choose the development board?
2022聚合工艺考试题模拟考试题库及在线模拟考试
[deep learning] image multi label classification task, Baidu paddleclas
Customize the web service configuration file
随机推荐
【PyTorch实战】图像描述——让神经网络看图讲故事
Pule frog small 5D movie equipment | 5D movie dynamic movie experience hall | VR scenic area cinema equipment
Day-20 file operation, recursive copy, serialization
Static vxlan configuration
[statistical learning methods] learning notes - improvement methods
xshell评估期已过怎么办
How to use PS link layer and shortcut keys, and how to do PS layer link
leetcode刷题:二叉树27(删除二叉搜索树中的节点)
Aike AI frontier promotion (7.7)
【统计学习方法】学习笔记——第四章:朴素贝叶斯法
Multi row and multi column flex layout
【PyTorch实战】用RNN写诗
浅谈估值模型 (二): PE指标II——PE Band
[pytorch practice] write poetry with RNN
[play RT thread] RT thread Studio - key control motor forward and reverse rotation, buzzer
Polymorphism, final, etc
Several ways to clear floating
SQL Lab (36~40) includes stack injection, MySQL_ real_ escape_ The difference between string and addslashes (continuous update after)
About sqli lab less-15 using or instead of and parsing
Talk about four cluster schemes of redis cache, and their advantages and disadvantages