Commit acfa9f08 authored by Bavanraj's avatar Bavanraj Committed by Manoj Kumar

Bavan dev

parent 29bbfcb7
Translating the signs.
\ No newline at end of file
This diff is collapsed.
import cv2
#def to take webcam pics
def myCam():
cam = cv2.VideoCapture(0)
cv2.namedWindow("test")
img_counter = 0
while True:
ret, frame = cam.read()
if not ret:
print("failed to grab frame")
break
cv2.imshow("test", frame)
k = cv2.waitKey(1)
if k % 256 == 27:
# ESC pressed
print("Escape hit, closing...")
break
elif k % 256 == 32:
# SPACE pressed
img_name = "opencv_frame_{}.png".format(img_counter)
cv2.imwrite(img_name, frame)
print("{} written!".format(img_name))
img_counter += 1
cam.release()
cv2.destroyAllWindows()
return
import os
import os
PATH = os.path.dirname(__file__)
print(PATH + '/converted_keras/keras_model.h5')
\ No newline at end of file
......@@ -6,20 +6,23 @@ import numpy as np
np.set_printoptions(suppress=True)
# Load the model
model = tensorflow.keras.models.load_model('C:/Users/user/Documents/GitHub/2020_077/translation/converted_keras (2)/keras_model.h5')
model = tensorflow.keras.models.load_model('C:/Users/user/Documents/GitHub/2020_077/translation/converted_keras/keras_model.h5')
# Create the array of the right shape to feed into the keras model
# The 'length' or number of images you can put into the array is
# determined by the first position in the shape tuple, in this case 1.
data = np.ndarray(shape=(1, 224, 224, 3), dtype=np.float32)
#data = np.ndarray(shape=(1, 480, 640, 3), dtype=np.float32)
# Replace this with the path to your image
image = Image.open('C:/Users/user/Pictures/Camera Roll/test55.jpg')
image = Image.open('C:/Users/user/Documents/GitHub/2020_077/opencv_frame_0.png')
# resize the image to a 224x224 with the same strategy as in TM2:
# resizing the image to be at least 224x224 and then cropping from the center
size = (224, 224)
#size = (640, 480)
image = ImageOps.fit(image, size, Image.ANTIALIAS)
# turn the image into a numpy array
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment