Page 1 of 1

making all pixels the same color within a 3X3 square kernel

Posted: 2012-05-28T07:17:13-07:00
by galwaylibrary
Hi,

I have defined a square kernel as 3X3:1,1,1,1,0,1,1,1,1.

As I understand it, this is a grid of three pixels by three pixels. The center is black. All the surrounding pixels are white. How do I make this middle pixel white?

I have also defined a row of pixels thus, 1x5:0,0,1,0,0. As I understand it this is a row of five pixels, and the middle pixel is white. I wish to make all five pixels black.

Any help would be much appreciated.

Regards
John

Re: making all pixels the same color within a 3X3 square ker

Posted: 2012-05-28T10:17:17-07:00
by fmw42
what is the point of making all kernel elements white? That is just a simple average or mean over the kernel size.

You can achieve that using

-statistic mean 3x3

see
http://www.imagemagick.org/script/comma ... #statistic

If these are morphology kernels, then just make all elements 1 (for white)

'3x3:1,1,1,1,1,1,1,1,1' but if you do not normalize, it will be overly bright.

'1x5:0,0,0,0,0' Though this is probably nonsense as it will make the image black.

The kernels elements are listed in one line, but you can also write them as

'3x3: \
1,1,1,
1,0,1,
1,1,1'

Note the quotes.

see
http://www.imagemagick.org/Usage/convolve/


Perhaps if you explained what you are trying to achieve in your processing, we might be able to help further.