Hit-and-miss transform

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
aquila

Hit-and-miss transform

Post by aquila »

Hi

I was wondering if it is possible to do a hit-and-miss transform with a custom kernel in ImageMagick.
http://homepages.inf.ed.ac.uk/rbf/HIPR2/hitmiss.htm

I looked at the convolve operation, but I am not sure that cut's it, since I cannot specify
"don't care" fields in the kernel.

Any suggestions?

Best regards,
Christian
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Hit-and-miss transform

Post by anthony »

Convolution just adds up the weighted elements. As such anything '0' is basically don't care.

However the algorithms the hit'n'miss arrays are looking for are not weighted averages but equality tests. That is defined elements must match the given color value.

I am not certian what this is known as but it isn't standard convolution. I believe however that some of the more generalized 'Automata' program may work better as this does do handling of image patterns such as this. (Google for it)

Just one final point IM does not save images in memory as a binary bitmap. All color values are numbers from 0 to 2^Q-1 where Q is the 'Q' or quality level that was compiled into IM.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
aquila

Re: Hit-and-miss transform

Post by aquila »

Thanks for the reply..

I guess I'll have to do this with something else than IM.

It shouldn't be to hard implement.

Best regards,
Christian
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Hit-and-miss transform

Post by anthony »

No it shouldn't but the convolution area has not been looked into beyond implementing the basic routines. It probably won't be looked at for some time either.
I myself already have far to much to look at. IM really could use some more people trying to improve the core functions.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply