Grabcut

This worked okay, ought to be good for segmenting road from sky and terrain and cars, but loses road in distance, edges of road aren't great.
Possibly could be used for segmenting lane markers but won't work in distance.

Watershed

Couldn't get demo to work, Sketcher works how?

Floodfill

This works really good for finding road and lane markers.


In [ ]:
import cv2

filename = '../vis_save_100005.jpg'
filename = '../vis_save_101083.jpg'
#filename = '../vis_save_104440.jpg'



cur = cv2.imread(filename, cv2.CV_LOAD_IMAGE_GRAYSCALE)

figure(figsize = (18,10))

vis = np.zeros((cur.shape[0], cur.shape[1], 3), np.uint8)
vis[:,:,0] = cur
vis[:,:,1] = cur
vis[:,:,2] = cur
imshow(vis)

In [ ]:
method = cv2.ADAPTIVE_THRESH_MEAN_C
#method = cv2.ADAPTIVE_THRESH_GAUSSIAN_C
offset = 10
sz = 21
wd = cur.shape[1]
ht = cur.shape[0]
cur2 = cur[:-ht/4, wd/3:2*wd/3+50]

#cur2 = cv2.GaussianBlur(cur2, (3,3), 1 )  #cv2.blur(cur2, (3,3))
cur2 = cv2.medianBlur(cur2, 3) 
cur3 = cv2.adaptiveThreshold(cur2, 255, method, cv2.THRESH_BINARY_INV, sz, offset)

figure(figsize = (28,20))
vis = np.zeros((cur3.shape[0], cur3.shape[1], 3), np.uint8)
print vis.shape
vis[:,:,0] = cur3
vis[:,:,1] = cur3
vis[:,:,2] = cur3
imshow(vis)