# Edge map based on a Haar Wavelet Transform

I have been implementing the paper Blur Detection for Digital Images Using Wavelet Transform and was asking myself how the following formula could reconstruct the edges given a Haar Wavelet transformed image :

$$\sqrt{LH_i^2 + HL_i^2 + HH_i^2}$$

This formula is on page 2, Algorithm 1, step 2.

I looked at the reference given, but couldn't find where this was explained.

• @ CpCd0y, Are you able to detect blur? – Abc Nov 26 '17 at 7:41
• I tried that paper too, but it does not work for me. – Abc Nov 26 '17 at 7:41
• I remember it somewhat working, but their method has a high error rate for me, so it's not the best way to detect blur. – CpCd0y Nov 26 '17 at 15:33
• but in my image, the maximum value in first scale is always lower than second and third scale, so in my images, not able to get dirac structure. so every blur image is detected as not blurry image. can we talk on chat? because i want to clear my understanding on this algorithm with you. – Abc Nov 27 '17 at 10:42
• Also, the paper said that if you lower the scale of image, the intensity of edge will get reduce. but intensity of edge is always high in lower scale for example at 3rd scale on window 8x8. – Abc Nov 27 '17 at 10:44

One single level of a standard separable 2-channel wavelet transform, denoted by $i$, uses a low-pass $l$ and a high-pass $h$ filters (followed by downsampling). Traditionally, one applies $l$ and $g$ on the rows of the image, putting the downsampled low-passed coefficients on a left-half, and the downsampled high-passed coefficients on a left-half. Then the resulting image is processed in the same way column-wise.

This results in a set of four separable 2D filters:

• $l$ on rows, $l$ on columns (LL)
• $l$ on rows, $h$ on columns (LH)
• $h$ on rows, $l$ on columns (HL)
• $h$ on rows, $h$ on columns (HH)

producing the arrangement below. This is iterated (levels) for on the image, then on the low-pass/low-pass images (LL)

Among those filters, three (LH, HL, HH) can be considered as edge detectors ($h$ is similar to a 2-point gradient) in different directions: more horizontal (HL), more vertical (LH), somehow diagonal (HH).

The corresponding coefficients, as least their combined energy, can be interpreted as a measure of edge strength, a map computed for each level.

Remember that for a continuous 2D field modeling an image $f(x,y)$, the image gradient

$$\nabla f =\left[\frac{\partial f(x,y)}{\partial x} ,\frac{\partial f(x,y)}{\partial y} \right]^T$$

represents the local directional change in image intensities, whose norm is a measure of gradient "magnitude". You can compute several norms, the most common being the Euclidean, the Taxicab or the max norms.

The Haar filter $[1\,-1]$ is one possible discretization for the 1D gradient, the three 2D Haar wavelets compute an horizontal, a vertical and a somewhat diagonal gradient, hence their combined energy (Euclidean norm) is an estimate of the true gradient magnitude.

• Thanks for your answer. Could you elaborate more on the gradient part ? Is this why we have to compute the Euclidean distance between HL, LH and HH ? – CpCd0y Mar 9 '17 at 9:12
• so it mean magnitude will be sqrt (vv + hh + d*d) – Abc Nov 17 '17 at 11:56
• After re-reading this answer, it seems like haar filter [1 -1] is actually 1D gradient. – Abc Nov 25 '17 at 9:37
• There several potential discrete 1D gradient, and this one is the shortest. It provides a derivative estimate at the mid-point between two pixels – Laurent Duval Nov 25 '17 at 9:51