I'm not sure if my problem is exactly a coding problem, however maybe
someone can help me out.  I am having difficulty creating a Laplacian
of Gaussian kernel filter.  The function is as follows is on
http://academic.mu.edu/phys/matthysd/web226/Lab02.htm

I am attempting a 9x9 Mask using standard deviation of 1.4 just like
on their example.

I have the following code however it does not approximate to those
values.


            const Int32 N = 9; //, Nh = N / 2;
            float[,] MASK = new float[N, N];
            const float PI = 3.14159f;

            float standardDeviation = 1.4f;
            float center = (float) (N/2);

            float sigmaSquared = standardDeviation * standardDeviation;
            float sigma4th = standardDeviation * standardDeviation *
standardDeviation * standardDeviation;


                for( int x = 0; x < N; ++x )
            {
                    for( int y = 0; y < N; ++y )
                    {
                            float X = (float) x;
                            float Y = (float) y;

                            float distFromCenterSquared = ( X - center ) * (X -
center ) + ( Y - center ) * ( Y - center );

                    float baseEexponential = (float)Math.Exp(-
distFromCenterSquared / (2.0f * sigmaSquared));
                    float part2 = 1 - (distFromCenterSquared / (2 *
sigmaSquared));
                    MASK[x, y] = (part2 / (PI * sigma4th)) *
baseEexponential;

                    }
            }

Thank you.


-- 
To unsubscribe, reply using "remove me" as the subject.

Reply via email to