Display image patches in python -
i'm using sliding window on image , want display patches of image each window "looks at".
i first saved code here: http://www.johnvinyard.com/blog/?p=268 sliding_window.py
, imported code:
from itertools import izip import numpy np import sliding_window sw skimage.viewer import imageviewer skimage import data, io, filter, color, exposure pil import image scipy.misc import toimage io.use_plugin('matplotlib') image1 = color.rgb2gray(io.imread("path_to_my_image\\akaria1.jpg")) window_size = (100,100) windows = sw.sliding_window(image1, window_size) # make image out of these of these sliding window thingies w in windows: wi = image.fromarray(w) io.imshow(wi)
but no images show up. there's no error either. program seems execute without doing anything. i've heard has bug on windows? what's fix? or there alternate way of displaying image patches?
if print out w
in for
loop above, see number of arrays, know there's no issue in sliding window
part. problem whether i'm correctly converting and/or displaying images given arrays.
i've figured out problem. looks didn't need insist on creating image arrays generated sliding window. treating them images way enough.
for w in windows: pl.imshow(w) #no need use image.fromarray() pl.show()
Comments
Post a Comment