scipy.signal.convolve2d() clips off part of my image

M

mike kreiner

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

here's what I entered at the intereactive window:
import scipy
img = scipy.imread("c:\\practice.jpg",flatten=True)
img.shape (384, 512)
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 though
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,218
Messages
2,571,123
Members
47,725
Latest member
Rudy

Latest Threads

Top