コード例 #1
0
def three_five():
    """
    3.5
    Do the following:
    (a) Purpose a method for extracting the bit planes of an image based on
    converting the value of its pixels to binary.
    (b) Find all the bit planes o the following 4-bit image:
            0  1  8  6
            2  2  1  1
            1  15 14 12
            3  6  9  10
    """
    four_bit_image = np.array([[0, 1, 8, 6], [2, 2, 1, 1], [1, 15, 14, 12],
                               [3, 6, 9, 10]])

    ImageDisplay.display_image(four_bit_image)

    bit_planes = ImageAnalysis.calculate_bit_planes(four_bit_image,
                                                    bits_per_pixel=4)

    ImageDisplay.display_bit_planes(bit_planes * 256)