mixChannels: 输入的矩阵(或矩阵数组)的某些通道拆分复制给对应的输出矩阵(或矩阵数组)的某些通道中,其中的对应关系就由fromTo参数制定。
原型: void mixChannels (const Mat* src , int nsrc , Mat* dst , int ndst , const int* fromTo , size_t npairs );
src:输入矩阵序列,可以为多个,须有相同大小和深度。
nsrcs:输入矩阵个数。
dst:输出矩阵序列,可以为多个,所有矩阵须事先分配空间,大小和深度与输入矩阵相同。
ndsts:输出矩阵个数。
fromTo:映射关系。例如:int from[] = {1, 0, 5, 1}; 把src第一个通道复制给dst第0个通道,src第5个通道复制给dst第1个通道。
inRange: 检查src是否在两个高低矩阵之间,若为true,dst为255,false为0.可用于缺陷检测。
原型:void inRange(InputArray src, InputArray lowerb, InputArray upperb, OutputArray dst);
• For
every element of a single-channel input array:
dst(I) = lowerb(I)0 ≤ src(I)0 ≤ upperb(I)0
• For two-channel arrays:
dst(I) = lowerb(I)0 ≤ src(I)0 ≤ upperb(I)0 ^ lowerb(I)1 ≤ src(I)1 ≤ upperb(I)1
lowerb和upperb也可为数值。
本文介绍了两种常用的图像处理函数:mixChannels用于指定通道间的复制,适用于图像数据的重组;inRange用于判断像素值是否在设定范围内,常用于图像缺陷检测等场景。详细解释了两者的使用方法及应用场景。
1万+

被折叠的 条评论
为什么被折叠?



