Skip to content

Instantly share code, notes, and snippets.

@quangnhat185
Created April 11, 2020 07:47
Show Gist options
  • Save quangnhat185/6af318ba7bf64bfa21a75732c60dc5e6 to your computer and use it in GitHub Desktop.
Save quangnhat185/6af318ba7bf64bfa21a75732c60dc5e6 to your computer and use it in GitHub Desktop.
def preprocess_image(image_path,resize=False):
img = cv2.imread(image_path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
img = img / 255
if resize:
img = cv2.resize(img, (224,224))
return img
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment