Page 1 of 1
Morphology prune
Posted: 2010-04-03T04:15:12-07:00
by snibgo
(IM version 6.6.0-8 Q16 on Windows 7.)
The documentation talks about a "prune" kernel, but it doesn't work:
convert in.png -channel alpha -morphology erode:3 prune -background blue -flatten out.jpg
convert: UnrecognizedKernelType `prune' @ error/convert.c/ConvertImageCommand/1968.
Can I prune lines with one or more user-defined convolution kernels?
Re: Morphology prune
Posted: 2010-04-03T07:43:30-07:00
by fmw42
I have not played much with the IM morhphology function. But what exactly do you mean by prune? see
viewtopic.php?f=1&t=15692&p=56385&hilit ... ine#p55890 for removing 1 pixel wide vertical or horizontal lines
Re: Morphology prune
Posted: 2010-04-03T08:12:54-07:00
by snibgo
The morphology usage page
http://www.imagemagick.org/Usage/morphology/ under "Morphology Introduction" shows 6 kernels, including "prune". The text says:
Also note how the second last kernel [prune] not only has a 'on' value but also an 'off' value as as part of its 'shape'. Both values are important to the Hit-n-Miss method (see below), while this specific kernel is one of a number used for 'pruning' the ends of lines within images.
I'm interested in using it to progressively shrink the length of lines, creating a sequence that I would reverse in a movie so the lines would grow.
Re: Morphology prune
Posted: 2010-04-03T10:29:03-07:00
by fmw42
out of curiosity could you post a link to one of the images you want to prune.
Re: Morphology prune
Posted: 2010-04-03T14:16:51-07:00
by snibgo
This is part of (ie a crop from) a frame of a video. It is mostly transparent, and shows a number of black lines adjacent to white lines. Morphology, applied to the alpha channel, can erode the black/white lines.
Re: Morphology prune
Posted: 2010-04-03T14:43:20-07:00
by fmw42
are you trying to make the lines shorter or thinner? if the latter then why not just use erode?
Re: Morphology prune
Posted: 2010-04-03T15:41:18-07:00
by snibgo
Yes, erode works fine to make them thinner. I want to make them shorter.
Re: Morphology prune
Posted: 2010-04-03T16:15:22-07:00
by fmw42
OK, thank. I guess we need to wait to here from Anthony.
Re: Morphology prune
Posted: 2010-04-05T22:05:41-07:00
by anthony
Prune is not yet implemented, and is waiting for me to have time to implement the very complex method it is based on Hit-n-Miss. Other operators that also need Hit-n-Miss is Thicken and Thinning.
The method itself is not complex, but to allow it to be used by later operators it needs to be able to handle not just one kernel but a list of kernels (usually two or more kernels with rotations). This in tern makes the method not so straight forward to handle, though some 'hooks' have been planned for.
In other words it is just just a simple patch but needs more programming effort, and thus needs a block of time to program. Especially if you don't want to 'break' the existing operators in the process.
I have similar 'time' problems for the implementation of grid and mesh, distortions which also require a similar level of additional complexity to be added.