Mike Kreiner
2005-01-25 21:32:04 UTC
I posted this message earlier to comp.lang.python, but figured this
would be a better place to go.
I'm using the convolve2d(image, mask) function from scipy to blur an
image. The image I'm using is 512 by 384. When I display the image that
convolve2d returns, the the left-most square of pixels (388 by 388)
turn out fine, blurred and everything, however the right side of the
image is all black.
I've uploaded the practice image to: http://tinypic.com/1g3iox
The output image is: http://tinypic.com/1g3iv9
windows and my image editor say the image is 512 by 384. Could this
have something to do with the reason convolve2d() only works right on
the left-most 388 by 388 pixels? Thanks for any help.
-Mike Kreiner
would be a better place to go.
I'm using the convolve2d(image, mask) function from scipy to blur an
image. The image I'm using is 512 by 384. When I display the image that
convolve2d returns, the the left-most square of pixels (388 by 388)
turn out fine, blurred and everything, however the right side of the
image is all black.
I've uploaded the practice image to: http://tinypic.com/1g3iox
The output image is: http://tinypic.com/1g3iv9
import scipy
img = scipy.imread("c:\\practice.jpg",flatten=True)
img.shape
(384, 512)img = scipy.imread("c:\\practice.jpg",flatten=True)
img.shape
mask =
(1.0/115)*scipy.array([[2,4,5,4,2],[4,9,12,9,4],[5,12,15,12,5],[4,9,12,9,4],[2,4,5,4,2]])blurredImg = scipy.signal.convolve2d(img, mask)
scipy.imsave("c:\\blurred.jpg",blurredImg)
Also, I noticed that the shape attribute is (384, 512), even thoughscipy.imsave("c:\\blurred.jpg",blurredImg)
windows and my image editor say the image is 512 by 384. Could this
have something to do with the reason convolve2d() only works right on
the left-most 388 by 388 pixels? Thanks for any help.
-Mike Kreiner