NB. This much is working
load 'media/image3'
load 'media/image3/view_m'
filename1=:'filename.png'
image1=:read_image filename1
{image1
view_image image1


Very exciting, but very hard won.  Difficulty is anticipated, but help would
be appreciated.
First, please recommend the book that accelerates newbies best.
I have the book APL\360 and actually used the APL system back in the early
70s.

It is not clear that 'image3' is cross platform like 'platimg'.
If switching to platimg is preferable, please show conversion from RGB plane
to R G B planes.

Then, please help with the following.
Experiments and extensive reading of documentation has been unfruitful.
I expect that the learning curve to do this anaided will consume a month or
two.
In the "teach a man to fish" spirit give chapter and verse instead of actual
code.
I am not a mathematician, but hard work is okay.
I am also okay with actual code.

Here are the actions I would like to take:
1) convert from 0-255 valued triples to 0-1 valued color planes
2) take per pixel normalized weighted mean of color planes ((Cr * R) + (Cg *
G) + (Cb * B)) / (Cr + Cg + Cb)
3) local normalized weighted mean (North + South + East + West + (Cc *
Center)) / ( 4 + Cc )
4) distribute pixel from plane into deep bricks with brick face dimensions
same as an image color plane

Cn is a scalar to be applied to the N plane.

Operation 2 in C++ uses valarray as follows:
valarray<double> mean( ( Cr * Rsource + Cg * Gsource + Cb * Bsource ) / (Cr
+ Cg + Cb) );

Operation 3 in C++ uses valarray and mask_array to mask out edges and
calculate as follows:
target = 0; /// zero the target valarray
target[ North ] += source[ South ];
target[ South ] += source[ North ];
target[ East ] += source[ West ];
target[ West ] += source[ East ];
target /= NeighborCount;
target += Cc * source;
target /= ( 1.0 + Cc );

Operation 4 (like convolution):
Construct an index_array specifying relative offsets of a sub-brick within a
brick.
Construct a same-sized as index_array valarray containing coefficients.
Add raveled pixel offset to index_array.
Add product of coefficient array times pixel value to brick through offset
index_array.
I wouldn't mind being able to use negative offseting.
The brick will be sized to contain the sub-bricks around the image edge.
This way "convolution" will never be out of bounds.

Apologies if the character of this email is outside etiquette.

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

Reply via email to