示例#1
0
    def process_frame_bp(self, img_data):
        # FIXME: es ware besser wenn unser pipeline nativ mit RGB arbeitet
        bad_frame_list = pd.parm_dict['bad_frame_ixes']
        bummer = False
        img = iu.Image(img_data=img_data, title="", img_type='rgb')
        bgr_img = iu.cv2CvtColor(img, cv2.COLOR_RGB2BGR)
        if bad_frame_list.count(self.frame_ctr):
            bummer = True
            print("WHOO HOOO: logging stuff for frame %d" % self.frame_ctr)
            self.bce_set_enabled(bummer)
            ut.brk("dig in bubba")
        pipe_out_img = self.lane.lane_finder_pipe(bgr_img, self.cache_dict,
                                                  self.parm_dict, self.vwr)
        if bummer:
            bummer = False
            self.bce_set_enabled(bummer)

        if pipe_out_img == None:
            print("\ncould not find lane boundaries in frame %d\n" %
                  (self.frame_ctr))
            self.faulty_frames += 1
            img.title = "badFrame_" + str(self.frame_ctr) + ".jpg"
            if self.vwr and self.vwr.svr:
                self.vwr.svr.save(img)
            ret_img = img
        else:
            ret_img = iu.cv2CvtColor(pipe_out_img, cv2.COLOR_BGR2RGB)
        self.frame_ctr += 1
        if self.faulty_frames:
            ut._quit("my dreams are shattered, i quit")
        return ret_img.img_data
def doit():
    lane = lu.Lane(cd, pd, vwr=vwr, binary_warper=iu.hls_lab_lane_detect)

    for path in ut.get_fnames("test_images/", "*.jpg"):
        in_img = iu.imRead(path, reader='cv2', vwr=vwr)
        out_img = lane.lane_finder_pipe(in_img, cd, pd, vwr=vwr)
        ut.brk("check test_out")
示例#3
0
 def finis(self, nonzerox, nonzeroy):
     try:
         self.concat_ixes()
     except Exception as ex:
         # Avoids an error if the above is not implemented fully
         ut.brk("%s.finis => %s" % (self.title, ut.format_exception(ex)))
         pass
     self.set_x(nonzerox[self.ix_list])
     self.set_y(nonzeroy[self.ix_list])
示例#4
0
def doit(path="", cd=None, pd=None, vwr=None):
    vwr.flush()
    for path in ut.get_fnames("test_images/", "problem_binary_warped.jpg"):
        img = iu.imRead(path,
                        flags=cv2.IMREAD_GRAYSCALE,
                        reader='cv2',
                        vwr=None)
        ut.brk("wtf?")
        hist = iu.hist(img)
        ut.brk("plot the histogram")
        ut.brk("call get_LR_hist_max_ix()")
        iv._push(vwr, hist)
    vwr.show()
示例#5
0
def _push_deprecated(vwr, img_obj):
    ut.brk("you didn't mean that")
    raise Exception("I TOLD you that you didn't mean that")
示例#6
0
def analyze_hist(hist):
    # see lesson 7.4
    width = hist.img_data.shape[0]
    midway = width // 2

    left_max_ix = np.argmax(hist.img_data[0:midway])
    right_max_ix = midway + np.argmax(hist.img_data[midway:width])
    print("histo maxen = %d, %d" % (left_max_ix, right_max_ix))


def doit(path="", cd=None, pd=None, vwr=None):
    vwr.flush()
    for path in ut.get_fnames("test_images/", "problem_binary_warped.jpg"):
        img = iu.imRead(path,
                        flags=cv2.IMREAD_GRAYSCALE,
                        reader='cv2',
                        vwr=None)
        ut.brk("wtf?")
        hist = iu.hist(img)
        ut.brk("plot the histogram")
        ut.brk("call get_LR_hist_max_ix()")
        iv._push(vwr, hist)
    vwr.show()


cache_dict, parm_dict = ut.app_init(viewer=True, saver=False, title="whatever")
vwr = cache_dict['viewer']
ut.brk("this unit test is broken")
doit(cd=cache_dict, pd=parm_dict, vwr=vwr)
示例#7
0
def FIXME_lane_detect(img, cache_dict=None, parm_dict=None):
    ut.oneShotMsg("FIXME_lane_detect")
    ut.brk("you didn't really mean that")
示例#8
0
#!/usr/bin/env python3

import util as ut

ut.brk("boy howdy")

#!/usr/bin/env python3
#

import util as ut
import ImgViewer as iv
import cv2
import numpy as np
import ImgUtil as iu
import ImgViewer as iv
import LaneUtils as lu

ut.brk("this is broken since recent interface change")


def doit(path="", cd=None, pd=None, vwr=None):
    for path in ut.get_fnames("test_images/", "*.jpg"):
        lane = lu.Lane(cd, pd, vwr)
        vwr.flush()
        print("FIXME: path = %s" % path)
        init_img, binary_warped = iu.get_binary_warped_image(path, cd, pd, vwr)
        iv._push(vwr, init_img)
        iv._push(vwr, binary_warped)
        lane.find_pixels_all_bndrys(binary_warped)
        lane.fit_polynomials()
        vwr.show()


cache_dict, parm_dict = ut.app_init(viewer=True, saver=True, title="whatever")
vwr = cache_dict['viewer']
doit(cd=cache_dict, pd=parm_dict, vwr=vwr)