OpenCV 4.13.0
开源计算机视觉库 (Open Source Computer Vision)
正在加载...
正在搜索...
未找到匹配项

详细说明

本节介绍的函数和类用于对二维图像执行各种线性或非线性滤波操作。

注意
  • 包含所有基本形态学算子(如腐蚀和膨胀)的示例,请参阅 opencv_source_code/samples/gpu/morphology.cpp

类  cv::cuda::Filter
 所有 CUDA 滤波器的通用接口 : 更多...
 

函数

Ptr< Filtercv::cuda::createBoxFilter (int srcType, int dstType, Size ksize, Point anchor=Point(-1, -1), int borderMode=BORDER_DEFAULT, Scalar borderVal=Scalar::all(0))
 创建一个归一化的 2D 盒式滤波器。
 
Ptr< Filtercv::cuda::createBoxMaxFilter (int srcType, Size ksize, Point anchor=Point(-1, -1), int borderMode=BORDER_DEFAULT, Scalar borderVal=Scalar::all(0))
 创建最大值滤波器。
 
Ptr< Filtercv::cuda::createBoxMinFilter (int srcType, Size ksize, Point anchor=Point(-1, -1), int borderMode=BORDER_DEFAULT, Scalar borderVal=Scalar::all(0))
 创建最小值滤波器。
 
Ptr< Filtercv::cuda::createColumnSumFilter (int srcType, int dstType, int ksize, int anchor=-1, int borderMode=BORDER_DEFAULT, Scalar borderVal=Scalar::all(0))
 创建一个垂直 1D 盒式滤波器。
 
Ptr< Filtercv::cuda::createDerivFilter (int srcType, int dstType, int dx, int dy, int ksize, bool normalize=false, double scale=1, int rowBorderMode=BORDER_DEFAULT, int columnBorderMode=-1)
 创建一个通用的导数 (Deriv) 算子。
 
Ptr< Filtercv::cuda::createGaussianFilter (int srcType, int dstType, Size ksize, double sigma1, double sigma2=0, int rowBorderMode=BORDER_DEFAULT, int columnBorderMode=-1)
 创建一个高斯滤波器。
 
Ptr< Filtercv::cuda::createLaplacianFilter (int srcType, int dstType, int ksize=1, double scale=1, int borderMode=BORDER_DEFAULT, Scalar borderVal=Scalar::all(0))
 创建一个拉普拉斯 (Laplacian) 算子。
 
Ptr< Filtercv::cuda::createLinearFilter (int srcType, int dstType, InputArray kernel, Point anchor=Point(-1, -1), int borderMode=BORDER_DEFAULT, Scalar borderVal=Scalar::all(0))
 创建一个不可分线性 2D 滤波器。
 
Ptr< Filtercv::cuda::createMorphologyFilter (int op, int srcType, InputArray kernel, Point anchor=Point(-1, -1), int iterations=1)
 创建一个 2D 形态学滤波器。
 
Ptr< Filtercv::cuda::createRowSumFilter (int srcType, int dstType, int ksize, int anchor=-1, int borderMode=BORDER_DEFAULT, Scalar borderVal=Scalar::all(0))
 创建一个水平 1D 盒式滤波器。
 
Ptr< Filtercv::cuda::createScharrFilter (int srcType, int dstType, int dx, int dy, double scale=1, int rowBorderMode=BORDER_DEFAULT, int columnBorderMode=-1)
 创建一个垂直或水平的 Scharr 算子。
 
Ptr< Filtercv::cuda::createSeparableLinearFilter (int srcType, int dstType, InputArray rowKernel, InputArray columnKernel, Point anchor=Point(-1,-1), int rowBorderMode=BORDER_DEFAULT, int columnBorderMode=-1)
 创建一个可分线性滤波器。支持就地处理。
 
Ptr< Filtercv::cuda::createSobelFilter (int srcType, int dstType, int dx, int dy, int ksize=3, double scale=1, int rowBorderMode=BORDER_DEFAULT, int columnBorderMode=-1)
 创建一个 Sobel 算子。
 

函数文档 (Function Documentation)

◆ createBoxFilter()

Ptr< Filter > cv::cuda::createBoxFilter ( int srcType,
int dstType,
Size ksize,
点 (Point) anchor=Point(-1, -1),
int borderMode = BORDER_DEFAULT,
Scalar borderVal=Scalar::all(0) )

#include <opencv2/cudafilters.hpp>

创建一个归一化的 2D 盒式滤波器。

参数
srcType输入图像类型。目前仅支持 CV_8UC1、CV_8UC4 和 CV_32FC1。
dstType输出图像类型。目前仅支持与 src 相同的类型。
ksize内核大小。
锚点 (anchor)锚点。默认值 Point(-1, -1) 表示锚点位于内核中心。
borderMode像素外插法。有关详细信息,请参阅 borderInterpolate 。
borderVal默认边界值。
注意
如果在 CUDA Stream 中应用,则每个 Stream 都必须创建单独的滤波器实例。跨多个流共享单个实例不受支持,并且可能由于特定于流的内部状态而导致未定义行为。
另请参阅
boxFilter

◆ createBoxMaxFilter()

Ptr< Filter > cv::cuda::createBoxMaxFilter ( int srcType,
Size ksize,
点 (Point) anchor=Point(-1, -1),
int borderMode = BORDER_DEFAULT,
Scalar borderVal=Scalar::all(0) )

#include <opencv2/cudafilters.hpp>

创建最大值滤波器。

参数
srcType输入/输出图像类型。仅支持 CV_8UC1 和 CV_8UC4。
ksize内核大小。
锚点 (anchor)锚点。默认值 (-1) 表示锚点位于内核中心。
borderMode像素外插法。有关详细信息,请参阅 borderInterpolate 。
borderVal默认边界值。
注意
如果在 CUDA Stream 中应用,则每个 Stream 都必须创建单独的滤波器实例。跨多个流共享单个实例不受支持,并且可能由于特定于流的内部状态而导致未定义行为。

◆ createBoxMinFilter()

Ptr< Filter > cv::cuda::createBoxMinFilter ( int srcType,
Size ksize,
点 (Point) anchor=Point(-1, -1),
int borderMode = BORDER_DEFAULT,
Scalar borderVal=Scalar::all(0) )

#include <opencv2/cudafilters.hpp>

创建最小值滤波器。

参数
srcType输入/输出图像类型。仅支持 CV_8UC1 和 CV_8UC4。
ksize内核大小。
锚点 (anchor)锚点。默认值 (-1) 表示锚点位于内核中心。
borderMode像素外插法。有关详细信息,请参阅 borderInterpolate 。
borderVal默认边界值。
注意
如果在 CUDA Stream 中应用,则每个 Stream 都必须创建单独的滤波器实例。跨多个流共享单个实例不受支持,并且可能由于特定于流的内部状态而导致未定义行为。

◆ createColumnSumFilter()

Ptr< Filter > cv::cuda::createColumnSumFilter ( int srcType,
int dstType,
int ksize,
int anchor=-1,
int borderMode = BORDER_DEFAULT,
Scalar borderVal=Scalar::all(0) )

#include <opencv2/cudafilters.hpp>

创建一个垂直 1D 盒式滤波器。

参数
srcType输入图像类型。目前仅支持 CV_8UC1 类型。
dstType输出图像类型。目前仅支持 CV_32FC1 类型。
ksize内核大小。
锚点 (anchor)锚点。默认值 (-1) 表示锚点位于内核中心。
borderMode像素外插法。有关详细信息,请参阅 borderInterpolate 。
borderVal默认边界值。
注意
如果在 CUDA Stream 中应用,则每个 Stream 都必须创建单独的滤波器实例。跨多个流共享单个实例不受支持,并且可能由于特定于流的内部状态而导致未定义行为。

◆ createDerivFilter()

Ptr< Filter > cv::cuda::createDerivFilter ( int srcType,
int dstType,
int dx,
int dy,
int ksize,
bool normalize=false,
double scale = 1,
int rowBorderMode=BORDER_DEFAULT,
int columnBorderMode=-1 )

#include <opencv2/cudafilters.hpp>

创建一个通用的导数 (Deriv) 算子。

参数
srcType源图像类型。
dstType目标数组类型。
dxx 方向的导数阶数。
dyy 方向的导数阶数。
ksize孔径大小。有关详细信息,请参阅 getDerivKernels 。
normalize指示是否对滤波器系数进行归一化(缩放)的标志。有关详细信息,请参阅 getDerivKernels 。
scale计算出的导数值的可选缩放因子。默认情况下,不应用缩放。有关详细信息,请参阅 getDerivKernels 。
rowBorderMode垂直方向的像素外插法。有关详细信息,请参阅 borderInterpolate。
columnBorderMode水平方向的像素外插法。
注意
如果在 CUDA Stream 中应用,则每个 Stream 都必须创建单独的滤波器实例。跨多个流共享单个实例不受支持,并且可能由于特定于流的内部状态而导致未定义行为。

◆ createGaussianFilter()

Ptr< Filter > cv::cuda::createGaussianFilter ( int srcType,
int dstType,
Size ksize,
double sigma1,
double sigma2=0,
int rowBorderMode=BORDER_DEFAULT,
int columnBorderMode=-1 )

#include <opencv2/cudafilters.hpp>

创建一个高斯滤波器。

参数
srcType源图像类型。
dstType目标数组类型。
ksize孔径大小。有关详细信息,请参阅 getGaussianKernel 。
sigma1水平方向的 Gaussian sigma。有关详细信息,请参阅 getGaussianKernel 。
sigma2垂直方向的 Gaussian sigma。如果为 0,则 \(\texttt{sigma2}\leftarrow\texttt{sigma1}\)。
rowBorderMode垂直方向的像素外插法。有关详细信息,请参阅 borderInterpolate。
columnBorderMode水平方向的像素外插法。
注意
如果在 CUDA Stream 中应用,则每个 Stream 都必须创建单独的滤波器实例。跨多个流共享单个实例不受支持,并且可能由于特定于流的内部状态而导致未定义行为。
另请参阅
高斯模糊 (GaussianBlur)

◆ createLaplacianFilter()

Ptr< Filter > cv::cuda::createLaplacianFilter ( int srcType,
int dstType,
int ksize = 1,
double scale = 1,
int borderMode = BORDER_DEFAULT,
Scalar borderVal=Scalar::all(0) )

#include <opencv2/cudafilters.hpp>

创建一个拉普拉斯 (Laplacian) 算子。

参数
srcType输入图像类型。支持 CV_8U 、 CV_16U 和 CV_32F 的单通道和四通道图像。
dstType输出图像类型。目前仅支持与 src 相同的类型。
ksize用于计算二阶导数滤波器的孔径大小(参见 getDerivKernels)。它必须是正数且为奇数。仅支持 ksize = 1 和 ksize = 3。
scale计算出的拉普拉斯算子值的可选缩放因子。默认情况下,不应用缩放(参见 getDerivKernels)。
borderMode像素外插法。有关详细信息,请参阅 borderInterpolate 。
borderVal默认边界值。
注意
如果在 CUDA Stream 中应用,则每个 Stream 都必须创建单独的滤波器实例。跨多个流共享单个实例不受支持,并且可能由于特定于流的内部状态而导致未定义行为。
另请参阅
拉普拉斯

◆ createLinearFilter()

Ptr< Filter > cv::cuda::createLinearFilter ( int srcType,
int dstType,
InputArray kernel,
点 (Point) anchor=Point(-1, -1),
int borderMode = BORDER_DEFAULT,
Scalar borderVal=Scalar::all(0) )

#include <opencv2/cudafilters.hpp>

创建一个不可分线性 2D 滤波器。

参数
srcType输入图像类型。支持 CV_8U 、 CV_16U 和 CV_32F 的单通道和四通道图像。
dstType输出图像类型。目前仅支持与 src 相同的类型。
kernel滤波器系数的二维数组。
锚点 (anchor)锚点。默认值 Point(-1, -1) 表示锚点位于内核中心。
borderMode像素外插法。有关详细信息,请参阅 borderInterpolate 。
borderVal默认边界值。
注意
如果在 CUDA Stream 中应用,则每个 Stream 都必须创建单独的滤波器实例。跨多个流共享单个实例不受支持,并且可能由于特定于流的内部状态而导致未定义行为。
另请参阅
filter2D

◆ createMorphologyFilter()

Ptr< Filter > cv::cuda::createMorphologyFilter ( int op,
int srcType,
InputArray kernel,
点 (Point) anchor=Point(-1, -1),
int iterations=1 )

#include <opencv2/cudafilters.hpp>

创建一个 2D 形态学滤波器。

参数
op形态学操作的类型。可能的类型如下:
  • MORPH_ERODE 腐蚀
  • MORPH_DILATE 膨胀
  • MORPH_OPEN 开运算
  • MORPH_CLOSE 闭运算
  • MORPH_GRADIENT 形态学梯度
  • MORPH_TOPHAT "顶帽变换"
  • MORPH_BLACKHAT "黑帽变换"
srcType输入/输出图像类型。仅支持 CV_8UC1、CV_8UC4、CV_32FC1 和 CV_32FC4。
kernel形态学操作的 8 位结构元素(二维)。
锚点 (anchor)结构元素内的锚点位置。负值表示锚点位于中心。
iterations应用腐蚀和膨胀的次数。
注意
如果在 CUDA Stream 中应用,则每个 Stream 都必须创建单独的滤波器实例。跨多个流共享单个实例不受支持,并且可能由于特定于流的内部状态而导致未定义行为。
另请参阅
morphologyEx

◆ createRowSumFilter()

Ptr< Filter > cv::cuda::createRowSumFilter ( int srcType,
int dstType,
int ksize,
int anchor=-1,
int borderMode = BORDER_DEFAULT,
Scalar borderVal=Scalar::all(0) )

#include <opencv2/cudafilters.hpp>

创建一个水平 1D 盒式滤波器。

参数
srcType输入图像类型。目前仅支持 CV_8UC1 类型。
dstType输出图像类型。目前仅支持 CV_32FC1 类型。
ksize内核大小。
锚点 (anchor)锚点。默认值 (-1) 表示锚点位于内核中心。
borderMode像素外插法。有关详细信息,请参阅 borderInterpolate 。
borderVal默认边界值。
注意
如果在 CUDA Stream 中应用,则每个 Stream 都必须创建单独的滤波器实例。跨多个流共享单个实例不受支持,并且可能由于特定于流的内部状态而导致未定义行为。

◆ createScharrFilter()

Ptr< Filter > cv::cuda::createScharrFilter ( int srcType,
int dstType,
int dx,
int dy,
double scale = 1,
int rowBorderMode=BORDER_DEFAULT,
int columnBorderMode=-1 )

#include <opencv2/cudafilters.hpp>

创建一个垂直或水平的 Scharr 算子。

参数
srcType源图像类型。
dstType目标数组类型。
dxx 方向的导数阶数。
dyy 方向的导数阶数。
scale计算出的导数值的可选缩放因子。默认情况下,不应用缩放。有关详细信息,请参阅 getDerivKernels 。
rowBorderMode垂直方向的像素外插法。有关详细信息,请参阅 borderInterpolate。
columnBorderMode水平方向的像素外插法。
注意
如果在 CUDA Stream 中应用,则每个 Stream 都必须创建单独的滤波器实例。跨多个流共享单个实例不受支持,并且可能由于特定于流的内部状态而导致未定义行为。
另请参阅
Scharr

◆ createSeparableLinearFilter()

Ptr< Filter > cv::cuda::createSeparableLinearFilter ( int srcType,
int dstType,
InputArray rowKernel,
InputArray columnKernel,
点 (Point) anchor = Point(-1,-1),
int rowBorderMode=BORDER_DEFAULT,
int columnBorderMode=-1 )

#include <opencv2/cudafilters.hpp>

创建一个可分线性滤波器。支持就地处理。

参数
srcType源数组类型。
dstType目标数组类型。
rowKernel水平滤波器系数。支持大小 <= 32 的内核。noArray() 支持忽略水平滤波。
columnKernel垂直滤波器系数。支持大小 <= 32 的内核。noArray() 支持忽略垂直滤波。
锚点 (anchor)内核内的锚点位置。负值表示锚点位于孔径中心。
rowBorderMode垂直方向的像素外插法。有关详细信息,请参阅 borderInterpolate。
columnBorderMode水平方向的像素外插法。
注意
如果在 CUDA Stream 中应用,则每个 Stream 都必须创建单独的滤波器实例。跨多个流共享单个实例不受支持,并且可能由于特定于流的内部状态而导致未定义行为。
另请参阅
可分二维滤波 (sepFilter2D)

◆ createSobelFilter()

Ptr< Filter > cv::cuda::createSobelFilter ( int srcType,
int dstType,
int dx,
int dy,
int ksize = 3,
double scale = 1,
int rowBorderMode=BORDER_DEFAULT,
int columnBorderMode=-1 )

#include <opencv2/cudafilters.hpp>

创建一个 Sobel 算子。

参数
srcType源图像类型。
dstType目标数组类型。
dxx 方向的导数阶数。
dyy 方向的导数阶数。
ksize扩展 Sobel 内核的大小。可能的值为 1、3、5 或 7。
scale计算出的导数值的可选缩放因子。默认情况下,不应用缩放。有关详细信息,请参阅 getDerivKernels 。
rowBorderMode垂直方向的像素外插法。有关详细信息,请参阅 borderInterpolate。
columnBorderMode水平方向的像素外插法。
注意
如果在 CUDA Stream 中应用,则每个 Stream 都必须创建单独的滤波器实例。跨多个流共享单个实例不受支持,并且可能由于特定于流的内部状态而导致未定义行为。
另请参阅
Sobel