使用标准化的box filter来模糊图像
该函数使用内核来平滑图像:
C++: void blur(InputArray src, OutputArray dst, Size ksize, Point anchor=Point(-1,-1), int borderType=BORDER_DEFAULT )
Python: cv2.blur(src, ksize[, dst[, anchor[, borderType]]]) → dst
参数:
src – 输入图像; 它可以有任意数量的通道,每个通道都是独立处理的,但深度应该是CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
dst – 输出与输入图像相同大小和类型的图像.
ksize – 模糊处理的内核大小.
anchor – 锚点; 默认指是Point(-1,-1),表示锚点位于内核中心.
borderType – 用于外推图像外部像素的边框模式.
调用函数blur(src, dst, ksize, anchor, borderType)等同于boxFilter(src, dst, src.type(), anchor, true, borderType) .
类似的函数还有
boxFilter(), bilateralFilter(), GaussianBlur(), medianBlur()
创建一个轨迹栏并将其附加到指定的窗口.
C++: int createTrackbar(const string& trackbarname, const string& winname, int* value, int count, TrackbarCallback onChange=0, void* userdata=0)
C: int cvCreateTrackbar(const char* trackbar_name, const char* window_name, int* value, int count, CvTrackbarCallback on_change=NULL )¶
Python: cv.CreateTrackbar(trackbarName, windowName, value, count, onChange) → None
参数:
trackbarname – 创建的跟踪栏的名称.
winname – 将用作创建的跟踪栏父级的窗口名称.
value – 指向整数变量的可选指针,该变量的值反映滑块的位置.创建后,滑块位置由此变量定义.
count – 滑块的最大位置,最小位置始终为0.
onChange – Pointer to the function to be called every time the slider changes position. This function should be prototyped as void Foo(int,void*); , where the first parameter is the trackbar position and the second parameter is the user data (see the next parameter). If the callback is the NULL pointer, no callbacks are called, but only value is updated.
userdata – User data that is passed as is to the callback. It can be used to handle trackbar events without using global variables.
The function createTrackbar creates a trackbar (a slider or range control) with the specified name and range, assigns a variable value to be a position synchronized with the trackbar and specifies the callback func