Example #1
0
def test(filename, n=0, show=False):
    import importlib
    importlib.reload(mask)
    print(persp._perspective)
    im_ = plt.imread(filename)
    im = clb.undistort(im_)
    if n == -1:
        return persp.warp(im, show=show)
    elif n == 0:
        im2 = persp.warp(im, show=show)
        color_mask.hls_channel(im2, channel='h', thresh=(100, 255), show=show)
        color_mask.hls_channel(im2, channel='l', thresh=(200, 255), show=show)
        color_mask.hls_channel(im2, channel='s', thresh=(100, 255), show=show)
    elif n == 1:
        im_eq = equalize_hist(im, show=show)
        im2 = persp.warp(im_eq, show=show)
        color_mask.hls_channel(im2, channel='h', thresh=(0, 100), show=show)
        color_mask.hls_channel(im2, channel='l', thresh=(200, 255), show=show)
        color_mask.hls_channel(im2, channel='s', thresh=(100, 255), show=show)
    elif n == 2:
        im2 = persp.warp(im, show=show)
        color_mask.rgb_channel(im2, channel='r', thresh=(220, 255), show=show)
        color_mask.rgb_channel(im2, channel='g', thresh=(210, 255), show=show)
        color_mask.rgb_channel(im2, channel='b', thresh=(0, 100), show=show)
    elif n == 3:
        im2 = persp.warp(im, show=show)
        color_mask.hls_channel(im2, channel='h', thresh=(0, 90), show=show)
        color_mask.hls_channel(im2, channel='l', thresh=(200, 255), show=show)
        color_mask.hls_channel(im2, channel='s', thresh=(110, 255), show=show)
    elif n == 4:
        im2 = persp.warp(im, show=show)
        return custom_mask.special_mask(im2, show=show)
Example #2
0
 def samples(self, im, target='data/video_dataset/'):
     im = clb.undistort(im)
     shape = self._model.input_shape
     for nw, se in self._slicer.wins:
         ys, ye = nw[1], se[1]
         xs, xe = nw[0], se[0]
         cpy = cv.resize(im[ys:ye, xs:xe, :], shape[:2])
         cpy = common.cvt_color(cpy, color='BGR', src='RGB')
         cv.imwrite('{0}/{1}.png'.format(target, self._i), cpy)
         self._i += 1
     print(self._i)
     return im
Example #3
0
 def process(self, frame, show=False):
     im = clb.undistort(frame)
     warped = prsp.warp(im)
     masked = custom_mask.apply(warped, show=show)
     lp, rp = self._find_lane_points(masked,
                                     num_strips=10,
                                     radius=70,
                                     show=show)
     height = masked.shape[0]
     width = masked.shape[1]
     llane = Lane(lp, end=height - 1, num=height)
     rlane = Lane(rp, end=height - 1, num=height)
     offset = Lane.offset(llane,
                          rlane,
                          y=masked.shape[0] - 1,
                          frame_width=width)
     lcurv = llane.curvature(height // 2)
     rcurv = rlane.curvature(height // 2)
     fill = Lane.fill_lanes(warped, llane, rlane, show=show)
     return self._final_frame(im, fill, lcurv, rcurv, offset, show=show)
Example #4
0
 def process(self, orig, show=False):
     im = clb.undistort(orig, show=show)
     self._find_cars_heatmap(im, show=show)
     self._find_cars_boxes(show=show)
     self._reset_heatmap()
     return self._draw_car_boxes(orig, show=show)