Also, take a look at Marshall Lochbaum's code:
http://www.jsoftware.com/jwiki/Community/Conference2012/Talks/ImageProcessing

On Tue, 13 Nov 2012, Alex Giannakopoulos wrote:
OK, I'm trying to do some work with matrices that involves transformations
based on local properties of a matrix (neighbouring elements).
This is the sort of thing you may find in image-processing
"edge-detection", etc, or in some cellular automata of the type of Conway's
"Life".

In other words, I want to be able to supply a matrix, and have it so
processed that the result is a new matrix where each new element was
determined by a function which processed the old elements neighbours.

Any direction, relevant help pages, etc, much appreciated.
If anyone would go as far as offering some sample code that would be great,
too!
As a trivial example, suppose I want to calculate the sum of the neighbours
of each element
Say we have a matrix  m0 =. 3 3 $ >:i.9
What I want is the verb "neighbours" whereby
  neighbours m0
11 19 13
23 40 27
17 31 19

Obviously, I am maily interested in how to extract the "neighbours"
submatrix, without resorting to explicit looping, if that is possible.
To make it a bit more interesting, how would I extract the neighbours if
the matrix was a torus or infinite tiling, such that:
  neighb-torus m0
44 43 42
41 40 39
38 37 36

Thanks for any suggestions!
Alex
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to