Author: Not specified Language: python
Description: Not specified Timestamp: 2017-09-19 00:33:41 +0000
View raw paste Reply
  1. def bits_plane(image,plane):
  2.         height, width = image.shape
  3.         new_image = image.copy()
  4.         for h in range(0,height):
  5.             for w in range(0,width):
  6.                 bin_number = '{0:08b}'.format(image[h,w])
  7.                 if int(bin_number[7 - plane]) == 1:
  8.                     new_image[h,w] = 255
  9.                 else:
  10.                     new_image[h,w] = 0
  11.         return new_image
View raw paste Reply