Skip to content

Commit

Permalink
Added main function
Browse files Browse the repository at this point in the history
  • Loading branch information
Anirudh Chakravarthy committed Nov 22, 2018
1 parent f05d514 commit 6afe4bc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
16 changes: 8 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@

# we run the algorithm on Caltech Pedestrian and Nexet Dataset
# set the corresponding directory of the dataset here
inDirectory = "Datasets/Nexet_1"
outDirectory = inDirectory + "_out"
if not os.path.exists(outDirectory):
os.makedirs(outDirectory)
imageNames = os.listdir(inDirectory + "/")
inDirectory = "Datasets/Caltech_Pedestrian"


# Nexet dataset
if(inDirectory == "Datasets/Nexet_1"):
outDirectory = inDirectory + "_out"
if not os.path.exists(outDirectory):
os.makedirs(outDirectory)
imageNames = os.listdir(inDirectory + "/")
for imageName in imageNames:
if imageName == '.DS_Store':
continue
Expand All @@ -28,7 +29,7 @@
out = process_image(image)
mpimg.imsave(outDirectory + "/" + imageName, out)
# print("Processed " + outDirectory + "/" + imageName)
print("Processing complete.")
print("Processing complete.")


# Caltech Pedestrian dataset
Expand All @@ -47,8 +48,7 @@
'''NOTE: this function expects color images!!
this runs the function process_image over each frame of the video'''
white_clip = clip1.fl_image(process_image)
print("Processing complete.")
# %time white_clip.write_videofile(white_output, audio=False)
white_clip.write_videofile(white_output, audio=False)


''' Helper functions for seq file processing'''
Expand Down
2 changes: 1 addition & 1 deletion utils/functions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
print("Functions")
# print("Functions")

import math
import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion utils/globalvars.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
print("Globals")
# print("Globals")

global avgLeft
global avgRight
Expand Down
6 changes: 0 additions & 6 deletions utils/process_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ def process_image(image):
# Test detected edges by uncommenting this
#return cv2.cvtColor(regionInterestImage, cv2.COLOR_GRAY2RGB)

# draw ROI on the image for visualization
cv2.line(image, (vertices[0][0], vertices[0][1]), (vertices[1][0], vertices[1][1]), [255,255,0], 10)
cv2.line(image, (vertices[1][0], vertices[1][1]), (vertices[2][0], vertices[2][1]), [255,255,0], 10)
cv2.line(image, (vertices[2][0], vertices[2][1]), (vertices[3][0], vertices[3][1]), [255,255,0], 10)
cv2.line(image, (vertices[3][0], vertices[3][1]), (vertices[0][0], vertices[0][1]), [255,255,0], 10)

# draw output on top of original
weightedImage = weighted_img(lineMarkedImage, image)

Expand Down

0 comments on commit 6afe4bc

Please sign in to comment.