imread(),imshow(),nameWindow(),waitKey()的基本用法

本文介绍了OpenCV中用于读取、显示图片及处理用户输入的关键函数:imread()、imshow()、nameWindow()和waitKey()。详细讲解了它们的参数、用法及代码示例,帮助理解如何在OpenCV中正确操作图片。
摘要由CSDN通过智能技术生成

imread(),imshow(),nameWindow(),waitKey()的基本用法

imread(const string& filename, int flags = 1)

imread()为读取图片函数。
第一个参数:为图片文件路径
第二个参数为加载类型。第二个参数,可控制不同加载方式。第二个参数默认是1,其含义为按照RGB格式加载图片。一般而言,默认加载即可。
以下是opencv定义第二个参数数值的含义。

IMREAD_UNCHANGED = -1, //!< If set, return the loaded image as is (with alpha channel, otherwise it gets cropped).
IMREAD_GRAYSCALE = 0,  //!< If set, always convert image to the single channel grayscale image.
 IMREAD_COLOR= 1,  //!< If set, always convert image to the 3 channel BGR color image.
IMREAD_ANYDEPTH= 2,  //!< If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值