<< Chapter < Page Chapter >> Page >

equations 5 and 6

where Gx and Gy are the values of the partial derivatives along the x and y directions, respectively, at the pixel located at (i, j)of the image A.

Gx and Gy

A variety of different discrete differentiation operators exist to approximate the gradient of the image. The operator we choose in our implementation is the Sobel operator.

Gx and Gy

Like our Gaussian kernel, the Sobel operator (in both the x and y directions) is separable:

Gx and Gy Separable

Thus, we perform two separable convolutions with the separated Sobel filter on the Gaussian-filtered image to obtaingradients in the horizontal and vertical directions, and determine the magnitude and angle matrices G and Theta fromequations (5) and (6).

Non-maximum suppression and selective thresholding

Given the gradient magnitude and direction of the Gaussianfiltered image, the final step of the edge detection algorithm isto determine which pixels should be selected as edge pixels, and which should be rejected. We define two procedures, nonmaximumsuppression and selective thresholding, to gain a reasonably accurate edge map from the gradient.Non-maximum suppression selects and rejects edge pixels according to the following criteria:

  1. Pixels whose gradient magnitude is below a userdefined low threshold, tl, is immediately rejected
  2. If the gradient magnitude of a pixel is greater than that of the pixels in either direction of the gradient angleof that pixel, then the pixel is accepted if its gradient magnitude is greater than a user-defined high threshold,th

The selective thresholding technique extends on the procedure of non-maximum suppression. For any pixel that passes crtiteria(2) (maximized, relative to the neighboring pixels, along the gradient direction), consider an a x a box around the pixel.If any pixel within the box exceeds the low threshold tl, then the pixel is accepted. This technique attempts to catch pixelsthat might “connect” ridge pixels identified by criteria (2) but fail to satify the criterion themselves, in order to create morecontinuous edge lines.

Fig. 9. original image input to sobel filter

Input to Sobel filter

Fig. 10. sobel filter in both x and y applied to blurred image

figure 9 Sobel filtered in x and y directions

Fig. 11. gradient of figure 10 as 3d mesh

Gradient of Figure 10 as 3D mesh

Fig. 12. output of edge detection algorithm after non-maximum suppression and selective thresholding on the image of figure 9, with parameters tl = 70 and th = 80

Output of edge detection algorithm after non-maximum suppression and selective thresholding on the image of Figure 9, with parameters tl = 70 and th = 80

Gpu parallelization and cuda implementation

We begin with a parallelized implementation of separable convolution, since the same convolution operation is applied for both the initial Gaussian low pass filter and the edge detectingSobel filter. Our parallel implementation involves first independently computing the convolution with the horizontalfilter (h2 in Equation (2)), then convolving that result with the vertical filter h1. In computing the output y[m; n]at every index (i, j), we launch a kernel with 16 threads per block,where the total number of blocks along one dimension is equal to the size of that dimension divided by 16. For our5312 x 2988 test images, this corresponds to 332 blocks in the horizontal direction and 186 blocks in the vertical direction,each with 16 computational threads.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Elec 301 projects fall 2015. OpenStax CNX. Jan 04, 2016 Download for free at https://legacy.cnx.org/content/col11950/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Elec 301 projects fall 2015' conversation and receive update notifications?

Ask