[GRASSLIST:3604] function to compare rasters visually

Hello,

I was looking for a function which makes it easy to compare two images
visually by dissolving the upper image or only displaying parts of the upper
image and moving the border between upper and lower image across the monitor.
In other programs it is called dissolve or flicker. But I couldn't find
anything related to this by using the GRASS search function.

Thanks for pointing me to the correct word in GRASS. Martin

Hi Martin,

I had a similar problem once and John was kind enough
to send me this script. It links to grass displays
monitors so, whaever you look at in X0, X1 will
follow, like linking the displays geographically in
ERDAS.
Hope it helps, but don't thanks me, thanks John

Cheers
Daniel

--------------------------------------------------
From: "John Gillette" <JGillette@rfmd.com>
To: "Daniel Victoria" <daniel_victoria@yahoo.com>,
"Sandro Klippel" <sandro.klippel@talha-mar.com.br>,
"GRASSLIST" <grasslist@baylor.edu>
  
try this:

Select and then Erase x1 and then display what ever
you want there.
Select x0 and erase and display other info there.

Run this script to either pan or zoom in x0. After
finishing
the pan or zoom x1 will redraw it's contents at the
same region
thereby "following" what ever is done in x0.

The disadvantage is that you can only do 1 pan or zoom
at a time,
i.e. not interactively.

usage:

script_name z <- does zoom instead of pan
script_name

zooming and panning in x0. x0 is selected at exit.

Does this help?

John

------------------
#!/bin/sh

d.mon select=x1
monitor1=`d.save -o`

d.mon select=x0
if [ "$1" = "z" ]
then
   d.zoom
else
   d.pan
fi
region=`g.region -g`

d.mon select=x1
d.erase
g.region $region
eval "$monitor1"

d.mon select=x0

exit 0

--- Martin Wegmann <mailinglist2_wegmann@web.de>
wrote:

Hello,

I was looking for a function which makes it easy to
compare two images
visually by dissolving the upper image or only
displaying parts of the upper
image and moving the border between upper and lower
image across the monitor.
In other programs it is called dissolve or flicker.
But I couldn't find
anything related to this by using the GRASS search
function.

Thanks for pointing me to the correct word in GRASS.
Martin

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Thanks Daniel,

I will try the script, pretty useful. I already know it from ERDAS and think
that this function should be available per default in GRASS. But I was rather
looking for a comparison of two rasters inside the same monitor. I think
there does an equivalent function in ERDAS exist which name I forgot.

Just to make it clear, raster 1 = a; raster 2 = b

either with a moving border which is moved with the mouse across the monitor

a a a a b b a a a b b b
a a a a b b ->a a a b b b
a a a a b b a a a b b b

horizontally or vertically.
Which would be fantastic: A dynamic border which can be changed by moving the
mouse in different directions (from vertical to horizontal to diagonal and
anything in between)

or two raster which dissolve and the strength of dissolving can be changed.

- just raster 1 visible
- raster 1 80 % visible, raster 2 20% visible
- until raster 2 100% visible

cheers Martin

BTW did you or John already post this script as wish to be implemented in
GRASS?

On Monday 07 June 2004 14:19, Daniel Victoria wrote:

Hi Martin,

I had a similar problem once and John was kind enough
to send me this script. It links to grass displays
monitors so, whaever you look at in X0, X1 will
follow, like linking the displays geographically in
ERDAS.
Hope it helps, but don't thanks me, thanks John

Cheers
Daniel

--------------------------------------------------
From: "John Gillette" <JGillette@rfmd.com>
To: "Daniel Victoria" <daniel_victoria@yahoo.com>,
"Sandro Klippel" <sandro.klippel@talha-mar.com.br>,
"GRASSLIST" <grasslist@baylor.edu>

try this:

Select and then Erase x1 and then display what ever
you want there.
Select x0 and erase and display other info there.

Run this script to either pan or zoom in x0. After
finishing
the pan or zoom x1 will redraw it's contents at the
same region
thereby "following" what ever is done in x0.

The disadvantage is that you can only do 1 pan or zoom
at a time,
i.e. not interactively.

usage:

script_name z <- does zoom instead of pan
script_name

zooming and panning in x0. x0 is selected at exit.

Does this help?

John

------------------
#!/bin/sh

d.mon select=x1
monitor1=`d.save -o`

d.mon select=x0
if [ "$1" = "z" ]
then
   d.zoom
else
   d.pan
fi
region=`g.region -g`

d.mon select=x1
d.erase
g.region $region
eval "$monitor1"

d.mon select=x0

exit 0

--- Martin Wegmann <mailinglist2_wegmann@web.de>

wrote:
> Hello,
>
> I was looking for a function which makes it easy to
> compare two images
> visually by dissolving the upper image or only
> displaying parts of the upper
> image and moving the border between upper and lower
> image across the monitor.
> In other programs it is called dissolve or flicker.
> But I couldn't find
> anything related to this by using the GRASS search
> function.
>
> Thanks for pointing me to the correct word in GRASS.
> Martin

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Yeas, ERDAS has this function and is called Swipe...

It would be nice to have this in Grass.

As for posting the script as wish, I never did such
thing, don't know if John did though.

Daniel

--- Martin Wegmann <mailinglist2_wegmann@web.de>
wrote:

Thanks Daniel,

I will try the script, pretty useful. I already know
it from ERDAS and think
that this function should be available per default
in GRASS. But I was rather
looking for a comparison of two rasters inside the
same monitor. I think
there does an equivalent function in ERDAS exist
which name I forgot.

Just to make it clear, raster 1 = a; raster 2 = b

either with a moving border which is moved with the
mouse across the monitor

a a a a b b a a a b b b
a a a a b b ->a a a b b b
a a a a b b a a a b b b

horizontally or vertically.
Which would be fantastic: A dynamic border which can
be changed by moving the
mouse in different directions (from vertical to
horizontal to diagonal and
anything in between)

or two raster which dissolve and the strength of
dissolving can be changed.

- just raster 1 visible
- raster 1 80 % visible, raster 2 20% visible
- until raster 2 100% visible

cheers Martin

BTW did you or John already post this script as wish
to be implemented in
GRASS?

On Monday 07 June 2004 14:19, Daniel Victoria wrote:
> Hi Martin,
>
> I had a similar problem once and John was kind
enough
> to send me this script. It links to grass displays
> monitors so, whaever you look at in X0, X1 will
> follow, like linking the displays geographically
in
> ERDAS.
> Hope it helps, but don't thanks me, thanks John
>
> Cheers
> Daniel
>
> --------------------------------------------------
> From: "John Gillette" <JGillette@rfmd.com>
> To: "Daniel Victoria" <daniel_victoria@yahoo.com>,
> "Sandro Klippel"
<sandro.klippel@talha-mar.com.br>,
> "GRASSLIST" <grasslist@baylor.edu>
>
>
> try this:
>
> Select and then Erase x1 and then display what
ever
> you want there.
> Select x0 and erase and display other info there.
>
> Run this script to either pan or zoom in x0.
After
> finishing
> the pan or zoom x1 will redraw it's contents at
the
> same region
> thereby "following" what ever is done in x0.
>
> The disadvantage is that you can only do 1 pan or
zoom
> at a time,
> i.e. not interactively.
>
> usage:
>
> script_name z <- does zoom instead of pan
> script_name
>
> zooming and panning in x0. x0 is selected at
exit.
>
> Does this help?
>
> John
>
> ------------------
> #!/bin/sh
>
> d.mon select=x1
> monitor1=`d.save -o`
>
> d.mon select=x0
> if [ "$1" = "z" ]
> then
> d.zoom
> else
> d.pan
> fi
> region=`g.region -g`
>
> d.mon select=x1
> d.erase
> g.region $region
> eval "$monitor1"
>
> d.mon select=x0
>
> exit 0
>
> --- Martin Wegmann <mailinglist2_wegmann@web.de>
>
> wrote:
> > Hello,
> >
> > I was looking for a function which makes it easy
to
> > compare two images
> > visually by dissolving the upper image or only
> > displaying parts of the upper
> > image and moving the border between upper and
lower
> > image across the monitor.
> > In other programs it is called dissolve or
flicker.
> > But I couldn't find
> > anything related to this by using the GRASS
search
> > function.
> >
> > Thanks for pointing me to the correct word in
GRASS.
> > Martin
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
protection around
> http://mail.yahoo.com

__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/

Dissolve seems to be what graphics programs like
Photoshop call "transparency" and is usually
implemented using an alpha blending.
It should not be too hard to implement something
like this in a GRASS rast module.
The Open Source program Gimp (www.gimp.org) should have all
the necessary algorithms.
Also, Graphics Gems (Vol. I) has an alpha blending algorithm.
I would like to see something like this in a GRASS module,
but I really think alpha blending should be done by adding the
needed functionality to d.rast. Maybe one could add an integer
1..100 to the '-o' parameter to specifiy the strength of
transparency?
While we are at it: I would love to see antialiasing for
vector maps (d.vect), it makes them so much easier on the eyes.
Are there any capabale graphics programmers who would implement it
(come on - shouldn't be that hard) ?

Benjamin

On Mon, 7 Jun 2004 15:23:39 +0200
Martin Wegmann <mailinglist2_wegmann@web.de> wrote:

Thanks Daniel,

I will try the script, pretty useful. I already know it from ERDAS and think
that this function should be available per default in GRASS. But I was rather
looking for a comparison of two rasters inside the same monitor. I think
there does an equivalent function in ERDAS exist which name I forgot.

Just to make it clear, raster 1 = a; raster 2 = b

either with a moving border which is moved with the mouse across the monitor

a a a a b b a a a b b b
a a a a b b ->a a a b b b
a a a a b b a a a b b b

horizontally or vertically.
Which would be fantastic: A dynamic border which can be changed by moving the
mouse in different directions (from vertical to horizontal to diagonal and
anything in between)

or two raster which dissolve and the strength of dissolving can be changed.

- just raster 1 visible
- raster 1 80 % visible, raster 2 20% visible
- until raster 2 100% visible

cheers Martin

BTW did you or John already post this script as wish to be implemented in
GRASS?

On Monday 07 June 2004 14:19, Daniel Victoria wrote:
> Hi Martin,
>
> I had a similar problem once and John was kind enough
> to send me this script. It links to grass displays
> monitors so, whaever you look at in X0, X1 will
> follow, like linking the displays geographically in
> ERDAS.
> Hope it helps, but don't thanks me, thanks John
>
> Cheers
> Daniel
>
> --------------------------------------------------
> From: "John Gillette" <JGillette@rfmd.com>
> To: "Daniel Victoria" <daniel_victoria@yahoo.com>,
> "Sandro Klippel" <sandro.klippel@talha-mar.com.br>,
> "GRASSLIST" <grasslist@baylor.edu>
>
>
> try this:
>
> Select and then Erase x1 and then display what ever
> you want there.
> Select x0 and erase and display other info there.
>
> Run this script to either pan or zoom in x0. After
> finishing
> the pan or zoom x1 will redraw it's contents at the
> same region
> thereby "following" what ever is done in x0.
>
> The disadvantage is that you can only do 1 pan or zoom
> at a time,
> i.e. not interactively.
>
> usage:
>
> script_name z <- does zoom instead of pan
> script_name
>
> zooming and panning in x0. x0 is selected at exit.
>
> Does this help?
>
> John
>
> ------------------
> #!/bin/sh
>
> d.mon select=x1
> monitor1=`d.save -o`
>
> d.mon select=x0
> if [ "$1" = "z" ]
> then
> d.zoom
> else
> d.pan
> fi
> region=`g.region -g`
>
> d.mon select=x1
> d.erase
> g.region $region
> eval "$monitor1"
>
> d.mon select=x0
>
> exit 0
>
> --- Martin Wegmann <mailinglist2_wegmann@web.de>
>
> wrote:
> > Hello,
> >
> > I was looking for a function which makes it easy to
> > compare two images
> > visually by dissolving the upper image or only
> > displaying parts of the upper
> > image and moving the border between upper and lower
> > image across the monitor.
> > In other programs it is called dissolve or flicker.
> > But I couldn't find
> > anything related to this by using the GRASS search
> > function.
> >
> > Thanks for pointing me to the correct word in GRASS.
> > Martin
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com

Benjamin Ducke wrote:

Dissolve seems to be what graphics programs like
Photoshop call "transparency" and is usually
implemented using an alpha blending.
It should not be too hard to implement something
like this in a GRASS rast module.
The Open Source program Gimp (www.gimp.org) should have all
the necessary algorithms.
Also, Graphics Gems (Vol. I) has an alpha blending algorithm.
I would like to see something like this in a GRASS module,
but I really think alpha blending should be done by adding the
needed functionality to d.rast. Maybe one could add an integer
1..100 to the '-o' parameter to specifiy the strength of
transparency?
While we are at it: I would love to see antialiasing for
vector maps (d.vect), it makes them so much easier on the eyes.
Are there any capabale graphics programmers who would implement it
(come on - shouldn't be that hard) ?

GRASS' display architecture doesn't support translucency, so you can't
blend with what is already on the monitor.

If you want a blend between two maps, you have to rasterise both,
blend the results yourself, then draw the blended result. E.g.

  #!/bin/sh
  # Usage: d.blend.sh <map1> <k1> <map2> <k2>
  map1="$1"
  k1=$2
  map2="$3"
  k2=$4
  r.mapcalc <<EOF
  R = ($k1 * r#$map1 + $k2 * r#$map2) / ($k1 + $k2)
  G = ($k1 * g#$map1 + $k2 * g#$map2) / ($k1 + $k2)
  B = ($k1 * b#$map1 + $k2 * b#$map2) / ($k1 + $k2)
  EOF
  r.colors R color=rules <<EOF
  0 black
  255 white
  EOF
  r.colors G rast=R
  r.colors B rast=R
  r.composite r_map=R g_map=G b_map=B output=blend
  d.rast blend
  g.remove rast=R,G,B,blend

--
Glynn Clements <glynn.clements@virgin.net>

Martin Wegmann wrote:

I will try the script, pretty useful. I already know it from ERDAS and think
that this function should be available per default in GRASS. But I was rather
looking for a comparison of two rasters inside the same monitor. I think
there does an equivalent function in ERDAS exist which name I forgot.

Just to make it clear, raster 1 = a; raster 2 = b

either with a moving border which is moved with the mouse across the monitor

a a a a b b a a a b b b
a a a a b b -> a a a b b b
a a a a b b a a a b b b

horizontally or vertically.
Which would be fantastic: A dynamic border which can be changed by moving the
mouse in different directions (from vertical to horizontal to diagonal and
anything in between)

The main issue is likely to be whether this can be done fast enough
for interactive use. In that regard, the vertical case (i.e. a
horizontal border which can be moved vertically) would be the most
feasible.

or two raster which dissolve and the strength of dissolving can be changed.

- just raster 1 visible
- raster 1 80 % visible, raster 2 20% visible
- until raster 2 100% visible

As I've noted in another post, you would essentially have to perform
the entire process in software then send the result to the driver.
That isn't likely to be fast.

--
Glynn Clements <glynn.clements@virgin.net>

Hello Benjamin,

On Mon, 7 Jun 2004 19:22:25 +0200 Benjamin Ducke
<benducke@compuserve.de> wrote:

Dissolve seems to be what graphics programs like
Photoshop call "transparency" and is usually
implemented using an alpha blending.
It should not be too hard to implement something
like this in a GRASS rast module.
The Open Source program Gimp (www.gimp.org) should have all
the necessary algorithms.
Also, Graphics Gems (Vol. I) has an alpha blending algorithm.
I would like to see something like this in a GRASS module,
but I really think alpha blending should be done by adding the
needed functionality to d.rast. Maybe one could add an integer
1..100 to the '-o' parameter to specifiy the strength of
transparency?

Probably QGIS is a solution for your questions. It supports
alpha-blending and GRASS-rasters and -vectors as well when compiling
with the GRASS-plugin.

Have a look at
  http://sourceforge.net/projects/qgis

A detailed instruction how to set this up is here:
  http://community.qgis.org

hth
  Stephan Holl

--
Stephan Holl

Check headers for GnuPG Key!
http://www.gdf-hannover.de