python opencv imread(filename, flags=None) 读取图像 flags cv::ImreadModes 参数上哪看去?

88 篇文章 19 订阅

在调用opencv的imread(filename, flags=None)函数时,后面有个flags=None参数,但打开文档轻描淡写,不知该参数上哪找去,用全局搜索也搜不到,莫非要到官网查?(擦汗’’)
在这里插入图片描述
打开官网,有个Online documentation,点它:
在这里插入图片描述然后找到自己opencv版本点进去,我的是这个(如果不知道自己opencv版本可以在控制台执行pip list查看):
在这里插入图片描述
在这里插入图片描述
点进去后右上角搜索就ok了:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

IMREAD_UNCHANGED 
Python: cv.IMREAD_UNCHANGED
If set, return the loaded image as is (with alpha channel, otherwise it gets cropped).

IMREAD_GRAYSCALE 
Python: cv.IMREAD_GRAYSCALE
If set, always convert image to the single channel grayscale image (codec internal conversion).

IMREAD_COLOR 
Python: cv.IMREAD_COLOR
If set, always convert image to the 3 channel BGR color image.

IMREAD_ANYDEPTH 
Python: cv.IMREAD_ANYDEPTH
If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit.

IMREAD_ANYCOLOR 
Python: cv.IMREAD_ANYCOLOR
If set, the image is read in any possible color format.

IMREAD_LOAD_GDAL 
Python: cv.IMREAD_LOAD_GDAL
If set, use the gdal driver for loading the image.

IMREAD_REDUCED_GRAYSCALE_2 
Python: cv.IMREAD_REDUCED_GRAYSCALE_2
If set, always convert image to the single channel grayscale image and the image size reduced 1/2.

IMREAD_REDUCED_COLOR_2 
Python: cv.IMREAD_REDUCED_COLOR_2
If set, always convert image to the 3 channel BGR color image and the image size reduced 1/2.

IMREAD_REDUCED_GRAYSCALE_4 
Python: cv.IMREAD_REDUCED_GRAYSCALE_4
If set, always convert image to the single channel grayscale image and the image size reduced 1/4.

IMREAD_REDUCED_COLOR_4 
Python: cv.IMREAD_REDUCED_COLOR_4
If set, always convert image to the 3 channel BGR color image and the image size reduced 1/4.

IMREAD_REDUCED_GRAYSCALE_8 
Python: cv.IMREAD_REDUCED_GRAYSCALE_8
If set, always convert image to the single channel grayscale image and the image size reduced 1/8.

IMREAD_REDUCED_COLOR_8 
Python: cv.IMREAD_REDUCED_COLOR_8
If set, always convert image to the 3 channel BGR color image and the image size reduced 1/8.

IMREAD_IGNORE_ORIENTATION 
Python: cv.IMREAD_IGNORE_ORIENTATION
If set, do not rotate the image according to EXIF's orientation flag.

参考文章:python opencv imread()函数 (从文件加载图像)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Dontla

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值