Hi,
I am using the following command to make four black pixels white.
mogrify -morphology thicken '6x6+2+2:\
1,1,1,1,1,1,
1,1,1,1,1,1,
1,1,0,0,1,1,
1,1,0,0,1,1,
1,1,1,1,1,1,
1,1,1,1,1,1' page20.png
If I am right, the command will only work on the origin pixel which is the first zero on the third row, reading from left to right. Can I make the command operate on all four pixels in one go?
I have tried using the 'statistic' command but it is not producing the affect I am seeking.
Any help would be much appreciated.
Regards
John
Is it possible to define a kernel within a kernel?
-
- Posts: 5
- Joined: 2012-05-24T02:45:58-07:00
- Authentication code: 13
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Is it possible to define a kernel within a kernel?
Anthony may be able to answer your question. But there may be other ways to do what you want. Can you post a link to your image and explain a bit more about what you are trying to do in that image.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Is it possible to define a kernel within a kernel?
Make the pixels around the pixel undefined...
Remember a thicken kernel is really a Hit-n-Miss Kernel, which simply turns on the pixel that is selected. This kernel will now match
any of the corners of the 2x2 block, unfortunatally it will also match just the center of a 3x3 block.
The alternative if to generate a kernel for each of the four pixels by generating a sequext of rotated the kernels!
http://www.imagemagick.org/Usage/morpho ... ed_kernels -- just add a '>' flag to your original kernel.
Note this will need 4 passes through the image so is 4 times slower!
You can check the kernels using the '"showkernel" define, or the "kernel2image" script
http://www.imagemagick.org/Usage/morphology/#showkernel
Code: Select all
mogrify -morphology thicken '7x7:
1,1,1,1,1,1,1,
1,1,1,1,1,1,1,
1,1,-,-,-,1,1,
1,1,-,0,-,1,1,
1,1,-,-,-,1,1,
1,1,1,1,1,1,1,
1,1,1,1,1,1,1' page20.png
any of the corners of the 2x2 block, unfortunatally it will also match just the center of a 3x3 block.
The alternative if to generate a kernel for each of the four pixels by generating a sequext of rotated the kernels!
http://www.imagemagick.org/Usage/morpho ... ed_kernels -- just add a '>' flag to your original kernel.
Note this will need 4 passes through the image so is 4 times slower!
Code: Select all
mogrify -morphology thicken '6x6+2+2>:
1,1,1,1,1,1,
1,1,1,1,1,1,
1,1,0,0,1,1,
1,1,0,0,1,1,
1,1,1,1,1,1,
1,1,1,1,1,1' page20.png
http://www.imagemagick.org/Usage/morphology/#showkernel
Code: Select all
kernel2image -10.2 -ms -mg -ml '' '6x6+2+2>:
1,1,1,1,1,1,
1,1,1,1,1,1,
1,1,0,0,1,1,
1,1,0,0,1,1,
1,1,1,1,1,1,
1,1,1,1,1,1'
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/