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. AngularJS基础总结

    w3shools    angularjs教程  wiki   <AngularJS权威教程> Introduction AngularJS is a JavaScript framewo ...

  2. pip更换软件镜像源

    家里的网络访问某些国外网站.下载安装包的时候总是连接不上或者下载速度特别慢, pypi.python.org就是其中一个.所以,使用pip给Python安装软件时,经常出现错误.修改pip连接的软件库 ...

  3. Finish and error to: Error Domain=NSURLErrorDomain Code=-1001 "请求超时。

    错误显示:Finish and error to: Error Domain=NSURLErrorDomain Code=-1001 "请求超时." UserInfo={NSUnd ...

  4. Redis的windows安装

    第一步:下载Windows下的Redis链接:http://web.kuaipan.cn/n/drive/files/179275650081763322 第二不:打开cmd窗口命令:定位的Redis ...

  5. 计算机网络课程优秀备考PPT之第三章数据链路层(三)

    为了记录自己从2016.9~2017.1的<计算机网络>助教生涯,也为了及时梳理和整写笔记! 前期博客是, 计算机网络课程优秀备考PPT之第一章概述(一) 计算机网络课程优秀备考PPT之第 ...

  6. UVa 1600 Patrol Robot (习题 6-5)

    传送门: https://uva.onlinejudge.org/external/16/1600.pdf 多状态广搜 网上题解: 给vis数组再加一维状态,表示当前还剩下的能够穿越的墙的次数,每次碰 ...

  7. 8.Hibernate的多对多关联映射

    1.创建如下数据库脚本 --1.1 项目表 create table PROJECT ( proid ) not null, proname ) ) ; --1.2 项目表主键 alter table ...

  8. Struts国际化

    第一步需要建立配置文件 格式为      文件名_zh_CN.properties    为中文配置文件   文件名_en_US.properties为美式英语配置文件 配置文件里面的值以键值对的形式 ...

  9. Excel教程(10) - 逻辑运算符

    AND 用途:所有参数的逻辑值为真时返回 TRUE(真):只要有 一个参数的逻辑值为假,则返回 FALSE(假). 语法:AND(logical1,logical2,  ). 参数:Logical1, ...

  10. css3的特效拓展...

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...