OpenCV中imread函数
2016-03-25 00:02
441 查看
OpenCV中imread函数如下所示:
C++: Mat imread(const
string& filename, int flags=1 )
其中flags可以为:
flags –
Flags specifying the color type of a loaded image:
CV_LOAD_IMAGE_ANYDEPTH - If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit.
CV_LOAD_IMAGE_COLOR - If set, always convert image to the color one
CV_LOAD_IMAGE_GRAYSCALE - If set, always convert image to the grayscale one
>0 Return a 3-channel color image.
Note
In the current implementation the alpha channel, if any, is stripped from the output image. Use negative value if you need the alpha channel.
=0 Return a grayscale image.
<0 Return the loaded image as is (with alpha channel).
注意的是如果是读入RGB的三色图像,其channel的排列如下:
Note
In the case of color images, the decoded images will have the channels stored in B G R order.
即:
flowu = nocGTFlow.at<Vec3s>(i,j)[0]; B通道
flowv = nocGTFlow.at<Vec3s>(i,j)[1]; G通道
valid = nocGTFlow.at<Vec3s>(i,j)[2]; R通道
C++: Mat imread(const
string& filename, int flags=1 )
其中flags可以为:
flags –
Flags specifying the color type of a loaded image:
CV_LOAD_IMAGE_ANYDEPTH - If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit.
CV_LOAD_IMAGE_COLOR - If set, always convert image to the color one
CV_LOAD_IMAGE_GRAYSCALE - If set, always convert image to the grayscale one
>0 Return a 3-channel color image.
Note
In the current implementation the alpha channel, if any, is stripped from the output image. Use negative value if you need the alpha channel.
=0 Return a grayscale image.
<0 Return the loaded image as is (with alpha channel).
注意的是如果是读入RGB的三色图像,其channel的排列如下:
Note
In the case of color images, the decoded images will have the channels stored in B G R order.
即:
flowu = nocGTFlow.at<Vec3s>(i,j)[0]; B通道
flowv = nocGTFlow.at<Vec3s>(i,j)[1]; G通道
valid = nocGTFlow.at<Vec3s>(i,j)[2]; R通道
相关文章推荐
- python中使用OpenCV进行人脸检测的例子
- opencv 做人脸识别 opencv 人脸匹配分析
- 使用opencv拉伸图像扩大分辨率示例
- 基于C++实现kinect+opencv 获取深度及彩色数据
- OpenCV 2.4.3 C++ 平滑处理分析
- Python中使用OpenCV库来进行简单的气象学遥感影像计算
- 利用Python和OpenCV库将URL转换为OpenCV格式的方法
- python结合opencv实现人脸检测与跟踪
- Python环境搭建之OpenCV的步骤方法
- Python实现OpenCV的安装与使用示例
- 在树莓派2或树莓派B+上安装Python和OpenCV的教程
- opencv-python学习一--人脸检测
- 在Ubuntu上安装OpenCV3.0和Python-openCV的经历
- OpenCV配置,从来没有这么简单!
- ubuntu下opencv和qt的安装配置
- OpenCV学习笔记(二十五)——OpenCV图形界面设计Qt+VS2008
- 分享一些OpenCV实现立体视觉的经验
- 关于OpenCv图像变换与基本图形检测
- "应用程序正常初始化失败"-0xc0150002 解决办法
- OpenCV->HSV色彩空间