def defineLanesWithColor(image, name, r, g, b): # Make a copy of image color_select = imgUtil.copyImage(image) # Mask pixels below the threshold color_thresholds = cs.setColorThresholds(image, color_select, r, g, b) #Save image imgUtil.displayAndSaveImage(color_select, './imgs/' + name + '-color-lane-selection.jpg') return color_select
def defineLanesWithRegion(image, name, r, g, b): # Make a copy of image region_select = imgUtil.copyImage(image) color_select = imgUtil.copyImage(image) # Find the region inside the lines color_thresholds = cs.setColorThresholds(image, color_select, r, g, b) region_thresholds = rgn.defineRegionOfInterest(image) # Find where image is both colored right and in the region region_select[~color_thresholds & region_thresholds] = [255,0,0] #Save image imgUtil.displayAndSaveImage(region_select, './imgs/' + name + '-region-lane-selection.jpg') return region_select
def defineLanesWithColorAndRegion(image, name, r, g, b): # Make a copy of image color_select = imgUtil.copyImage(image) region_select = imgUtil.copyImage(image) # Mask pixels below the threshold color_thresholds = cs.setColorThresholds(image, color_select, r, g, b) # Find the region inside the lines region_thresholds = rgn.defineRegionOfInterest(image) # Mask color and region selection region_color_select = imgUtil.copyImage(color_select) region_color_select[color_thresholds | ~region_thresholds] = [0, 0, 0] imgUtil.displayAndSaveImage(region_color_select, './imgs/' + name + '-region-color-lane-selection.jpg') return region_color_select
def defineLanesWithHoughTransformAndRegionInterest(image, name): edges = defineLanesWithCanny(image, name, False) hough_transformed_select = ht.houghTransformAndRegionSelect(image, edges) imgUtil.displayAndSaveImage(hough_transformed_select, './imgs/' + name + '-hough-transform-region-lane-selection.jpg')