import tensorflow as tf
import scipy.misc
import model
import cv2
from subprocess import call

sess = tf.InteractiveSession()
saver = tf.train.Saver()
saver.restore(sess, "save/model.ckpt")

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

smoothed_angle = 0

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
    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)
    #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)
    M = cv2.getRotationMatrix2D((cols/2,rows/2),-smoothed_angle,1)
    dst = cv2.warpAffine(img,M,(cols,rows))
    cv2.imshow("steering wheel", dst)
    i += 1

cv2.destroyAllWindows()

@@ -328,16 +328,21 @@
     
+full_
 image = 
 scip
@@ -341,28 +341,8 @@
 e = 
-scipy.misc.imresize(
 scip
@@ -391,17 +391,72 @@
 + %22.jpg%22
-)
+, mode=%22RGB%22)%0A    image = scipy.misc.imresize(full_image
 %5B-150:%5D,
@@ -689,21 +689,59 @@
 frame%22, 
-image
+cv2.cvtColor(full_image, cv2.COLOR_RGB2BGR)
 )%0A    #m

Fix display of dataset image colors and resize