当前位置:网站首页>《opencv学习笔记》-- 图像的载入和保存
《opencv学习笔记》-- 图像的载入和保存
2022-06-24 10:00:00 【cc_rong】
目录
图像载入:imread()函数
Mat imread(const string& filename, int flags = IMREAD_COLOR )参数一:图像的名称
参数二:读取标记,用于选择读取图片的方式,默认值为IMREAD_COLOR,flag值的设定与用什么颜色格式读取图片有关。
IMREAD_COLOR: 总是读取三通道图像
IMREAD_GRAYSCALE: 总是读取单通道
IMREAD_ANYCOLOR: 通道数由文件实际通道数(不超过3)
IMREAD_ANYDEPTH: 允许加载超过8bit深度
IMREAD_UNCHANGED: (读取图像时,保留图像中的alpha通道)
支持图像格式类型;
图像保存:imwrite()函数
bool imwrite(const string& filename,
InputArray image,
const vector<int>& params = vector<int>())参数一:保存给定的文件名,扩展名:
jpg或者jpeg、jp2、tif或tiff、png(推荐使用)、bmp、ppm、pgm
参数二:存储的输入图像。
参数三:特殊类型文件的写入操作时所需的数据
代码
// 读取图像 Mat image = imread("1.jpg"); // 判断是否读取成功 if(image.data == NULL) { return ; } // 显示 imshow("readImg", image); // 保存图像 if(!imwrite("1To2.jpg", image)) { return ; }
边栏推荐
- Cook a delicious cli
- Influence of DEX optimization on arouter lookup path
- 程序员大部分时间不是写代码,而是。。。
- Any 与 TypeVar,让 IDE 的自动补全更好用
- Which is a good CAD drawing software? How to select good software
- TP-LINK 1208 router tutorial (2)
- 脚本之美│VBS 入门交互实战
- Understanding of homogeneous coordinates
- How to make a good video? What are the operation methods?
- Lightweight deployment of firefoxsend temporary file sharing service using Tencent cloud
猜你喜欢

TP-LINK 1208 router tutorial (2)

Group counting_ Structure and workflow of CPU

Programmers spend most of their time not writing code, but...

Turn 2D photos into 3D models to see NVIDIA's new AI "magic"!

齐次坐标的理解

Today's sleep quality record 76 points

First acquaintance with string+ simple usage (I)

Svg+js drag slider round progress bar

How to develop hospital information system (his) with SMS notification and voice function

“一个优秀程序员可抵五个普通程序员!”
随机推荐
I want 18K. Can I pass it?
Opencv optical flow prediction and remap remapping function usage
Fais ce que tu veux.
Tencent geek challenge small - endless!
Disaster recovery series (II) -- enterprises' one-stop disaster recovery construction with the help of cloud platform?
A group of skeletons flying canvas animation JS special effect
Dedecms template file explanation and homepage label replacement
Qt: judge whether the string is in numeric format
"Adobe international certification" Adobe Photoshop adjusts cropping, rotation and canvas size
Cause analysis of frequent crash and restart of easynvr-arm cloud terminal
【毕业季·进击的技术er】绕树三匝,何枝可依?
Jetpack Compose 教程之 从一开始就投资于良好的导航框架将帮助您在之后节省大量的迁移工作
Many of my friends asked me what books and online classes I recommended. This time, I contributed all the materials that I had been hiding for a long time (Part 1)
PPT绘图相关,快捷键,美观度
Plant growth H5 animation JS special effect
Any and typevar make the automatic completion of IDE better
[the lottery in May has ended, and the list of winners has been announced] special session of techo youth university open course database
Remote desktop copy paste exception
[graduation season · attacking technology Er] three turns around the tree, what branch can we rely on?
What is the resource search platform and how resource search works
