OpenCV学习笔记——imread、imwrite以及imshow
1、imread
Loads an image from a file. 从文件中读取图像。
C++: Mat imread(const string& filename, int flags=1 )
Parameters: 参数:
- filename – Name of file to be loaded. 文件名
- flags –
Flags specifying the color type of a loaded image:
- >0 Return a 3-channel color image 返回一个三通道的图像
- =0 Return a grayscale image 返回灰度图像
- <0 Return the loaded image as is. Note that in the current implementation the alpha channel, if any, is stripped from the output image. For example, a 4-channel RGBA image is loaded as RGB if
.
2、imwrite
Saves an image to a specified file. 把图像保存到特定路径下。
- C++: bool imwrite(const string& filename, InputArray image, const vector<int>& params=vector<int>())
- Parameters:
- filename – Name of the file. 文件名
- image – Image to be saved. 图像
- params –
Format-specific save parameters encoded as pairs paramId_1, paramValue_1, paramId_2, paramValue_2, ... . The following parameters are currently supported:
- For JPEG, it can be a quality ( CV_IMWRITE_JPEG_QUALITY ) from 0 to 100 (the higher is the better). Default value is 95. 对于JPEG,图像质量。
- For PNG, it can be the compression level ( CV_IMWRITE_PNG_COMPRESSION ) from 0 to 9. A higher value means a smaller size and longer compression time. Default value is 3. 对于PNG,压缩等级。
- For PPM, PGM, or PBM, it can be a binary format flag ( CV_IMWRITE_PXM_BINARY ), 0 or 1. Default value is 1.
3、imshow
Displays an image in the specified window. 在特定的窗口上显示图像。
C++: void imshow(const string& winname, InputArray image)
Parameters:
- winname – Name of the window. 窗口名称。
- image – Image to be shown. 要显示的图像。
[1] http://www.opencv.org.cn/opencvdoc/2.3.2/html/doc/tutorials/core/mat%20-%20the%20basic%20image%20containe/mat%20-%20the%20basic%20image%20container.html#matthebasicimagecontainer
OpenCV学习笔记——imread、imwrite以及imshow的更多相关文章
- opencv学习笔记(一)IplImage, CvMat, Mat 的关系
opencv学习笔记(一)IplImage, CvMat, Mat 的关系 opencv中常见的与图像操作有关的数据容器有Mat,cvMat和IplImage,这三种类型都可以代表和显示图像,但是,M ...
- OpenCV 学习笔记 02 使用opencv处理图像
1 不同色彩空间的转换 opencv 中有数百种关于不同色彩空间的转换方法,但常用的有三种色彩空间:灰度.BRG.HSV(Hue-Saturation-Value) 灰度 - 灰度色彩空间是通过去除彩 ...
- 【opencv学习笔记五】一个简单程序:图像读取与显示
今天我们来学习一个最简单的程序,即从文件读取图像并且创建窗口显示该图像. 目录 [imread]图像读取 [namedWindow]创建window窗口 [imshow]图像显示 [imwrite]图 ...
- opencv学习笔记D01
目录 opencv学习笔记D01 一.图片读取 二.图片保存 三.图片展示 四.图片缩放 五.四种常用插值方式的比较 1.最近邻插值 2.双线性插值 3.区域插值 4.三次样条插值 我是尾巴: ope ...
- opencv学习笔记(五)镜像对称
opencv学习笔记(五)镜像对称 设图像的宽度为width,长度为height.(x,y)为变换后的坐标,(x0,y0)为原图像的坐标. 水平镜像变换: 代码实现: #include <ios ...
- opencv学习笔记(二)寻找轮廓
opencv学习笔记(二)寻找轮廓 opencv中使用findContours函数来查找轮廓,这个函数的原型为: void findContours(InputOutputArray image, O ...
- OpenCV 学习笔记(模板匹配)
OpenCV 学习笔记(模板匹配) 模板匹配是在一幅图像中寻找一个特定目标的方法之一.这种方法的原理非常简单,遍历图像中的每一个可能的位置,比较各处与模板是否"相似",当相似度足够 ...
- OpenCV 学习笔记 07 目标检测与识别
目标检测与识别是计算机视觉中最常见的挑战之一.属于高级主题. 本章节将扩展目标检测的概念,首先探讨人脸识别技术,然后将该技术应用到显示生活中的各种目标检测. 1 目标检测与识别技术 为了与OpenCV ...
- OpenCV 学习笔记03 boundingRect、minAreaRect、minEnclosingCircle、boxPoints、int0、circle、rectangle函数的用法
函数中的代码是部分代码,详细代码在最后 1 cv2.boundingRect 作用:矩形边框(boundingRect),用于计算图像一系列点的外部矩形边界. cv2.boundingRect(arr ...
随机推荐
- Bootstrap03
一.表单(以下示例 * 代表class) 注意:a.使用表单的关键字form b.所有的提示词使用label包裹 c.所写内容按div分类,使得层次分明 1.基本表单+表单组合+内联表单 *=form ...
- spring data elasticsearch 使用
很久之前就安装了elasticsearch,一直没用java用过,最近看了一下spring data系列的elasticsearch,这里写一篇心得. 如果尚未安装elasticsearch,可以 参 ...
- anaconda创建python虚拟环境
参考: 1.https://blog.csdn.net/lyy14011305/article/details/59500819 我的安装过程: 1. 之前已经安装了anaconda,我的版本是ana ...
- node.js之express中app.use
express中app.use 用法: app.use([path,] function [, function…]) 一.app.use() 在express中是怎么工作的 app.use在expr ...
- hadoop deployment
本文主要是以安装和使用hadoop-0.12.0为例,指出在部署Hadoop的时候容易遇到的问题以及如何解决. 硬件环境共有3台机器,均使用的FC5系统,Java使用的是jdk1.6.0.IP配置如下 ...
- Storyboarding by Scripting
Storyboarding by Scripting In the .osu file, under [Events]:Note: underscores can be replaced with s ...
- C# Disable CTRL-ALT-DEL, ALT-TAB, ALT-F4, Start Menu and so on…
使用C#禁用系统的某些特定按键 原文地址:http://www.tamas.io/c-disable-ctrl-alt-del-alt-tab-alt-f4-start-menu-and-so-on/ ...
- #333. 【NOIP2017】宝藏
#333. [NOIP2017]宝藏 http://uoj.ac/problem/333 1.错误的$n^42^n$做法: dp[s]表示当前的点集为s,然后从这些点中选一个做起点i,然后枚举边,然后 ...
- 二分查找的C#实现
二分查找也称折半查找(Binary Search),它是一种效率较高的查找方法.但是,折半查找要求线性表必须采用顺序存储结构,而且表中元素按关键字有序排列. 查找过程 首先,假设表中元素是按升序排列, ...
- [.NET] 使用HttpClient操作HFS (HTTP File Server)
前言 本篇文章介绍如何使用HttpClient操作HFS (HTTP File Server),为自己留个纪录也希望能帮助到有需要的开发人员.关于HTTP File Server的介绍.安装.设定,可 ...