# 1、微分定义与性质

$\frac{\partial f}{\partial x}=f(x+1)-f(x)$

$\frac{\partial^2 f}{\partial x^2}=f(x+1)+f(x-1)-2f(x)$

（1）一阶微分

（2）二阶微分

Edges in digital images often are ramp-like transitions in intensity, in which case the first derivative of the image would result in thick edges because the derivative is nonzero along a ramp. On the other hand, the second derivative would produce a double edge one pixel thick, separated by zeros. From this, we conclude that the second derivative enhances fine detail much better than the first derivative, a property ideally suited for sharpening images. Also, second derivatives require fewer operations to implement than first derivatives, so our initial attention is on the former.

# 2、二阶微分

$\nabla^2 f=\frac{\partial^2 f}{\partial x^2}+\frac{\partial^2 f}{\partial y^2}$

$\frac{\partial^2 f}{\partial x^2}=f(x+1,y)+f(x-1,y)-2f(x,y)$

$\frac{\partial^2 f}{\partial y^2}=f(x,y+1)+f(x,y-1)-2f(x,y)$

$\nabla^2 f(x,y)=f(x+1,y)+f(x-1,y)+f(x,y-1)+f(x,y+1)-4f(x,y)$

$g(x,y)=f(x,y)+c[\nabla^2 f(x,y)]$

$g(x,y)$为锐化图像。若拉普拉斯核的中心系数为负时，$c=-1$；若拉普拉斯核的中心系数为正时，$c=1$

In Section 3.5 , we normalized smoothing kernels so that the sum of their coefficients would be one. Constant areas in images filtered with these kernels would be constant also in the filtered image. We also found that the sum of the pixels in the original and filtered images were the same, thus preventing a bias from being introduced by filtering (see Problem 3.39 ). When convolving an image with a kernel whose coefficients sum to zero, it turns out that the pixels of the filtered image will sum to zero also (see Problem 3.40 ). This implies that images filtered with such kernels will have negative values, and sometimes will require additional processing to obtain suitable visual results. Adding the filtered image to the original, as we did in Eq. (3-63) , is an example of such additional processing.

# 3、Unsharp Masking and Highboost Filtering (非锐化掩蔽和高提升滤波)

unsharp masking (非锐化掩蔽): 通过从原图像中减去一个经过平滑(unsharp or smoothed)的图像获得一个掩模，然后令原图像加这个掩模来锐化图像。
$g_{mask}(x,y)=f(x,y)-\bar{f}(x,y)$

$g(x,y)=f(x,y)+kg_{mask}(x,y)$

# 4、一阶微分(梯度)

$\nabla f \equiv grad(f)= \left[ \begin{matrix} g_x \\ g_y \end{matrix} \right]= \left[ \begin{matrix} \frac{\partial f}{\partial x} \\ \frac{\partial f}{\partial y} \end{matrix} \right]$

$M(x,y)=||\nabla f||=mag(\nabla f)=\sqrt{g_x^2+g_y^2}$

$M(x,y) \approx |g_x|+|g_y|$

#### (1) 这是前面介绍过的，采用difference的定义

$g_x(x,y)=f(x+1,y)-f(x,y)$

$g_y(x,y)=f(x,y+1)-f(x,y)$

#### (2) Roberts 梯度算子

$g_x(x,y)=f(x+1,y+1)-f(x,y)$

$g_y(x,y)=f(x+1,y)-f(x,y+1)$

#### (3) Sobel 算子

$g_x(x,y)=\frac{\partial f}{\partial x}=(f(x+1,y-1)+2f(x+1,y)+f(x+1,y+1))-(f(x-1,y-1)+2f(x-1,y)+f(x-1,y+1))$

$g_y(x,y)=\frac{\partial f}{\partial y}=(f(x-1,y+1)+2f(x,y+1)+f(x+1,y+1))-(f(x-1,y-1)+2f(x,y-1)+f(x+1,y-1))$

# 5、拉普拉斯算子(二阶)与梯度算子(一阶)的比较

The Laplacian, is a second-order derivative operator and has the definite advantage that it is superior for enhancing fine detail. However, this causes it to produce noisier results than the gradient. This noise is most objectionable in smooth areas, where it tends to be more visible. The gradient has a stronger response in areas of significant intensity transitions (ramps and steps) than does the Laplacian. The response of the gradient to noise and fine detail is lower than the Laplacian’s and can be lowered further by smoothing the gradient with a lowpass filter.

;