parameters: (line_candidates, img_shape)
return_statement: return left_lane, right_lane
docstring: Compute lines that approximate the position of both road lanes.
  
      :param line_candidates: lines from hough transform
      :param img_shape: shape of image to which hough transform was applied
      :return: lines that approximate left and right lane position
docstring_summary: Compute lines that approximate the position of both road lanes.
docstring_tokens: Compute lines that approximate the position of both road lanes .
function: def compute_lane_from_candidates(line_candidates, img_shape):
      """
      Compute lines that approximate the position of both road lanes.
  
      :param line_candidates: lines from hough transform
      :param img_shape: shape of image to which hough transform was applied
      :return: lines that approximate left and right lane position
      """
  
      # separate candidate lines according to their slope
      pos_lines = [l for l in line_candidates if l.slope > 0]
      neg_lines = [l for l in line_candidates if l.slope < 0]
  
      # interpolate biases and slopes to compute equation of line that approximates left lane
      # median is employed to filter outliers
      neg_bias = np.median([l.bias for l in neg_lines]).astype(int)
      neg_slope = np.median([l.slope for l in neg_lines])
      x1, y1 = 0, neg_bias
      x2, y2 = -np.int32(np.round(neg_bias / neg_slope)), 0
      left_lane = Line(x1, y1, x2, y2)
  
      # interpolate biases and slopes to compute equation of line that approximates right lane
      # median is employed to filter outliers
      lane_right_bias = np.median([l.bias for l in pos_lines]).astype(int)
      lane_right_slope = np.median([l.slope for l in pos_lines])
      x1, y1 = 0, lane_right_bias
      x2, y2 = np.int32(np.round((img_shape[0] - lane_right_bias) / lane_right_slope)), img_shape[0]
      right_lane = Line(x1, y1, x2, y2)
  
      return left_lane, right_lane
function_tokens: def compute_lane_from_candidates ( line_candidates , img_shape ) : # separate candidate lines according to their slope pos_lines = [ l for l in line_candidates if l . slope > 0 ] neg_lines = [ l for l in line_candidates if l . slope < 0 ] # interpolate biases and slopes to compute equation of line that approximates left lane # median is employed to filter outliers neg_bias = np . median ( [ l . bias for l in neg_lines ] ) . astype ( int ) neg_slope = np . median ( [ l . slope for l in neg_lines ] ) x1 , y1 = 0 , neg_bias x2 , y2 = - np . int32 ( np . round ( neg_bias / neg_slope ) ) , 0 left_lane = Line ( x1 , y1 , x2 , y2 ) # interpolate biases and slopes to compute equation of line that approximates right lane # median is employed to filter outliers lane_right_bias = np . median ( [ l . bias for l in pos_lines ] ) . astype ( int ) lane_right_slope = np . median ( [ l . slope for l in pos_lines ] ) x1 , y1 = 0 , lane_right_bias x2 , y2 = np . int32 ( np . round ( ( img_shape [ 0 ] - lane_right_bias ) / lane_right_slope ) ) , img_shape [ 0 ] right_lane = Line ( x1 , y1 , x2 , y2 ) return left_lane , right_lane