Skip to content

Instantly share code, notes, and snippets.

@TuringNPcomplete
Last active December 22, 2021 17:16
Show Gist options
  • Save TuringNPcomplete/0ac945b1c911b6d0c555f92e3514d902 to your computer and use it in GitHub Desktop.
Save TuringNPcomplete/0ac945b1c911b6d0c555f92e3514d902 to your computer and use it in GitHub Desktop.
def one_channel(ims, nrows=1, ncols=None, titles= None, **kwargs):
"Show all images 'ims' as subplots with 'rows' using 'titles'."
if ncols is None: ncols = int(math.ceil(len(ims)/nrows))
if titles is None: titles = [None]*len(ims)
axs = subplots(nrows, ncols, **kwargs)[1].flat
for im,t,ax in zip(ims, titles, axs):
if im.ndim < 3:
show_image(im, ax = ax, title= t, cmap='gray')
else:
show_image(im, ax = ax, title= t)
one_channel([grayscale_avr, grayscale_w, grayscale_lu], suptitle = "Grayscale Images based on:
Average, Weighted Average, and Luminosity methods",
titles = ["Average", "Weighted Average", "Luminosity"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment