Yep, black and white, at least this is how the documentation makes me see what morphology (originally) sees as background and foreground.
On the other hand, doesn't IM already have a similar feature? How does the '-despeckle' operator decide what is, and what is not, a speckle? There must be a way ...
Search found 18 matches
- 2016-10-01T17:48:47-07:00
- Forum: Users
- Topic: How to dilate foreground only if it's surrounded by background?
- Replies: 16
- Views: 8027
- 2016-10-01T17:35:43-07:00
- Forum: Users
- Topic: How to dilate foreground only if it's surrounded by background?
- Replies: 16
- Views: 8027
Re: How to dilate foreground only if it's surrounded by background?
You're right. I still don't fully understand how morphology, and especially the kernels, work. But, as you said, if it "looks at all the pixels in a region around each pixel in the image to decide what to do", I wonder if it could, by looking at those same pixels, decide not just what to do but also ...
- 2016-10-01T11:37:55-07:00
- Forum: Users
- Topic: How to dilate foreground only if it's surrounded by background?
- Replies: 16
- Views: 8027
Re: How to dilate foreground only if it's surrounded by background?
Thanks for having checked IM 7 for me. I'm using ImageMagick 6.7.7-10, Linux, (see bottom of message #4 above).
I see your point. Boundary black pixels are affected by a morphology process that is triggered by white pixels covered by a mask that only protects them for writing.
Is it not possible ...
I see your point. Boundary black pixels are affected by a morphology process that is triggered by white pixels covered by a mask that only protects them for writing.
Is it not possible ...
- 2016-10-01T11:18:57-07:00
- Forum: Users
- Topic: How to dilate foreground only if it's surrounded by background?
- Replies: 16
- Views: 8027
Re: How to dilate foreground only if it's surrounded by background?
Okay, you win.
In order to make your code shorter, it's safe to drop and when working with 1-bit, black and white, images, isn't it?

Code: Select all
-fuzz 90%
Code: Select all
-alpha off
- 2016-10-01T08:58:46-07:00
- Forum: Users
- Topic: How to dilate foreground only if it's surrounded by background?
- Replies: 16
- Views: 8027
Re: How to dilate foreground only if it's surrounded by background?
Okay, I think I got it.
The trick perhaps is to use the original image as its own mask!
convert pixel.gif -mask pixel.gif -morphology dilate diamond +mask show:
http://i.imgur.com/HXQfWQ7.gif
But this doesn't work for diamond:2, though. :(
convert pixel.gif -mask pixel.gif -morphology ...
The trick perhaps is to use the original image as its own mask!
convert pixel.gif -mask pixel.gif -morphology dilate diamond +mask show:
http://i.imgur.com/HXQfWQ7.gif
But this doesn't work for diamond:2, though. :(
convert pixel.gif -mask pixel.gif -morphology ...
- 2016-10-01T07:39:02-07:00
- Forum: Users
- Topic: How to dilate foreground only if it's surrounded by background?
- Replies: 16
- Views: 8027
Re: How to dilate foreground only if it's surrounded by background?
Thanks again. Using floodfill and compose works pretty well but it turns out, however, to be a bit expensive for dilating smaller, say, 1 to 3-pixel wide foreground points in images having many such white points.
Could you teach me how to define a morphology kernel that operates on such 1 to 3 ...
Could you teach me how to define a morphology kernel that operates on such 1 to 3 ...
- 2016-09-30T18:57:12-07:00
- Forum: Users
- Topic: How to dilate foreground only if it's surrounded by background?
- Replies: 16
- Views: 8027
- 2016-09-30T14:20:57-07:00
- Forum: Users
- Topic: How to dilate foreground only if it's surrounded by background?
- Replies: 16
- Views: 8027
How to dilate foreground only if it's surrounded by background?
How can I use the morphology operator to (i) enlarge an internal foreground (white) disk without (ii) shrinking the enclosing background (black) circle?
http://i.imgur.com/gVQPZlP.png
With the dilate method I am able to enlarge the internal disk.
convert input.pbm -morphology dilate disk:10 ...
http://i.imgur.com/gVQPZlP.png
With the dilate method I am able to enlarge the internal disk.
convert input.pbm -morphology dilate disk:10 ...
- 2016-01-27T22:45:41-07:00
- Forum: Users
- Topic: How to change the default show: viewer?
- Replies: 7
- Views: 4959
Re: How to change the default show: viewer?
Also, it seems we need to comment out the "miff" XML element as well. If input is a PBM file, then output still goes to IM's display. Don't ask me why. :?
<!--delegate decode="miff" encode="show" spawn="True" command=""/usr/bin/display" -delay 0 -window-group %[group] -title "%l " "ephemeral:%i ...
<!--delegate decode="miff" encode="show" spawn="True" command=""/usr/bin/display" -delay 0 -window-group %[group] -title "%l " "ephemeral:%i ...
- 2016-01-27T22:07:42-07:00
- Forum: Users
- Topic: How to change the default show: viewer?
- Replies: 7
- Views: 4959
Re: How to change the default show: viewer?
Excellent. The method does indeed work. Thanks. :) There is, however, a typo in your code that prevents it from working as it is. We need to insert a slash at the end of the XML element. Otherwise the output will be written to a file named "show:", not delegated to a viewer. It should be as follows ...
- 2016-01-27T21:02:58-07:00
- Forum: Users
- Topic: How to change the default show: viewer?
- Replies: 7
- Views: 4959
Re: How to change the default show: viewer?
Thank you both. :) My /etc/ImageMagick/delegates.xml lacks such a line, though (ImageMagick 6.7.7-10). At any rate, I guess this hack would work only for PNG files but not generally, that is, not for any other format whatever.
I found out that merely replacing the executable /usr/bin/display with ...
I found out that merely replacing the executable /usr/bin/display with ...
- 2016-01-27T18:23:46-07:00
- Forum: Users
- Topic: How to change the default show: viewer?
- Replies: 7
- Views: 4959
How to change the default show: viewer?
How can I use a viewer other than IM's native display when using show: as the output of the command-line tool convert?
For example, suppose that I want to preview in ExactImage's edisplay an image generated by ImageMagick's convert:
$ convert input.png -trim output.png
$ edisplay output.png
Is ...
For example, suppose that I want to preview in ExactImage's edisplay an image generated by ImageMagick's convert:
$ convert input.png -trim output.png
$ edisplay output.png
Is ...
- 2015-11-14T05:39:42-07:00
- Forum: Users
- Topic: How to unwarp a page gutter?
- Replies: 6
- Views: 5048
Re: How to unwarp a page gutter?
I see. But is there any way to apply a pincushion distortion only to the right side of an image, though? Or maybe I could rotate the original so that the current distortion axis (white-gray boundary above) goes to the center of the image, and then apply a pincushion distortion to that, crop the ...
- 2015-11-13T14:10:29-07:00
- Forum: Users
- Topic: How to unwarp a page gutter?
- Replies: 6
- Views: 5048
Re: How to unwarp a page gutter?
Thanks. Is it possible to apply an (inverted) IM's barrel distortion method diagonally? All examples on that page are distorted around a vertical or horizontal axis in the middle of the image.
- 2015-11-13T13:43:05-07:00
- Forum: Users
- Topic: How to unwarp a page gutter?
- Replies: 6
- Views: 5048
Re: How to unwarp a page gutter?
Okay. I'm trying to understand how Fred's pinbarrel works but am clueless as to how to calculate the right radial distortion/correction coefficients.
There is an example on Fred's homepage to make a square into an image which is distorted in a way that looks like my page above. I'd like to build ...
There is an example on Fred's homepage to make a square into an image which is distorted in a way that looks like my page above. I'd like to build ...