python opencv imwrite()方法 cv :: ImwriteFlags (写入图片、保存图片)
from init.py:
opencv版本4.1.0,不同版本也许doc稍有不同
def imwrite(filename, img, params=None): # real signature unknown; restored from __doc__"""imwrite(filename, img[, params]) -> retval. @brief Saves an image to a specified file. 将图像保存到指定文件. . The function imwrite saves the image to the specified file. The image format is chosen based on the. filename extension (see cv::imread for the list of extensions). In general, only 8-bit. single-channel or 3-channel (with 'BGR' channel order) images. can be saved using this function, with these exceptions:· imwrite函数将图像保存到指定文件。 图像格式是根据文件扩展名选择的(扩展名列表请参见cv :: imread)。 · 通常,使用此功能只能保存8位单通道或3通道(具有“ BGR”通道顺序)图像,但以下情况除外:. - 16-bit unsigned (CV_16U) images can be saved in the case of PNG, JPEG 2000, and TIFF formats. - 32-bit float (CV_32F) images can be saved in PFM, TIFF, OpenEXR, and Radiance HDR formats;· 对于PNG,JPEG 2000和TIFF格式,可以保存16位无符号(CV_16U)图像;· 可以PFM,TIFF,OpenEXR和Radiance HDR格式保存32位浮点(CV_32F)图像;. 3-channel (CV_32FC3) TIFF images will be saved using the LogLuv high dynamic range encoding. (4 bytes per pixel). - PNG images with an alpha channel can be saved using this function. To do this, create. 8-bit (or 16-bit) 4-channel image BGRA, where the alpha channel goes last. Fully transparent pixels. should have alpha set to 0, fully opaque pixels should have alpha set to 255/65535 (see the code sample below).· 使用LogLuv高动态范围编码(每像素4个字节)将保存3通道(CV_32FC3)TIFF图像-使用此功能可以保存具有alpha通道的PNG图像。 · 为此,创建8位(或16位)4通道图像BGRA,其中alpha通道位于最后。 · 完全透明的像素应将alpha设置为0,完全不透明的像素应将alpha设置为255/65535(请参见下面的代码示例)。. . If the format, depth or channel order is different, use. Mat::convertTo and cv::cvtColor to convert it before saving. Or, use the universal FileStorage I/O. functions to save the image to XML or YAML format.· · 如果格式,深度或通道顺序不同,请在保存之前使用Mat :: convertTo和cv :: cvtColor进行转换。 · 或者,使用通用的FileStorage I / O功能将图像保存为XML或YAML格式。. . The sample below shows how to create a BGRA image and save it to a PNG file. It also demonstrates how to set custom. compression parameters:· 下面的示例演示如何创建BGRA图像并将其保存到PNG文件。 它还演示了如何设置自定义压缩参数:. @include snippets/imgcodecs_imwrite.cpp. @param filename Name of the file. 文件名。. @param img Image to be saved. 要保存的图像。. @param params Format-specific parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ... .) see cv::ImwriteFlags特定格式的参数编码为对(paramId_1,paramValue_1,paramId_2,paramValue_2等)。请参见cv :: ImwriteFlags"""pass
Doc中所指cv :: ImwriteFlags:链接
参考文章:OpenCV笔记1:用imwrite函数来保存图片
python opencv imwrite()方法 cv :: ImwriteFlags (写入图片、保存图片)相关推荐
- python opencv 批量将视频转化为图片
单个的视频转换图片参看: python opencv 把视频转为图片 对于多个视频,采用多线程处理方法 video_path为待转换视频的路径,pic_path为输出图像的路径,输出的图像统一保存在p ...
- Python+OpenCV图像处理(二)——打印图片属性、设置图片存储路径、电脑摄像头的调取和显示...
一. 打印图片属性.设置图片存储路径 代码如下: #打印图片的属性.保存图片位置 import cv2 as cv import numpy as np #numpy是一个开源的Python科学计算库 ...
- python+opencv安装方法,以及关键问题解决【win,linux,mac】
本人早前写了一篇python安装opencv的文章,时过境迁,旧方法已经不是那么好用.于是,本文更新一下安装opencv的方法. 大家只需看分割线之前即可. 适用系统:windows,linux, m ...
- opencv imwrite()函数中 ImwriteFlags 的 cv.IMWRITE_JPEG_RST_INTERVAL(JPEG restart interval 重启间隔)是什么?
参考文章1:jpeg重新启动标记 参考文章2:JPEG标记码标准 参考文章3:JPEG文件格式解析
- Python OpenCV:利用鼠标移动缩放图片
一.实现目标 在OpenCV中通过鼠标左键拖拽移动图片,通过鼠标滚轮前后旋转放大缩小图片. 二.实现背景 在前一篇博客在OpenCV中使用滚动条显示大图中发现自己画滚动条移动大图略显繁琐,且缩 ...
- python opencv 中bmp转raw格式图片并展示
python中bmp转raw格式图片并展示 import numpy as np import cv2 img = cv2.imread('data/04/04(1).bmp') # 这里需要我们在当 ...
- python opencv通过4个坐标,剪裁图片(抠图)
一.opencv 裁剪说明 效果展示,要裁剪的图片 裁剪出的单词图像(如下) 这里程序我是用在paddleOCR里面,通过识别模型将识别出的图根据程序提供的坐标(即四个顶点的值)进行抠图的程序(上面的 ...
- python cv2 imwrite_Python cv2.imwrite方法代码示例
本文整理汇总了Python中cv2.imwrite方法的典型用法代码示例.如果您正苦于以下问题:Python cv2.imwrite方法的具体用法?Python cv2.imwrite怎么用?Pyth ...
- python+opencv实现机器视觉基础技术(2)(宽度测量,缺陷检测,医学检测
本篇博客接着讲解机器视觉的有关技术和知识.包括宽度测量,缺陷检测,医学处理. 一:宽度测量 在传统的自动化生产中,对于尺寸的测量,典型的方法就是千分尺.游标卡尺.塞尺等.而这些测量手段测量精度低 ...
最新文章
- 【Ubuntu】在Ubuntu中设置永久的DNS
- [SonarQube]Scanners内存溢出
- 【LeetCode】剑指 Offer 11. 旋转数组的最小数字
- 搜索引擎广告计费系统如何防恶意点击
- 用python画圣诞树-圣诞节!教你用 Python 画棵圣诞树
- Spark环境搭建(下)——Spark安装
- WPF NotifyIcon使用
- 【分布式开发】之 CAP 原则
- simulink简介
- TS中的泛型是什么,适合什么应用场景
- 【opencv】支付宝AR实景红包领取方法
- 测试大佬带你揭秘功能测试的内幕
- c++11:std::default_delete
- 微信小程序 SOTER 生物认证DEMO,指纹识别
- 华硕主板驱动在哪里下载?(ROG STRIX B250I)
- 共轭转置矩阵及matlab实现
- 实例004 计算正方形的边长
- Python|计蒜客——X的平方根
- html5 编写网页代码,使用纯HTML5编写一款网页上的时钟的代码分享
- 小程序服务器搭建前后端交互,手把手带你搭一个简单的微信小程序(包括前后端)...