daily pastebin goal
57%
SHARE
TWEET

Untitled

a guest Mar 25th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def decim(img, k):
  2.     y, u, v = img[:, :, 0], img[:, :, 1], img[:, :, 2]
  3.     new_u = np.array([np.array([px for j, px in enumerate(row) if j % 2])
  4.         for i, row in enumerate(u) if i % 2])
  5.     new_v = np.array([np.array([px for j, px in enumerate(row) if j % 2])
  6.         for i, row in enumerate(v) if i % 2])
  7.     print(skimage.measure.shannon_entropy(new_u))
  8.     print(skimage.measure.shannon_entropy(new_v))
  9.     new_u = np.array(np.repeat([np.repeat([px for px in row], 2) for row in new_u], 2, axis=0))
  10.     new_v = np.array(np.repeat([np.repeat([px for px in row], 2) for row in new_v], 2, axis=0))
  11.     new_img = np.dstack((y, new_u, new_v))
  12.     return np.uint8(new_img)
  13. rezh = decim(tigeryuv, 1)
  14. io.imshow(rezh)
  15. #io.imsave('tiger_yuv_dec.jpg', rezh)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top