Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Mon Feb 24 22:57:55 2020
- @author: Sajid
- """
- import numpy as np
- import cv2
- import math
- img = cv2.imread('C:/Users/Sajid/Desktop/Lenna_(test_image).jpg',cv2.IMREAD_GRAYSCALE)
- cv2.imshow('input image',img)
- print(img.max())
- print(img.shape)
- out=[]
- for i in range (8):
- out.append(img.copy())
- for k in range(8):
- for i in range(img.shape[0]):
- for j in range(img.shape[1]):
- a = img.item(i,j)
- if (a & (1 << k)):
- #print('slk')
- out[k].itemset((i,j),255)
- else:
- out[k].itemset((i,j),0)
- #print('nonono')
- for i in range(8):
- cv2.imshow('output image %d' %(i),out[i])
- cv2.waitKey(0)
- cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement