Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyashladdha committed Aug 9, 2020
1 parent 5a78859 commit 02dc87a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 46 deletions.
Empty file removed cascade
Empty file.
49 changes: 3 additions & 46 deletions laneDetector.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ def process(image):
height=image.shape[0]
width=image.shape[1]

# region_of_interest_vertices=[
# (width/7,height-(height/20)),
# (width*0.515, height/1.35),
# (width*0.529, height/1.3),
# (width*0.70664,height-(height/20))
# ]
region_of_interest_vertices=[
(0,height),(width/2,height/1.70),(width,height)
]
Expand All @@ -49,7 +43,6 @@ def process(image):
Gray_Image=gray_img
Canny_img=cv2.Canny(gray_img,110,130)
canny_Image=Canny_img

roi_image=region_of_interest(Canny_img,np.array([region_of_interest_vertices],np.int32))
Roi_image= roi_image
lines=cv2.HoughLinesP(roi_image,rho=2,theta=(np.pi/180),threshold=100,lines=np.array([]),minLineLength=100,maxLineGap=100)
Expand All @@ -59,17 +52,6 @@ def process(image):
return image_with_lines
else:
return image
#titles = ['gray_image','Canny_image','Roi image','Image_withline']

#images = [Gray_Image,canny_Image,Roi_image,image_with_lines]
#for i in range (4):
# plt.subplot(2,3,i+1), plt.imshow(images[i], 'gray')
# plt.title(titles[i])
# plt.xticks([]),plt.yticks([])
#plt.show()

#plt.imshow(image_with_lines)
#plt.show()


cascade_src= 'cars.xml'
Expand All @@ -81,17 +63,9 @@ def process(image):
ret, frame = cap.read()
if ret == True:
frame=process(frame)
# gray=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
cars=car_cascade.detectMultiScale(frame,1.1,8)
for(x,y,w,h) in cars:
cv2.rectangle(frame,(x,y),(x+w,y+h),(0,255,0),4)
font = cv2.FONT_HERSHEY_SIMPLEX
# cv2.putText(frame,(x+w,y+h),(140,250), font, .5,(255,255,255),2,cv2.LINE_AA)
out.write(frame)

cv2.imshow('Frame', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.imshow('Frame', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break

Expand All @@ -101,20 +75,3 @@ def process(image):
cv2.destroyAllWindows()


# cap=cv2.VideoCapture('solidYellowLeft.mp4')
# while(cap.isOpened()):
# ret, frame = cap.read()
# if ret == True:
# frame=process(frame)
# cv2.imshow('Frame', frame)
# if cv2.waitKey(1) & 0xFF == ord('q'):
# break
# else:
# break

# cap.release()
# cv2.destroyAllWindows()
# image=cv2.imread('Dataset by video recorder/Daytime/beltway/1535.jpg')
# image=process(image)
# plt.imshow(image)
# plt.show()

0 comments on commit 02dc87a

Please sign in to comment.