-
-
Save Karts27/5dbff0e569629f4a767e99076d95e3ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get image as numpy array | |
def load_image(name, path): | |
img_path = os.path.join(path, name) | |
img = cv2.imread(img_path) | |
# img = load_img(img_path, target_size = (256, 256)) | |
return img | |
# Plot numpy array | |
def plot_image(img, name, title): | |
plt.imshow(img) | |
plt.suptitle(title) | |
#plt.title(name) | |
# Plot a grid of examples | |
def plot_grid(img_names, img_root, title ,rows=2, cols=3): | |
fig = plt.figure(figsize=(8,8)) | |
for i,name in enumerate(img_names): | |
#print(os.path.join(img_root, name)) | |
fig.add_subplot(rows,cols,i+1) | |
img = load_image(name, img_root) | |
plt.axis("off") | |
plot_image(img, name, title) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment