Actually this is a better test to see how a color image looks when converted
to grayscale.  

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

(PAL;HUES);(RGB;ALL);<GRB;NEW

at2=:    13 :'([:{:"1 *.) j./"1 y'

D=:at2"0 /~ i:300

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

(gray GRB) viewmat D;'gray GRB'

GRB viewmat D;'GRB'

(gray RGB) viewmat D;'gray RGB'

RGB viewmat D;'RGB'

(gray PAL) viewmat D;'gray PAL'

PAL viewmat D;'PAL'



E=:at2"0 /~ i:4
(gray GRB) viewmat E
(gray RGB) viewmat E
(gray PAL) viewmat E
GRB viewmat E;'GRB'
RGB viewmat E;'RGB'
PAL viewmat E


It uss a numerical file from Cliff Reiter.  The grayscale looks like the
face of a clock.  It  shades from light to dark.  Now use your palette to
view  the  at2  file andsee how it looks compared to the grayscale.  I have
been happiest with GRB as a palette.  It arranges the colors of light from
light to dark.  

Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Linda Alvord
Sent: Wednesday, November 12, 2014 11:33 AM
To: [email protected]
Subject: Re: [Jprogramming] greyscale viewmat

Here's the best I've come up with so far to take a numeric image and view it
in GRB color and then determine where smallest to largest numbers are in the
numeric array.

I am just finishing the narrated version in a dodx file which I hope to put
in dropbox soon.  Maybe this will help

Cut, Paste and run in JHS or jqt but they appear and act quite differently:

NB.J TECH Grade 2 Summary Cod

load 'viewmat'
GRB=:1 0 2{"1 (#:i.8){0 255
rpt=: 13 :'(A=:x?x) + / B=:y?y' 
rptable=: 13 :'(A=:x?x) + table B=:y?y' -
eb=: 13 :'y $<'' '''
boxes=: 13 :'([:<eb)"1 >"0 <"1 (>:i.x),"0 / >:i.y'

i.4
>:i.4
i. 21
|.i.21
(i.5) + table i.6
+ table i.4
]A=:11
]B=:i.11
+ table B
]A=:B + / B
]C=:+ / ~ B
C-:A
GRB viewmat C
GRB viewmat C;'Plus'
(10+B) - table B
]D=:(10+B)-/ B
GRB viewmat D;'Minus'    
<. table ~ i.11
>.table ~ i.11
]E=: <. / ~ i.11
GRB viewmat  E;'Lesser Of'        
]F=:>. / ~ i.11
GRB viewmat  F;'Larger Of'         
5?5
rptable=: 13 :'(G=:x?x) + table H=:y?y'     
5 rptable 7
G
H
rpt=: 13 :'(G=:x?x) + / H=:y?y' 
I=:11 rpt 11
G
H
G + / H
GRB viewmat I;'Random Table' 
]I=:11 rpt 11
G
H
G + / H
GRB viewmat I;'Random Table' 


J=:'Anne Bob Carolyn DavE Ed'   NB. Same
$J                               NB. Shape Of
|.J                              NB. Reverse
$|.J
;:J                              NB. Words
$;:J
|.;:J
$|.;:J                          
>;:J                             NB. 0pen

$>;:J
|.>;:J
$|.>;:J
<>;:J                             
$<>;:J
,>;:J
$,>;:J
2#J                               NB. Copy items of list
$2#J
2#;:J                             NB. Copy boxes in list
$2#;:J
2#>;:J                             NB. Copy Items in Columns of Table 
$2#>;:J                             
2#"1 >;:J                          NB. Copy Items in Rows of Table

$2#"1 >;:J                                                             
<'0'
2 6 $<'0'                          NB. Imagine a box of eggs
3 2 6$<'0'                         NB. Imagine 3 boxes in a stack
12#'*|V'
3 12$ 12#'*|V'
< 3 12$ 12#'*|V'
4# < 3 12$ 12#'*|V'
= table ~ i.11
]K=:(i.11) = / i.11
GRB viewmat K;'Equal'    
]L=:(i.11) < / i.11  
GRB viewmat L;'Less Than'
]M=:(i.11) <: / i.11
GRB viewmat M;'Less Or Equal'
]N=:(i.11) ~: / i.11
GRB viewmat N;'Not Equal'
]O=:(i.11) > / i.11
GRB viewmat O;'Larger Than'
]P=:(i.11) >: / i.11
GRB viewmat P;'Larger Or Equal'
]Q=:(i.2) +. / i.2
GRB viewmat Q;'Or'
]R=:(i.2) *. / i.2
GRB viewmat R;'And'
<' '
eb 1 
eb 4
eb 2 4
1 boxes 1
1 boxes 4
2 boxes 4
3 boxes 3
,3 boxes 3
S=:i.10
GRB viewmat S
T=:i.100
GRB viewmat T
U=:i.1000000
GRB viewmat U
V=:10 10$i.100
GRB viewmat V
W=:100 100$i.10000
GRB viewmat W
X=:1000 1000$i.1000000
GRB viewmat X

Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of bill lam
Sent: Wednesday, November 12, 2014 12:06 PM
To: Programming forum
Subject: Re: [Jprogramming] greyscale viewmat

The plot looks like the role of rgb to be:
green   for luminous
blue      for cold / low
red      for hot / high.

Does anyone have spare time to waste and post a similar palette for viewmat?
 On Nov 12, 2014 4:07 AM, "Jan-Pieter Jacobs" <[email protected]>
wrote:

> It's defined as linear interpolation between a list of RGB values.
> I guess I can't send them without violating any license agreements the 
> Uni has, but there's a plot of their values in one of these answers:
>
>
> http://www.mathworks.com/matlabcentral/answers/160332-rgb-values-for-2
> 014b-default-colors
>
> I can imagine it's feasible to construct a similar thing different 
> enough to not be plagiarism :)
>
> 2014-11-11 20:28 GMT+01:00 Brian Schott <[email protected]>:
>
> > Jan-Pieter,
> >
> > Yes, that blog does seem to be exactly relevant.
> > Could you tell how the parula palette is defined?
> >
> > On Tue, Nov 11, 2014 at 1:55 PM, Jan-Pieter Jacobs < 
> > [email protected]> wrote:
> >
> > > This issue is exactly why Mathworks changed the default color map 
> > > in
> > their
> > > 2014b release.
> > > There is an interesting series of blog posts about the motivation 
> > > here
> > [0].
> > >
> > > Maybe a similar default colormap would make sense for viewmat too?
> > >
> > > [0]:
> > >
> > >
> >
> http://blogs.mathworks.com/steve/2014/10/13/a-new-colormap-for-matlab-
> part-1-introduction/
> > >
> > > --
> > (B=)
> > --------------------------------------------------------------------
> > -- For information about J forums see 
> > http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
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