[gdal-dev] Automatically creating an Alpha mask for a RGB raster to extract the backgound? (magic wand style)

Idan Miara idan at miara.com
Tue Jan 29 05:49:40 PST 2019


Hi Even,

Thanks! it does solve most of the problem!

The only issue that I think is left is that nearblack scans from the
borders till it reaches a valid data point and stops there.
So in case of diagonal zigzag cutting (or background in holes) there will
be still background left inside the zigzags or holes.

A solution could be to add a parameter for a different scanning mode,
instead of 4 scans from the borders till the first data point, do one or
two scans (horizontal/vertical) and in each scan cover the whole
scanline/row so we won't miss background trapped inside holes.

What do you think?

Kind regards,
Idan

On Tue, 29 Jan 2019 at 14:48, Even Rouault <even.rouault at spatialys.com>
wrote:

> > I'm looking for an automated/semi-automated way to remove the plain color
> > background of some (jpeg compressed) Orthophoto RGB rasters without
> > NoDataValue or an Alpha band.
>
> https://www.gdal.org/nearblack.html ?
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20190129/6f7afa44/attachment-0001.html>


More information about the gdal-dev mailing list