OpenCV——mixChannels函数
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函数的更多相关文章
- opencv-6-图像绘制与opencv Line 函数剖析
opencv-6-图像绘制与opencv Line 函数剖析 opencvc++qt 开始之前 越到后面, 写的越慢, 之前还抽空去看了下 学堂在线那篇文章提供的方法, 博客第一个人评论的我, 想想还 ...
- 【记录一个问题】macos下lldb调试opencv的一个程序,出现“failed to load objfile for”错误,并且无法调试进入opencv的函数
opencv编译使用了Debug版本,打开了BUILD_WITH_DEBUG_INFO=ON选项. 发现问题后,我又在CMAKE_CXX_FLAGS_DEBUG中设置为 -g -ggdb3,在CMAK ...
- OpenCV之mixChannels()函数使用说明
step 1: 函数功能说明 mixChannels主要就是把输入的矩阵(或矩阵数组)的某些通道拆分复制给对应的输出矩阵(或矩阵数组)的某些通道中,其中的对应关系就由fromTo参数制定. step ...
- 学习OpenCV——Gabor函数的应用
原文:http://blog.csdn.net/yao_zhuang/article/details/2532279 下载cvgabor.cpp和cvgabor.h到你的C/C++工程目录下 注:在我 ...
- 【麦子学院】OpenCV教程函数总结
个自带样例. parter 1: No1. adaptiveskindetector.cpp 利用HSV空间的色调信息的皮肤检測,背景不能有太多与肤色相似的颜色.效果不是特别好. No2. bagof ...
- Opencv常用函数
一.图像读写与简单处理 1. Mat cv::imread(const String& filename, int flags=IMREAD_COLOR). imread函数加载filenam ...
- opencv: flip函数的使用;
flip函数用于图像翻转,比较方便.在opencv中有几种形式: C++: void flip(InputArray src, OutputArray dst, int flipCode) Pytho ...
- opencv ---getRotationMatrix2D函数
getRotationMatrix2D函数 主要用于获得图像绕着 某一点的旋转矩阵 Mat getRotationMatrix2D(Point2f center, double angle, dou ...
- OpenCV绘图函数
OpenCV几个绘图函数 矩形 rectangle(Mat& img,Point pt1, Point pt2, const Scalar&color, int thickness=1 ...
随机推荐
- MAC下安装automake autoconf工具
I noticed today that while Mac OS 10.6 (specifically, 10.6.2) comes with automake and autoconf, the ...
- @PostConstruct 和 @PreDestory
关于在spring 容器初始化 bean 和销毁前所做的操作定义方式有三种: 第一种:通过@PostConstruct 和 @PreDestroy 方法 实现初始化和销毁bean之前进行的操作 第二 ...
- mybatis笔记(一)
mybatis (一)传值 三种方式 1.直接传值void getMessageList(int userId,String userName);mapper.xml 获取 #{0}代表userId ...
- excel中的数据导入oracle方法
SQL_loader批量上传数据 1. 注释 在工作中,很多时候会遇到如下情况:需要将excel中的数据批量上传到ORACLE表中.如果是小数据量,如几十条至几百条,那么用plsql dev工具 ...
- 残酷中蜕变的SEOer
SEO在不断蜕变,今天的自己推翻昨天的自己. 大牛说"SEOer们走的路不同,最终都会殊途同归." 最后都会炼出"SEO的道"最终都会回归到网站基础工程.毕 ...
- android 5.0 -- Ripple 效果
Ripple 水波纹效果,也就是涟漪效果. 波纹效果有两种: 1,波纹有边界:波纹涟漪效果只是显示在控件内部 android:background="?android:attr/select ...
- android 图片加载优化,避免oom问题产生
1,及时回收bitmap,在activity的onstop()和onDestory()里面调用如下代码进行bitmap的回收: // 先判断是否已经回收 if(bitmap != null & ...
- Impala:新一代开源大数据分析引擎
Impala架构分析 Impala是Cloudera公司主导开发的新型查询系统,它提供SQL语义,能查询存储在Hadoop的HDFS和HBase中的PB级大数据.已有的Hive系统虽然也提供了SQL语 ...
- 【成长之路】【python】python基础2
1.位运算 &(与) | (或) ~ (非) ^(异或) 2.三元运算 c = a+b if a>b else a-b if (a>b): a+b else: a-b 3.小知识( ...
- PAT 团体程序设计天梯赛-练习集 L2-009. 抢红包
没有人没抢过红包吧…… 这里给出N个人之间互相发红包.抢红包的记录,请你统计一下他们抢红包的收获. 输入格式: 输入第一行给出一个正整数N(<= 104),即参与发红包和抢红包的总人数,则这些人 ...