title: Finding horizontal and vertical lines using opencv
body: <p>I am trying to pull the horizontal and vertical lines out of an image, to use them to find the points at which they intersect. I am using this page as a reference, but I think the problem is with the opencv object that I am not understanding. This reference is written in C++ but I am doing it in Python. When I display the horizontal image, I just have a completely black screen, although I should have an image of only the horizontal lines. 
  Would anyone know what I am doing incorrectly?</p>
  
  <p>Reference:
  <a href="https://docs.opencv.org/3.2.0/d1/dee/tutorial_moprh_lines_detection.html" rel="nofollow noreferrer">https://docs.opencv.org/3.2.0/d1/dee/tutorial_moprh_lines_detection.html</a></p>
  
  <p>Code:</p>
  
  <pre><code>import cv2
  import numpy as np
  img = cv2.imread('msss.png')
  blur_img = cv2.GaussianBlur(img, (5, 5), 0)
  gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
  cv2.imshow('image', gray_img)
  cv2.waitKey(0)
  cv2.destroyAllWindows()
  height, width = gray_img.shape
  horizontal = gray_img.copy()
  horizontal_size = int(width/30)
  horizontal_struct = cv2.getStructuringElement(cv2.MORPH_RECT, 
                                               (horizontal_size, 1))
  horizontal = cv2.erode(horizontal, horizontal, horizontal_struct, (-1, -1))
  horizontal = cv2.dilate(horizontal, horizontal, horizontal_struct, (-1, -1))
  cv2.imshow('image', horizontal)
  cv2.waitKey(0)
  cv2.destroyAllWindows()
  </code></pre>