Skip to content

Instantly share code, notes, and snippets.

@wonrobot
Created October 21, 2018 15:58
Show Gist options
  • Save wonrobot/cbed5985155fbc0776facdab89138ee2 to your computer and use it in GitHub Desktop.
Save wonrobot/cbed5985155fbc0776facdab89138ee2 to your computer and use it in GitHub Desktop.
Deep Space Musical
import numpy as np
import cv2
import skimage.measure
import matplotlib.pyplot as plt
import winsound
im = cv2.imread(r'C:\Users\vikas\OneDrive\Desktop\Back ground\pillars.jpg', 0) # Can be many different formats.
x = skimage.measure.block_reduce(im, (3,3), np.max)
x = skimage.measure.block_reduce(x, (3,3), np.mean)
x = skimage.measure.block_reduce(x, (4,4), np.mean)
im = skimage.measure.block_reduce(x, (3,3), np.mean)
notes = np.ndarray.flatten(im)
notes = notes*20
for note in notes:
winsound.Beep(int(note), 500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment