Wednesday, 21 September 2016

What's logic behind the constuction of Sobel's filter in image processing?


I am basically very new to this image processing field. I am presently working on edge detection on colour images. While learning the basics of edges and edge detection in images, I encountered image derivatives and spatial masks for the corresponding operations. It's where I happened to learn about Prewitt operator and Sobel operators. I cannot understand the logic behind the construction of these masks and how does it detect lines. Can someone help me please?



Answer



A first rationale is to be very short, as there was a time when computing on images was expensive. Then, a contour or an edge often present a fast variation in image intensities, that can be enhanced by derivatives. Sobel filters emulate such derivatives in one direction, and slightly average pixels in the complementary direction, to smooth small variations or noise.


One direction implements the shortest possible centered 1D discrete derivative:


$$\begin{bmatrix} -1 &0 &1 \end{bmatrix} $$ to detect variations across lines, the other the shortest non-trivial Pascal/Gaussian smoothing $$\begin{bmatrix} 1&2&1 \end{bmatrix}^T $$ to smooth along columns, resulting in, for instance: $$ \begin{bmatrix} 1&2&1 \end{bmatrix}^T\cdot \begin{bmatrix} -1 &0 &1 \end{bmatrix} $$ or $$ \begin{bmatrix} -1 &0 &1 \\ -2 &0 &2 \\ -1 &0 &1 \\ \end{bmatrix} $$


As you can see, this only involves dyadic numbers, so it can be implemented with adds and binary shifts.


Of course, the 3-point derivative often has an additional $1/2$ factor: $$\begin{bmatrix} -1/2 &0 &1/2 \end{bmatrix} $$ to get the appropriate scale factor, and the Pascal smoother has a $1/4$ factor to have its coefficients sum to one $$\begin{bmatrix} 1/4&1/2&1/4 \end{bmatrix} $$ but the resulting global scaling of $1/2\times 1/4$ does not change the edge detection power for such linear filters.


No comments:

Post a Comment

readings - Appending 内 to a company name is read ない or うち?

For example, if I say マイクロソフト内のパートナーシップは強いです, is the 内 here read as うち or ない? Answer 「内」 in the form: 「Proper Noun + 内」 is always read 「ない...