Advanced_Lane_Finding_v2.py
def mag_thresh(gray, thresh_min=0, thresh_max = 255, ksize= 7):

    """
    Apply a threshold based on the absolute value of the sobel filter in a certain direction.
    Sobel derivative image is rescaled to 8bit hence the threshold should be in [0, 255]
    :param gray: grayscale image
    :param thresh_min: 
    :param thresh_max: 
    :param ksize: 
    :return: 
    """

    sobelx = cv2.Sobel(gray, cv2.CV_64F, 1, 0, ksize=ksize)
    sobely = cv2.Sobel(gray, cv2.CV_64F, 0, 1, ksize=ksize)
    # Calculate the gradient magnitude
    gradmag = np.sqrt(sobelx**2 + sobely**2)

    # Rescale to 8 bit
    scale_factor = np.max(gradmag)/255
    gradmag = (gradmag/scale_factor).astype(np.uint8)

    binary_output = np.zeros_like(gradmag)

    binary_output[(gradmag >= thresh_min) & (gradmag <= thresh_max)] = 1

    return binary_output

    Apply a threshold based on the absolute value of the sobel filter in a certain direction.
    Sobel derivative image is rescaled to 8bit hence the threshold should be in [0, 255]
    :param gray: grayscale image
    :param thresh_min: 
    :param thresh_max: 
    :param ksize: 
    :return: 
    
Apply a threshold based on the absolute value of the sobel filter in a certain direction.
Sobel derivative image is rescaled to 8bit hence the threshold should be in [0, 255]
Apply a threshold based on the absolute value of the sobel filter in a certain direction . Sobel derivative image is rescaled to 8bit hence the threshold should be in [ 0 255 ]
def mag_thresh(gray, thresh_min=0, thresh_max = 255, ksize= 7):
    sobelx = cv2.Sobel(gray, cv2.CV_64F, 1, 0, ksize=ksize)
    sobely = cv2.Sobel(gray, cv2.CV_64F, 0, 1, ksize=ksize)
    gradmag = np.sqrt(sobelx**2 + sobely**2)
    scale_factor = np.max(gradmag)/255
    gradmag = (gradmag/scale_factor).astype(np.uint8)
    binary_output = np.zeros_like(gradmag)
    binary_output[(gradmag >= thresh_min) & (gradmag <= thresh_max)] = 1
    return binary_output
def mag_thresh ( gray , thresh_min = 0 , thresh_max = 255 , ksize = 7 ) : sobelx = cv2 . Sobel ( gray , cv2 . CV_64F , 1 , 0 , ksize = ksize ) sobely = cv2 . Sobel ( gray , cv2 . CV_64F , 0 , 1 , ksize = ksize ) gradmag = np . sqrt ( sobelx ** 2 + sobely ** 2 ) scale_factor = np . max ( gradmag ) / 255 gradmag = ( gradmag / scale_factor ) . astype ( np . uint8 ) binary_output = np . zeros_like ( gradmag ) binary_output [ ( gradmag >= thresh_min ) & ( gradmag <= thresh_max ) ] = 1 return binary_output
Apply a threshold based on the absolute value of the sobel filter in a certain direction.
Apply a threshold based on the absolute value of the sobel filter in a certain direction .
"""
    Apply a threshold based on the absolute value of the sobel filter in a certain direction.
    Sobel derivative image is rescaled to 8bit hence the threshold should be in [0, 255]
    :param gray: grayscale image
    :param thresh_min: 
    :param thresh_max: 
    :param ksize: 
    :return: 
    """ # Calculate the gradient magnitude # Rescale to 8 bit
None
gray
None
thresh_min
None
thresh_max
None
ksize
None