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

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
galwaylibrary
Posts: 5
Joined: 2012-05-24T02:45:58-07:00
Authentication code: 13

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

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
Post Reply