当前位置:网站首页>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!!!
边栏推荐
- Day-19 IO stream
- Attack and defense world ----- summary of web knowledge points
- GCC compilation error
- 什么是ESP/MSR 分区,如何建立ESP/MSR 分区
- Tutorial on principles and applications of database system (009) -- conceptual model and data model
- BGP actual network configuration
- HZOJ #240. 图形打印四
- Experiment with a web server that configures its own content
- [deep learning] image multi label classification task, Baidu paddleclas
- opencv的四个函数
猜你喜欢
静态Vxlan 配置
【统计学习方法】学习笔记——第五章:决策树
The left-hand side of an assignment expression may not be an optional property access.ts(2779)
Routing strategy of multi-point republication [Huawei]
Static vxlan configuration
2022广东省安全员A证第三批(主要负责人)考试练习题及模拟考试
Aike AI frontier promotion (7.7)
Static routing assignment of network reachable and telent connections
Vxlan 静态集中网关
【PyTorch实战】图像描述——让神经网络看图讲故事
随机推荐
Day-14 common APIs
【二叉树】删点成林
Talk about four cluster schemes of redis cache, and their advantages and disadvantages
[statistical learning methods] learning notes - improvement methods
图像像素读写操作
About IPSec
2022危险化学品生产单位安全生产管理人员考题及在线模拟考试
[play RT thread] RT thread Studio - key control motor forward and reverse rotation, buzzer
【从 0 开始学微服务】【02】从单体应用走向服务化
利用栈来实现二进制转化为十进制
Vxlan static centralized gateway
Decrypt gd32 MCU product family, how to choose the development board?
有什么类方法或是函数可以查看某个项目的Laravel版本的?
opencv的四个函数
Customize the web service configuration file
leetcode刷题:二叉树19(合并二叉树)
mysql怎么创建,删除,查看索引?
Day-16 set
Tutorial on the principle and application of database system (011) -- relational database
SQL lab 11~20 summary (subsequent continuous update) contains the solution that Firefox can't catch local packages after 18 levels