def lane_fit_on_prediction(Roi_img, src, dst, dst_size): warped_img, M = sliding_window_approach.perspective_warp( Roi_img, dst_size, src, dst) margin = 35 nwindows = 12 # InitialPoints Estimation using K-Means clustering margin, margin_1, modifiedCenters = sliding_window_approach.initialPoints( warped_img, margin) # Sliding Window Search out_img, curves, lanes, ploty = sliding_window_approach.sliding_window( warped_img, modifiedCenters, nwindows, margin, margin_1) return warped_img, out_img, curves, lanes, ploty, modifiedCenters
#!/usr/bin/env python import rospy import numpy as np import cv2 from cv_bridge import CvBridge from sensor_msgs.msg import Image import os os.environ[ 'PYGAME_HIDE_SUPPORT_PROMPT'] = "hide" # Hides the pygame version, welcome msg from os.path import expanduser import glob import scipy.signal as signal import sliding_window_approach DBASW = sliding_window_approach.sliding_window() class hilly_nav(): def __init__(self): self.image = Image() self.roi_img = Image() self.final_img = [] self.modifiedCenters_local = [] self.crop_ratio = 0.3 # Ratio to crop the background parts in the image from top self.centerLine = [] def segment_image(self): # define range of blue color in HSV