OpenCV imread()函数

 

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

 例如:

  //读入图像单通道,即灰度图
ScrImage = imread("C:\\Users\\Desktop\\opencv_1.jpg", 0);

            

 

imread函数从文件中加载图像并返回该图像。如果该图像不能被读取(由于文件丢失、权限不正确、不支持或非法的格式等原因),该函数返回一个空的矩阵(Mat中的data项为NULL)。现在已经支持一下的文件格式:

  • Windows bitmaps - *.bmp, *.dib (always supported)
  • JPEG files - *.jpeg, *.jpg, *.jpe (see the Notes section)
  • JPEG 2000 files - *.jp2 (see the Notes section)
  • Portable Network Graphics - *.png (see the Notes section)
  • WebP - *.webp (see the Notes section)
  • Portable image format - *.pbm, *.pgm, *.ppm (always supported)
  • Sun rasters - *.sr, *.ras (always supported)
  • TIFF files - *.tiff, *.tif (see the Notes section)

 

flag=-1时,8位深度,原通道

flag=0,8位深度,1通道

flag=1,   8位深度  ,3通道

flag=2,原深度,1通道

flag=3,  原深度,3通道

flag=4,8位深度 ,3通道

 

  • 5
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值