Image Processing using python. [How to undo a for loop]

30 views
Skip to first unread message

Biyiha Tobie

unread,
Dec 18, 2017, 10:06:09 AM12/18/17
to spyder
Good morning guys, 

I am working on an image processing project using python.

I had to divide an image(256x256) into 8by8 blocks and I achieved this. But after processing, I have to undo this process. Please, can someone give me a hand?. This is the for loop to divide the image to 8by8 below. Thanks for the help in advanced.

img = np.array(image)
windowsize_r = 8
windowsize_c = 8
l = len(img)
f = np.array([])
for r in range(0, l, windowsize_r):
    for c in range(0, l, windowsize_c):
        windows = img[r:r+windowsize_r,c:c+windowsize_c]
        wd1 = np.zeros((64,1))
        wd1 = windows.ravel()
        wd1 = wd1.reshape(64,1)
        f = np.append(f,wd1)
        
x = f.reshape(1024,64)
Reply all
Reply to author
Forward
0 new messages