How do i use a 5x5 window to scan over an image in python?

171 views
Skip to first unread message

Sarder Rahber Sadique

unread,
Mar 11, 2018, 10:30:30ā€ÆPM3/11/18
to Python Challenge

How do I use a 5x5 window to scan over the greyscale image and create a text table with 25x25 array?

Will this be a correct way?


import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.misc import imread, imsave, imresize


img = imread('new_photo.jpg')
plt.imshow(img)

np.shape(img)
newimg = img[:25,:25,:][:,:,0] 
np.shape(newimg)               
plt.imshow(newimg)
plt.show()

nextimg = pd.DataFrame(newtimg)
nextimg.to_csv('newtimg.txt',header=False,index=False)
fimg = pd.read_csv('newimg.txt')
plt.imshow(fimg)

Edward Bujak

unread,
Jul 6, 2018, 11:27:30ā€ÆAM7/6/18
to Python Challenge
What is the variable newtimg inĀ 
nextimg = pd.DataFrame(newtimg)
Reply all
Reply to author
Forward
0 new messages