A method of detecting road boundaries, comprising the steps of: receiving an image of a road in front of a vehicle from an imager; determining a region of interest in an identified road in the image; and detecting road markings by detecting lane markings in the region of interest, and if lane markings cannot be detected, then detecting road boundaries in the region of interest; wherein detecting road markings includes: determining luminance gradients in the region of interest; and detecting road markings by comparing the luminance gradients to a strength threshold calculated as scaled average background gradient magnitude; and wherein said determining luminance gradients includes determining edge strength in the region of interest to identify potential road marking edges; and wherein said detecting road markings includes comparing the edge strength to said strength threshold by finding peaks and valleys in luminance gradients of image pixels that are respectively higher and lower than the strength threshold, wherein a gradient peak represents an edge in the image, and a gradient valley represents an edge in the image; and wherein detecting road markings further includes for multiple image rows in the region of interest: identifying among said edges a pair of edges as potential road marking edges by comparing each edge strength to said strength threshold; determining edge pair spacing between the pair of edges; and comparing said edge pair spacing to spacing minimum and maximum thresholds; wherein if the edge pair spacing is between the minimum and maximum passing a curve fit through candidate points identified for each of said rows from said edge pair representing a potential lane marking; and selecting all edge pairs that contributed to an acceptable first approximate line fit, as lane marking identifiers; and wherein if said edge pair spacing is not between the minimum and maximum thresholds, or an acceptable line fit was not found, then fitting a second line to individual edges in said rows representing said potential road boundary identifiers; and selecting all edges that contributed to an acceptable second approximate line fit, as road boundary identifiers. receiving an image of a road in front of a vehicle from an imager; determining a region of interest in an identified road in the image; and detecting road markings by detecting lane markings in the region of interest, and if lane markings cannot be detected, then detecting road boundaries in the region of interest; determining luminance gradients in the region of interest; and detecting road markings by comparing the luminance gradients to a strength threshold calculated as scaled average background gradient magnitude; and identifying among said edges a pair of edges as potential road marking edges by comparing each edge strength to said strength threshold; determining edge pair spacing between the pair of edges; and comparing said edge pair spacing to spacing minimum and maximum thresholds; wherein if the edge pair spacing is between the minimum and maximum passing a curve fit through candidate points identified for each of said rows from said edge pair representing a potential lane marking; and selecting all edge pairs that contributed to an acceptable first approximate line fit, as lane marking identifiers; and wherein if said edge pair spacing is not between the minimum and maximum thresholds, or an acceptable line fit was not found, then fitting a second line to individual edges in said rows representing said potential road boundary identifiers; and selecting all edges that contributed to an acceptable second approximate line fit, as road boundary identifiers.