title: Line detection in image
body: <p>I am new to image processing and I was trying to detect vertical lines using this code-</p>
  
  <pre><code>image=imread('benzene.jpg');  
  BW = im2bw(image);
  w1=[-1 2 -1 ; -1 2 -1 ; -1 2 -1];
  g=(imfilter(double(BW),w1));
  g=abs(g);
  T=max(g(:));
  g=g&gt;=T;
  imshow(g);
  </code></pre>
  
  <p>This was my image-</p>
  
  <p><img src="https://i.stack.imgur.com/bdNOt.png" alt="enter image description here"></p>
  
  <p>And this is what I got after performming the operations-
  <img src="https://i.stack.imgur.com/phLp1.jpg" alt="enter image description here"></p>
  
  <p>So my question is why am I getting this output?There are 10 vertical lines if vertical double bonds are counted as 2 distinct vertical lines.Also what if I want to get horizontal,vertical,45 and -45 all the lines,how can I use all the 4 masks to get one single output?</p>