Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. MEANS = np.array([123.68, 116.779, 103.939]).reshape((1,1,1,3))
  2. def load_image(filename):
  3.  
  4. image = cv2.imread(filename)
  5. image = cv2.resize(image,(IMAGE_SIZE,IMAGE_SIZE))
  6. cv2_imshow(image)
  7. image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
  8. image = image.reshape((1,)+image.shape)
  9.  
  10. image = image - MEANS
  11. return image
  12.  
  13. def save_image(image,filename):
  14. image = image + MEANS
  15. image = np.clip(image[0], 0, 255).astype('uint8')
  16. scipy.misc.imsave(filename, image)
  17. return image
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement