From: Chris Russ Subject: Re: LOG Date: 29 Sep 1999 00:00:00 GMT Message-ID: <37F24F16.418B66EC@aol.com> Content-Transfer-Encoding: 7bit References: <7ru6i0$p5d$1@nnrp1.deja.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="4D4F5353" X-Complaints-To: abuse@prserv.net X-Trace: 29 Sep 1999 17:41:59 GMT, 32.100.213.23 Organization: Reindeer Games, Inc. MIME-Version: 1.0 Reply-To: jcr6@aol.com Newsgroups: sci.image.processing adamjt@my-deja.com wrote: > I have a grey scale image and I want to apply the LOG operator > to it followed by a zerocrossing detector to obtain the edges. > Most of the image processing books provide examples of the 5x5 or the > 17x17 mask. > > Question) I would like to know if anyone could explain > how to generate these discrete masks so that I can generate > masks of other sizes (N) and sigma ... Let's talk about the generic case for the LoG operator. It stands for "Laplacian of the Gaussian" which it literally is. The intention is to low-pass the image with a Gaussian of some radius and then take the Laplacian of that image to look at the highest frequency data that remains below that cut-off. Thus, A simple Gaussian like this: | 1 1 | (G) | 1 1 | would blur the image some. (Naturally you can use larger kernels...) Taking the Laplacian of that image using the standard Laplacian kernel | 0 -1 0 | | -1 4 -1 | (L) | 0 -1 0 | will result in an image that holds the second derivative of the blurred image. One problem is that half of the image is negative so we tend to add 128 in this step, and often scale the values down since the Laplacian (by itself) is a wonderful noise amplifier. You can now look at the zero (or 128, now) crossings in the image to produce your contour lines. Or you can combine the two kernels together. Remember, convolution is commutative. (I o G) o L == I o (G o L) Thus we can convolve G and L together to form the following kernel: | 0 -1 -1 0 | | -1 2 2 -1 | | -1 2 2 -1 | | 0 -1 -1 0 | Or if we used | 1 2 1 | | 2 4 2 | (slightly larger G) | 1 2 1 | for the Gaussian, the LoG would look like | 0 -1 -2 -1 0 | | -1 0 2 0 -1 | | -2 2 8 2 -2 | | -1 0 2 0 -1 | | 0 -1 -2 -1 0 | which, incidentally, is called a "Mexican Hat Filter." Natually, you can construct the size you like by playing the the original Gaussian function. (You are changing which spatial frequency that is your cutoff by playing with the Gaussian function, and edges can get shifted significantly as you go to lower frequencies.) -Chris Russ