您的位置:首页 > 运维架构

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通道
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  opencv