[SciPy-user] Measuring local image contrast

Martin Spacek scipy at mspacek.mm.st
Mon Apr 21 23:59:56 EDT 2008


Given a 2D numpy array of image pixel values, I'd like to get an output array whose entries describe the local contrast around each of the pixels in the input. I'm not sure exactly how this is typically done in the image processing field, but I'm guessing one way would be to take the difference between the center pixel and the mean of the surrounding 8 pixels. Is there a standard way to do this in numpy/scipy? Maybe describe the operation in a kernel somehow, and then convolve it with the image? I've looked at scipy.ndimage, but nothing pops out for me. Same goes for PIL's ImageFilter. My problem is probably lack of familiarity with the nomenclature.

Cheers,

Martin



More information about the SciPy-User mailing list