mixChannels

Copies specified channels from input arrays to the specified channels of output arrays.

从输入中拷贝某通道到输出中特定的通道。

C++: void mixChannels(const Mat*src, size_t nsrcs, Mat* dst, size_t ndsts, const int* fromTo, size_t npairs)

C++: void mixChannels(const vector<Mat>&src, vector<Mat>&dst, const int*fromTo, size_t npairs)

参数

src– Input array or vector of matrices. All the matrices must have the same size and the same depth.

输入矩阵的向量(可以理解成一队矩阵),所有矩阵必须有相同的大小和深度。

nsrcs– Number of matrices in src.

输入矩阵的个数。

dst– Output array or vector of matrices. All the matrices must be allocated. Their size and depth must be the same as in src[0].

输出矩阵的向量。所有的矩阵必须事先分配空间(如用create),大小和深度须与输入矩阵等同。

ndsts– Number of matrices in dst.

输出矩阵的个数。

fromTo – Array of index pairs specifying which channels are copied and where.

序号对向量,用来决定哪个通道被拷贝,拷贝到哪个通道。

fromTo[k*2] is a 0-based index of the input channel in src.

fromTo[k*2+1] is an index of the output channel in dst. The continuous channel numbering is used: the first input image channels are indexed from 0 to src[0].channels()-1 , the second

input image channels are indexed from src[0].channels() to src[0].channels() + src[1].channels()-1, and so on. The same scheme is used for the output image channels. As a special case, when fromTo[k*2] is negative, the corresponding output channel is filled with zero .

上面的大体含义是:偶数下标的用来标识输入矩阵,奇数下标的用来标识输出矩阵。如果偶数下标为负数,那么相应的输出矩阵为零矩阵。

npairs– Number of index pairs in fromTo.

fromTo中的序号对数(两个算1对)。

Mat rgba( , , CV_8UC4, Scalar(,,,) );
Mat bgr( rgba.rows, rgba.cols, CV_8UC3 );
Mat alpha( rgba.rows, rgba.cols, CV_8UC1 ); // forming an array of matrices is a quite efficient operation,
// because the matrix data is not copied, only the headers
Mat out[] = { bgr, alpha };
// rgba[0] -> bgr[2], rgba[1] -> bgr[1],
// rgba[2] -> bgr[0], rgba[3] -> alpha[0]
int from_to[] = { ,, ,, ,, , };
mixChannels( &rgba, , out, , from_to, );
mat grav0;
for( int c = ; c < ; c++ )
{
int ch[] = {c, };
mixChannels(&timg, , &gray0, , ch, );
}

OpenCV——mixChannels函数的更多相关文章

  1. opencv-6-图像绘制与opencv Line 函数剖析

    opencv-6-图像绘制与opencv Line 函数剖析 opencvc++qt 开始之前 越到后面, 写的越慢, 之前还抽空去看了下 学堂在线那篇文章提供的方法, 博客第一个人评论的我, 想想还 ...

  2. 【记录一个问题】macos下lldb调试opencv的一个程序,出现“failed to load objfile for”错误,并且无法调试进入opencv的函数

    opencv编译使用了Debug版本,打开了BUILD_WITH_DEBUG_INFO=ON选项. 发现问题后,我又在CMAKE_CXX_FLAGS_DEBUG中设置为 -g -ggdb3,在CMAK ...

  3. OpenCV之mixChannels()函数使用说明

    step 1: 函数功能说明 mixChannels主要就是把输入的矩阵(或矩阵数组)的某些通道拆分复制给对应的输出矩阵(或矩阵数组)的某些通道中,其中的对应关系就由fromTo参数制定. step ...

  4. 学习OpenCV——Gabor函数的应用

    原文:http://blog.csdn.net/yao_zhuang/article/details/2532279 下载cvgabor.cpp和cvgabor.h到你的C/C++工程目录下 注:在我 ...

  5. 【麦子学院】OpenCV教程函数总结

    个自带样例. parter 1: No1. adaptiveskindetector.cpp 利用HSV空间的色调信息的皮肤检測,背景不能有太多与肤色相似的颜色.效果不是特别好. No2. bagof ...

  6. Opencv常用函数

    一.图像读写与简单处理 1. Mat cv::imread(const String& filename, int flags=IMREAD_COLOR). imread函数加载filenam ...

  7. opencv: flip函数的使用;

    flip函数用于图像翻转,比较方便.在opencv中有几种形式: C++: void flip(InputArray src, OutputArray dst, int flipCode) Pytho ...

  8. opencv ---getRotationMatrix2D函数

    getRotationMatrix2D函数 主要用于获得图像绕着 某一点的旋转矩阵  Mat getRotationMatrix2D(Point2f center, double angle, dou ...

  9. OpenCV绘图函数

    OpenCV几个绘图函数 矩形 rectangle(Mat& img,Point pt1, Point pt2, const Scalar&color, int thickness=1 ...

随机推荐

  1. Linux常用命令汇总及使用方法(三)

    (1)文件管理命令 ls.ls -l.ll.ls -a ls -a 显示所有文件,包括隐藏文件 ls 列举指定目录下的子目录和文件 ls -l与ll相同 列举指定目录下的子目录和文件的详细信息 tot ...

  2. php +mysql 添加 删除 修改 insert into delete update

    INSERT INTO 插入数据库 $sql = "INSERT INTO subject (uid,fun,title) VALUES (3,88,'语文')"; $query ...

  3. google浏览器图标显示不正常怎么办

    taskkill /f /im explorer.exe rem 清理系统图标缓存数据库 attrib -h -s -r "%userprofile%\AppData\Local\IconC ...

  4. 黑帽么metasploit

    .Metasploit框架介绍Metasploit升级更新 Metasploit端口扫描 Metasploit SMB 获取系统信息 Metasploit 服务识别 Metasploit 密码嗅探 M ...

  5. sql proc触发异常处理回滚

    sql proc触发异常处理回滚 针对proc嵌套proc很有用 begin begin try begin tran --判断错误 BEGIN --ROLLBACK TRAN SET @vcResu ...

  6. pull类型消息中间件-消息发布者(一)

    消息集群架构 对于发送方来说的关键几要素 topic 消息的主题,由用户定义.类似于知乎的话题,Producer发送消息的时候需要指定发送到某一个topic下面,Consumer从某一个topic下面 ...

  7. SSM

    今天内容安排 1:复习mybatis 2:复习springMVC 3:springMVC+spring+mybatis组合起来,搭建一个web应用开发的框架 4:用户管理系统,针对用户的CRUD操作, ...

  8. github上一些觉得对自己工作有用的项目收集

    usefullProjectCollect github上一些觉得对自己工作有用的项目收集 技能类 markdown语法中文说明 全文检索 elasticsearch bigdesk elastics ...

  9. mysql分页

    1.查询第一行记录: select * from table limit 1 2.查询第n行到第m行记录 select * from table1 limit n-1,m-n; SELECT * FR ...

  10. ubuntu通过tnvm安装Nodejs

    第一步,先安装tvm tnvm(Taobao Node Version Manager)淘宝Node版本管理器 安装: 直接输入 wget -O- https://raw.githubusercont ...