[OpenCV基础] 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)

C: void cvMixChannels(const CvArr**src, int src_count, CvArr** dst, int dst_count, const int* from_to, int pair_count)

函数原型。

 

Parameters

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对)。

The functions mixChannels provide an advanced mechanism for shuffling image channels.

这个函数对图像通道提供了高级的操作。

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值