[GRASS-user] How to merge rasters using feathering/blending ?

I need to patch rasters containing NULL areas with alternative rasters. I can
do this with r.patch but due to different quality/resolution of the rasters
this produces prominent seamlines. Is there a way to feather/blend between
merged rasters using Grass GIS?

Thanks,

Kaipi
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/How-to-merge-rasters-using-feathering-blending-tp6061489p6061489.html
Sent from the Grass - Users mailing list archive at Nabble.com.

I guess you can do it with a combination of the existing tools:
You can create a buffer zone between your 2 dataset where they merge and
set the buffer to null values. Then using r.fillnulls
(http://grass.osgeo.org/gdp/html_grass64/r.fillnulls.html) and you can
fill the gap using both datasets.

Hope that helps.
Cheers
Sab

On Thu, 2011-02-24 at 10:53 -0800, kaipi wrote:

I need to patch rasters containing NULL areas with alternative rasters. I can
do this with r.patch but due to different quality/resolution of the rasters
this produces prominent seamlines. Is there a way to feather/blend between
merged rasters using Grass GIS?

Thanks,

Kaipi

kaipi wrote:

I need to patch rasters containing NULL areas with
alternative rasters. I can
do this with r.patch but due to different
quality/resolution of the rasters
this produces prominent seamlines. Is there a way to
feather/blend between
merged rasters using Grass GIS?

for blending try:

g.region rast=map1,map2
r.series in=map1,map2 out=both_maps method=average

where there are two values it will take the average
where there is just one value it will use that
where there are NULLs or outside-of-map you'll get a NULL.

Hamish

You can create a buffer zone between your 2 dataset where they merge and
set the buffer to null values. Then using r.fillnulls

Thanks. This works fine for elevation data but not for satellite imagery.

g.region rast=map1,map2
r.series in=map1,map2 out=both_maps method=average

Thanks. But this is not really a smooth blending/fading/feathering ? Any
alternatives ?

Kaipi

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/How-to-merge-rasters-using-feathering-blending-tp6061489p6073011.html
Sent from the Grass - Users mailing list archive at Nabble.com.

If you are working with Images, maybe try to use GIMP. It has stitching
and smoothing/blending options. I use them quite often for my photos.

Regards
Sab

On Mon, 2011-02-28 at 04:05 -0800, kaipi wrote:

> You can create a buffer zone between your 2 dataset where they merge and
> set the buffer to null values. Then using r.fillnulls
>

Thanks. This works fine for elevation data but not for satellite imagery.

> g.region rast=map1,map2
> r.series in=map1,map2 out=both_maps method=average
>

Thanks. But this is not really a smooth blending/fading/feathering ? Any
alternatives ?

Kaipi

Gimp is fine if you have a smal number of scenes but I need to process large
amounts of scenes where I need an automated way to feather the seam lines.

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/How-to-merge-rasters-using-feathering-blending-tp6061489p6073453.html
Sent from the Grass - Users mailing list archive at Nabble.com.

I haven't tried it yet, but what about this:
http://grass.osgeo.org/wiki/GRASS_AddOns#r.smoothpatch

There are other useful addons, so you might want to browse around that
page.

Bob

Bob Moskovitz
Seismic Hazards Mapping Program
California Geological Survey
801 K Street MS-1231
Sacramento, CA 95814
ph. (916) 323-0043

CONFIDENTIALITY NOTICE: This communication is intended only for the use
of the individual or entity to which it is addressed. This message
contains information from the State of California, California Geological
Survey, which may be privileged, confidential and exempt from disclosure
under applicable law, including the Electronic Communications Privacy
Act. If the reader of this communication is not the intended recipient,
you are hereby notified that any dissemination, distribution, or copying
of this communication is strictly prohibited.

-----Original Message-----
From: grass-user-bounces@lists.osgeo.org [mailto:grass-user-
bounces@lists.osgeo.org] On Behalf Of kaipi
Sent: Monday, February 28, 2011 6:27 AM
To: grass-user@lists.osgeo.org
Subject: [GRASS-user] Re: How to merge rasters using
feathering/blending ?

Gimp is fine if you have a smal number of scenes but I need to process
large
amounts of scenes where I need an automated way to feather the seam
lines.

--
View this message in context: http://osgeo-
org.1803224.n2.nabble.com/How-to-merge-rasters-using-feathering-
blending-tp6061489p6073453.html
Sent from the Grass - Users mailing list archive at Nabble.com.
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

In GRASS, one thing you can try is to normalize your data so the variations from scene to scene are minimized. ie, run a linear regression between overlapping maps and then use the coefficients to normalize one of the data sets. However, it is tedious and doesn’t work well if the two images arn’t well correlated to begin with.

A second option is to switch to OSSIM (another open source project) for the mosaicing task. It has a number of tools for feathering, blending and histogram matching. It’s all fairly automated and straight forward to use.

A third option is enblend. It uses multi-resolution splines to blend images together. From my own experience, it does the best job at blending Ortho’s together, but it’s not geographically aware, which means that you need to do some hacking to develop a workflow that you can use to maintain/re-establish a spatial reference system.

— On Mon, 2/28/11, kaipi mapcollect@gmx.net wrote:


> From: kaipi mapcollect@gmx.net
> Subject: [GRASS-user] Re: How to merge rasters using feathering/blending ?
> To: grass-user@lists.osgeo.org
> Received: Monday, February 28, 2011, 9:27 AM
>
> Gimp is fine if you have a smal number of scenes but I need to process large
> amounts of scenes where I need an automated way to feather the seam lines.
>
> –
> View this message in context: http://osgeo-org.1803224.n2.nabble.com/How-to-merge-rasters-using-feathering-blending-tp6061489p6073453.html
> Sent from the Grass - Users mailing list archive at Nabble.com.
> _______________________________________________
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user

I wrote a script to do something like this at one point, though I can’t find it now. It was intended for terrain, but could be used per band on imagery. It used r.buffer to create a distance gradient and then r.recode to convert this gradient to a percentage. I then used r.mapcalc to merge the 2 rasters based on the percentage.

The script automated the buffer distances and the creation of the recode.txt file, but went something like this:

make a null raster

r.mapcalc “temp_null = if(isnull(source),1,null)”

create a distance gradient from the null raster. The output will have int values 1-7 where 1 equals the input null raster

r.buffer in=temp_null out=temp_buf distances=10,20,30,40,50,60 units=meters

fill nulls in the distance gradient with 0 for recoding

r.mapcalc “temp_buf_fill=if(isnull(temp_buf),0,temp_buf)”

recode to a percentage

r.recode in=temp_buf_fill out=temp_recode rules=recode.txt

where recode.txt would have the range from temp_buf_fill expressed as percentages:
1:1:100:100
2:2:86:86
3:3:71:71
4:4:57:57
5:5:43:43
6:6:29:29
7:7:14:14
0:0:0:0

merge the output

r.mapcalc “merged=if(isnull(source),patch,(patch*(temp_recode/100.0))+(source*(1.0-(temp_recode/100.0))))”

Sorry if that doesn’t work, but hopefully you get the idea.

  • Jamie

On Thu, Feb 24, 2011 at 10:53 AM, kaipi <mapcollect@gmx.net> wrote:

I need to patch rasters containing NULL areas with alternative rasters. I can
do this with r.patch but due to different quality/resolution of the rasters
this produces prominent seamlines. Is there a way to feather/blend between
merged rasters using Grass GIS?

Thanks,

Kaipi

View this message in context: http://osgeo-org.1803224.n2.nabble.com/How-to-merge-rasters-using-feathering-blending-tp6061489p6061489.html
Sent from the Grass - Users mailing list archive at Nabble.com.


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user