title: Laplacian of Gaussian (LOG) edge detector in MATLAB
body: <p>I intend to peform Laplacian of Gaussian edge operator in matlab.. </p>
  
  <p>This is the knowledge i have</p>
  
  <pre><code>LOG operators are second-order deriatives operator. Second order deriatives operator result in zero-crossing. At the step, position where 1st deriative is maximum is where the second deriative has zero crossing.
  </code></pre>
  
  <p>The mask i used is mask = [0 1 0; 1 -4 1; 0 1 0];</p>
  
  <p>The original image is </p>
  
  <p><img src="https://i.stack.imgur.com/K5U6F.jpg" alt="enter image description here"></p>
  
  <p>The output i get is from the original image</p>
  
  <p><img src="https://i.stack.imgur.com/XMXcW.png" alt="enter image description here"></p>
  
  <p>My question is why does the edges in the image appear white instead of black(=0). Should it be black? Am i right or wrong? can anyone explain?</p>
  
  <p>Convolution function:</p>
  
  <pre><code>function [ I2 ] = image_convolution(I,w,G)
  m= (w-1)/2;
  N= size(I,1);
  M=size(I,2);
  for i=1:N
      for j=1:M
          if (i &gt; N-m-1 || j &gt; M-m-1 || i&lt;m+1 || j &lt;m+1)
              I2(i,j) = 0;
              continue;
          end
          sum1 = 0;
          for u=1:w
              for v=1:w
                  sum1 = sum1+I(i+u-m-1,j+v-m-1)*G(u,v);
              end
          end
          I2(i,j)=sum1;
      end
  end
  
  end
  </code></pre>