Edge detection with the Marr and Hildreth's algorithm using the zero-crossing computation

Computing the zero-crossings in the LoG-convolved image (to detect edges as a binary image) was proposed by Marr and Hildreth. Identification of the edge pixels can be done by viewing the sign of the LoG-smoothed image by defining it as a binary image. The algorithm to compute the zero-crossing is as follows:

  1. First, convert the LoG-convolved image to a binary image by replacing the pixel values by 1 for positive values and 0 for negative values
  2. In order to compute the zero-crossing pixels, we need to simply look at the boundaries of the non-zero regions in this binary image
  3. Boundaries can be found by finding any non-zero pixel that has an immediate neighbor that is zero
  4. Hence, for each pixel, if it is non-zero, consider its eight neighbors; if any of the neighboring pixels is zero, the pixel can be identified as an edge

The implementation of this function is left as an exercise. The following code block depicts the edges of the same zebra image detected with zero-crossings:

fig = pylab.figure(figsize=(25,15))
pylab.gray() # show the filtered result in grayscale
for sigma in range(2,10, 2):
pylab.subplot(2,2,sigma/2)
result = ndimage.gaussian_laplace(img, sigma=sigma)
pylab.imshow(zero_crossing(result)) # implement the function zero_crossing() using the above algorithm
pylab.axis('off')
pylab.title('LoG with zero-crossing, sigma=' + str(sigma), size=20)
pylab.show()

The following screenshot shows the output of the preceding code block, with edges identified by zero-crossing alone at different σ scales:

The previous images show zero-crossings with LoG/DoG as an edge detector. It should be noticed that the zero-crossings form closed contours.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.211.239