Convolving, I'm Stuck

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
vpcompsci
Posts: 1
Joined: 2012-03-14T08:29:06-07:00
Authentication code: 8675308

Convolving, I'm Stuck

Post by vpcompsci »

Hey, so I am trying to make a program that computes recursively using imagemagick. I want to create each pixel using pixels that are to the up-left of the pixel. The computation I am using is SAT(x,y) = SAT(x-1,y) + SAT(x,y-1) + I(x,y) - SAT(x-1,y-1) where I(x,y) is the corresponding pixel to the pixel (x,y) from another picture and SAT is the image being created so SAT(x,y) is the current pixel being created. Essentially I need to use self-referencing to accumulate in a picture.
Thanks, vpcompsci
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Convolving, I'm Stuck

Post by anthony »

At the moment only a few convolve-like (more commonly known as morphology) uses self-reference as a form of recursion. The Distance Method (two self-referal passes, one top-down, then a second bottom up).
http://www.imagemagick.org/Usage/morphology/#distance

I believe the 'FloydSteinberg' dither is also very simular in that it needs to self-reference the resulting (changing) image.

All the other methods of convolution, morphology, or DIY fx operations use a original image to replacement image technqiue so as to specifically avoid self-referal problems when deailing with area reference neighbourhoods.

Hmmm looks like self-referencing convolution (top down, one pass) using a convolution matrix of the form...

Code: Select all

-1  1  0
 1  1  0
 0  0  0 
origin in the center, those a 2x2 matrix could also be used.
Of course this can not 'recurse' normally. Repeating the operation will not produce the same result.

You may need to generate your own special program to do this using one of the API's.
The Distance Morphology Code may be a good example for this.

What exactly is this for?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply