Skip to content

Commit

Permalink
Merge pull request #7 from huyouare/image-resize-color-swap
Browse files Browse the repository at this point in the history
Fix display of dataset image colors and resize
  • Loading branch information
SullyChen authored Oct 2, 2016
2 parents 6e16656 + 30d6410 commit 7edf9eb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions run_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@

i = 10000
while(cv2.waitKey(10) != ord('q')):
image = scipy.misc.imresize(scipy.misc.imread("driving_dataset/" + str(i) + ".jpg")[-150:], [66, 200]) / 255.0
full_image = scipy.misc.imread("driving_dataset/" + str(i) + ".jpg", mode="RGB")
image = scipy.misc.imresize(full_image[-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)
cv2.imshow("frame", cv2.cvtColor(full_image, cv2.COLOR_RGB2BGR))
#make smooth angle transitions by turning the steering wheel based on the difference of the current angle
#and the predicted angle
smoothed_angle += 0.2 * pow(abs((degrees - smoothed_angle)), 2.0 / 3.0) * (degrees - smoothed_angle) / abs(degrees - smoothed_angle)
Expand Down

0 comments on commit 7edf9eb

Please sign in to comment.