# The magnitude spectrum of a sharpening filter

I'm trying to derive an expression for the magnitude spectrum of the following sharpening filter.

$$g(m,n) = \delta(m,n)+\lambda (\delta(m,n) - h(m,n))$$

where $$\lambda$$ is some positive constant and $$h(m,n)$$ is a low pass filter.

$$h(m,n) = \begin{cases} \frac{1}{25}, & \text{for |m| \leq 2, |n| \leq 2} \\ 0, & \text{otherwise} \end{cases}$$

Using the linearity of Fourier transform, I get

$$G(u,v) = 1+\lambda(1-H(u,v))$$

where $$H(u,v) = \frac{1}{25} \cdot \frac{\sin\frac{5\mu}{2}\sin\frac{5\nu}{2}}{\sin\frac{\mu}{2}\sin\frac{\nu}{2}} \cdot e^{j\cdot 6(\mu+\nu)}$$

So, to get the magnitude spectrum, I make the following steps \begin{align*} |G(u,v)|^2 &= \big[(1+\lambda)-\lambda H(u,v)\big] \big[(1+\lambda)-\lambda H^*(u,v)\big] \\ & = (1+\lambda)^2-(1+\lambda)\lambda\cdot 2\Re \big\{H(u,v)\big\}+\lambda^2|H(u,v)|^2 \end{align*}

where $$\Re\big\{H(u,v)\big\} = \frac{1}{25} \cdot \frac{\sin\frac{5\mu}{2}\sin\frac{5\nu}{2}}{\sin\frac{\mu}{2}\sin\frac{\nu}{2}} \cdot \cos(6(\mu+\nu))$$

Therefore, to obtain the magnitude spectrum I should take the square root of the expression above.

However, the picture I get when I'm trying to plot it does not coincide with something that I'm expecting to see. I mean it's a high pass filter, hence there should be something like that. But I get this. Maybe there is a way to simplify this expression or maybe there is something that I'm doing wrong.

UPD: I've figured it out myself. I was inattentive with the exponentials while deriving the expression for the low-pass filter $$H(u,v)$$. There shouldn't be $$\cos(6(\mu+\nu))$$ term, then the result is fine and $$\Re \big\{H(u,v)\big\}=\frac{1}{25} \cdot \frac{\sin\frac{5\mu}{2}\sin\frac{5\nu}{2}}{\sin\frac{\mu}{2}\sin\frac{\nu}{2}}$$
Therefore, \begin{align*} |G(u,v)|^2 &= \big[(1+\lambda)-\lambda H(u,v)\big] \big[(1+\lambda)-\lambda H^*(u,v)\big] \\ & = (1+\lambda)^2-(1+\lambda)\lambda\cdot 2\Re \big\{H(u,v)\big\}+\lambda^2|H(u,v)|^2 = [1+\lambda - \lambda H(u,v)]^2 \end{align*}