Skip to content

Commit

Permalink
Added steering wheel visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
Sully Chen authored and Sully Chen committed Oct 1, 2016
1 parent 21c621b commit 578dd45
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
saver = tf.train.Saver()
saver.restore(sess, "save/model.ckpt")

img = cv2.imread('steering_wheel_image.jpg',0)
rows,cols = img.shape

cap = cv2.VideoCapture(0)
while(cv2.waitKey(10) != ord('q')):
ret, frame = cap.read()
Expand All @@ -16,6 +19,9 @@
call("clear")
print("Predicted steering angle: " + str(degrees) + " degrees")
cv2.imshow('frame', frame)
M = cv2.getRotationMatrix2D((cols/2,rows/2),-degrees,1)
dst = cv2.warpAffine(img,M,(cols,rows))
cv2.imshow("steering wheel", dst)

cap.release()
cv2.destroyAllWindows()
6 changes: 6 additions & 0 deletions run_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@
saver = tf.train.Saver()
saver.restore(sess, "save/model.ckpt")

img = cv2.imread('steering_wheel_image.jpg',0)
rows,cols = img.shape

i = 0
while(cv2.waitKey(10) != ord('q')):
image = scipy.misc.imresize(scipy.misc.imread("driving_dataset/" + str(i) + ".jpg")[-150:], [66, 200]) / 255.0
degrees = model.y.eval(feed_dict={model.x: [image], model.keep_prob: 1.0})[0][0] * 180.0 / scipy.pi
call("clear")
print("Predicted steering angle: " + str(degrees) + " degrees")
cv2.imshow("frame", image)
M = cv2.getRotationMatrix2D((cols/2,rows/2),-degrees,1)
dst = cv2.warpAffine(img,M,(cols,rows))
cv2.imshow("steering wheel", dst)
i += 1

cv2.destroyAllWindows()
Binary file added steering_wheel_image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 578dd45

Please sign in to comment.