title: Confusion on Sobel mask
body: <p>What is the exact mask for Sobel (Gx and Gy)? What I saw is there are two types on how people wrote it such as below,</p>
  
  <p><strong>Style 1</strong></p>
  
  <pre><code>Gx = [-1 -2 -1
          0 0 0
          1 2 1]
  
  Gy = [-1 0 1
        -2 0 2
        -1 0 1]
  </code></pre>
  
  <p><strong>Style 2</strong></p>
  
  <pre><code>Gx = [-1 0 1
        -2 0 2
        -1 0 1]
  
  Gy = [-1 -2 -1
          0 0 0
          1 2 1]
  </code></pre>
  
  <p><strong>Edited</strong></p>
  
  <p>@Aurelis </p>
  
  <p>In Matlab --> (row x col)</p>
  
  <p>In OpenCV --> (col x row)</p>
  
  <p>However, the diagram below is correct for both</p>
  
  <pre><code>--&gt;column
  ^
  |row
  |
  </code></pre>
  
  <p>Probably in Matlab will output Gx == horizontal edge, Gy == vertical edge if Style 1 is used and Gx == horizontal edge, Gy ==vertical edge if Style 2 is used. Both will produce same output (internal operation might be different due to the col-row major order). </p>
  
  <p>@Abhishek You are using style 1 to compute the horizontal and vertical edge? and Gx correspond to horizontal edge while Gy correspond to vertical edge?
  Does that mean style 2 is complement of that? For eg. computing Gx will gives vertical edge and Gy gives horizontal edge?</p>