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. Android中的eventBus传值

    第一步:在build.gradle中添加依赖dependencies { compile 'org.greenrobot:eventbus:3.0.0'} 第二步:创建一个 Event类: 注意:en ...

  2. jquery事件绑定

    window.onload 和 Jquery $(document).ready() 区别 * .用JavaScript的方式window.onload :必须等页面上所有的元素(css/js/图片) ...

  3. 在SpringMVC的controller控制器中使用Servlet原生的API

    只需要在控制器的方法里添加相应的Servlet 参数即可! 支持以下参数: 新建一个controller类,部分代码如下:(省略xml配置文件) @RequestMapping("servl ...

  4. JVM保证线程安全

     线程安全 Java内存模型中,程序(进程)拥有一块内存空间,可以被所有的线程共享,即MainMemory(主内存):而每个线程又有一块独立的内存空间,即WorkingMemory(工作内存).普通情 ...

  5. System.InvalidOperationException nested transactions are not supported

    如下bll方法,在执行时会报事务嵌套异常.bll方法里开启了分布式事务,dal方法里又启动了数据库事务.通过查看异常堆栈,发现异常是在执行BillsDal.Add(bill);方法里的var tran ...

  6. Java线程的几种状态

    一. 线程状态类型1. 新建状态(New):新创建了一个线程对象.2. 就绪状态(Runnable):线程对象创建后,其他线程调用了该对象的start()方法.该状态的线程位于可运行线程池中,变得可运 ...

  7. 获取星座的JS函数

    通过JS获取星座的函数 function getConstellation(m,d){ var s="魔羯水瓶双鱼牡羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯"; var arr=[2 ...

  8. Distributing Parts

    Distributing Parts 题目链接:http://codeforces.com/problemset/problem/496/E 贪心 将音乐和人都以低音升序排序,贪心处理低音更低的音乐, ...

  9. Android的JunitTest

    1.在manifest的配置:首先,manifest的下层级中配置: <instrumentation android:name="android.test.Instrumentati ...

  10. input输入框只允许输入数字/ 数字+小数点/ 文字+字母/ 等解决方法

    1.只允许输入数字: <input type="text" onkeyup="this.value=this.value.replace(/[^0-9]/g,'') ...