Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MEANS = np.array([123.68, 116.779, 103.939]).reshape((1,1,1,3))
- def load_image(filename):
- image = cv2.imread(filename)
- image = cv2.resize(image,(IMAGE_SIZE,IMAGE_SIZE))
- cv2_imshow(image)
- image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
- image = image.reshape((1,)+image.shape)
- image = image - MEANS
- return image
- def save_image(image,filename):
- image = image + MEANS
- image = np.clip(image[0], 0, 255).astype('uint8')
- scipy.misc.imsave(filename, image)
- return image
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement