当前位置:网站首页>Opencv learning notes - loading and saving images
Opencv learning notes - loading and saving images
2022-06-24 12:05:00 【cc_ rong】
Catalog
Image loading :imread() function
Image saving :imwrite() function
Image loading :imread() function
Mat imread(const string& filename, int flags = IMREAD_COLOR )Parameter one : The name of the image
Parameter two : Read tag , Used to select how to read pictures , The default value is IMREAD_COLOR,flag The setting of the value is related to the color format used to read the picture .
IMREAD_COLOR: Always read three channel images
IMREAD_GRAYSCALE: Always read single channel
IMREAD_ANYCOLOR: The number of channels is determined by the actual number of channels in the file ( No more than 3)
IMREAD_ANYDEPTH: Allow loading more than 8bit depth
IMREAD_UNCHANGED: ( When reading an image , Keep in image alpha passageway )
Image format types are supported ;
Image saving :imwrite() function
bool imwrite(const string& filename,
InputArray image,
const vector<int>& params = vector<int>())Parameter one : Save the given file name , Extension :
jpg perhaps jpeg、jp2、tif or tiff、png( Recommended )、bmp、ppm、pgm
Parameter two : Stored input image .
Parameter 3 : Data required for writing to a special type of file
Code
// Read images Mat image = imread("1.jpg"); // Judge whether the reading is successful if(image.data == NULL) { return ; } // Show imshow("readImg", image); // Save image if(!imwrite("1To2.jpg", image)) { return ; }
边栏推荐
- 怎样申请打新债 开户是安全的吗
- Embedded must learn! Detailed explanation of hardware resource interface - based on arm am335x development board (Part 1)
- 广发证券靠谱吗?开证券账户安全吗?
- How to use data analysis tools to deal with emergencies in retail industry
- 电商红包雨是如何实现的?拿去面试用(典型高并发)
- How stupid of me to hire a bunch of programmers who can only "Google"!
- 《opencv学习笔记》-- CV::Mat类
- 5 points + single gene pan cancer pure Shengxin idea!
- Embedded must learn! Detailed explanation of hardware resource interface - based on arm am335x development board (Part 2)
- [Flink source code practice (I)] add a rest API to Flink
猜你喜欢

如何优雅的写 Controller 层代码?

GLOG从入门到入门

工具及方法 - 在Source Insight中使用代码格式化工具

《opencv学习笔记》-- 分离颜色通道、多通道混合

Qt: judge whether the string is in numeric format
![[live review] battle code pioneer phase 7: how third-party application developers contribute to open source](/img/fa/e52bd8a1a404a759ef6ba88e8da0f0.png)
[live review] battle code pioneer phase 7: how third-party application developers contribute to open source

Libuv的安装及运行使用

Tools and methods - use code formatting tools in source insight

Install Kali on the U disk and persist it

2D 照片变身 3D 模型,来看英伟达的 AI 新“魔法”!
随机推荐
Cause analysis of frequent crash and restart of easynvr-arm cloud terminal
Influence of DEX optimization on arouter lookup path
软件测试 对前一日函数的基本路径测试
8 types of API automated testing that technicians must know
《opencv学习笔记》-- 离散傅里叶变换
Deep learning ~11+ a new perspective on disease-related miRNA research
How to develop mRNA vaccine? 27+ pancreatic cancer antigen and immune subtype analysis to tell you the answer!
哪个商业保险养老险好?2022年商业养老保险产品排名
d的10个0符
[deep learning][pytorch][original]crnn trains loss on the higher version of pytorch as a solution for Nan
Nacos source code - Interface read configuration
Popular science of data annotation: ten common image annotation methods
2021-06-03: Boolean operation. Given a Boolean expression and an expected cloth
怎样购买打新债 开户是安全的吗
GLOG从入门到入门
Audio knowledge (III) -- MFCCs code implementation
TP-LINK 1208路由器教程(2)
Database migration tool flyway vs liquibase (II)
Ten thousand campus developers play AI in a fancy way. It's enough to see this picture!
Shell脚本(.sh文件)如何执行完毕之后不自动关闭、闪退?
