Here's a colorful script for you to run.  Be sure to also check the data
stream in "term" as well as the images.  The script just flips out the
images like a stack of pancakes and you may move them around on your screen
on a laptop.  Just click to delete the top one to see the one under it on a
phone.

load 'viewmat'

PAL=:6 3$0 0 255 0 255 255 0 255 0 255 255 0 255 0 0 255 0 255
HUES=:>"0:;:'BLUE AQUA GREEN YELLOW RED MAGENTA'
PAL;HUES

RGB=:( #:i.8){0 255
ALL=:>"0:;:'BLACK BLUE GREEN AQUA RED MAGENTA YELLOW WHITE'
RGB;ALL

GRB=:1 0 2{"1 RGB
NEW=:>"0;: 'BLACK BLUE RED  MAGENTA  GREEN AQUA YELLOW WHITE' 
GRB;NEW

ro=: 13 :'<.0.5+y'
we=: 13 :'+/"1[0.3 0.59 0.11*"1 y'
gray=: 13 :'3#"0 ro we y'

]D=: (i:4)%/(|.>:i.4),>:i.4
(gray GRB) viewmat D;'% GRB' 
(gray RGB) viewmat D;'% RGB'
(gray PAL) viewmat D;'% PAL' 
GRB viewmat D;'% GRB'
RGB viewmat D;'% RGB' 
PAL viewmat D;'% PAL'
   
]C=:*/~ i:4
(gray GRB) viewmat C;'* GRB'
(gray RGB) viewmat C;'* RGB'
(gray PAL) viewmat C;'* PAL'
GRB viewmat C;'* GRB'
RGB viewmat C;'* RGB'
PAL viewmat C;'* PAL'
   \
]B=:-/~ i:4
(gray GRB) viewmat B;'- GRB'
(gray RGB) viewmat B;'- RGB'
(gray PAL) viewmat B;'- PAL'
GRB viewmat B;'- GRB'
RGB viewmat B;'- RGB'
PAL viewmat B;'- PAL'
   \
]A=:+/~ i:4
(gray GRB) viewmat A;'+ GRB'
(gray RGB) viewmat A;'+ RGB'
(gray PAL) viewmat A;'+ PAL'
GRB viewmat A;'+ GRB'
RGB viewmat A;'+ RGB'
PAL viewmat A;'+ PAL'

If you view addition, subtraction, times and division tables using the
palette I call  PAL  from viewmat  (the default left argument) or RGB colors
they both convert poorly to grayscale.

However if you simply reverse RGB to GRB  (easy in J) you get better
grayscale images.
 
However, the real advantage comes when you realize the larger the number in
the data are  the brighter the colors in the image..  Smaller numbers tend
toward black.

The colors in the  GRB  maps tell you about the comparative sizes of the
data in the arrays.

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

Reply via email to