title: Lane Departure Warning System for Autonomous Driving- TypeError: expected non-empty vector for x
body: <p>I'm using this program from github <a href="https://github.com/JunshengFu/driving-lane-departure-warning" rel="nofollow noreferrer">https://github.com/JunshengFu/driving-lane-departure-warning</a> . I am trying to run a video file and i get below errors </p>
  
  <p>File "/home/ramakrishna/PycharmProjects/Lanedect/driving-lane-departure-warning-master/lane.py", line 602, in process_frame</p>
  
  <pre><code>detector(binary_sub, ploty, visualization)
  </code></pre>
  
  <p>File "/home/ramakrishna/PycharmProjects/Lanedect/driving-lane-departure-warning-master/lane.py", line 554, in detector</p>
  
  <pre><code>left_fit, right_fit = full_search(binary_sub, visualization=visualization)
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>def detector(binary_sub, ploty, visualization=False):
  
  left_fit, right_fit = full_search(binary_sub, visualization=visualization)
  
  left_fitx = left_fit[0] * ploty**2 + left_fit[1] * ploty + left_fit[2]
  right_fitx = right_fit[0] * ploty**2 + right_fit[1] * ploty + right_fit[2]
  std_value = np.std(right_fitx - left_fitx)
  </code></pre>
  
  <p>File "/home/ramakrishna/PycharmProjects/Lanedect/driving-lane-departure-warning-master/lane.py", line 294, in full_search</p>
  
  <pre><code>right_fit = np.polyfit(righty, rightx, 2)
  </code></pre>
  
  <p>Code :
   # Fit a second order polynomial to each</p>
  
  <pre><code>left_fit = np.polyfit(lefty, leftx, 2)
  right_fit = np.polyfit(righty, rightx, 2)
  </code></pre>
  
  <p>File "/usr/local/lib/python3.4/dist-packages/numpy/lib/polynomial.py", line 555, in polyfit</p>
  
  <pre><code>raise TypeError("expected non-empty vector for x")
  </code></pre>
  
  <p>Code :</p>
  
  <pre><code>if x.size == 0:
      raise TypeError("expected non-empty vector for x")
  if y.ndim &lt; 1 or y.ndim &gt; 2:
      raise TypeError("expected 1D or 2D array for y")
  </code></pre>
  
  <p>TypeError: expected non-empty vector for x</p>