[gdal-dev] nearblack troubles

Matt Wilkie matt.wilkie at gov.yk.ca
Wed Apr 27 11:57:26 EDT 2011


Hi All,

The geotiff here 
(http://www.maphew.com/Itches/Decollaring_with_nearblack) has two 
collars to be removed. The outermost consists of pure black (0,0,0) 
while the innermost is off-white (ranges from 240 thru 255). I used 
gdalsetnull[1] to change 0,0,0 to nodata, then ran `nearblack -white` on 
the result. I detect no difference in the output image even with a very 
large fuzz factor (-near 50) .

What am I doing wrong?

{{{
d:\>cmd /version
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

d:\>gdalinfo --version
GDAL 1.8.0, released 2011/01/12

d:\>gdalinfo to-be-decollared.tif
...snip....
Band 1 Block=375x7 Type=Byte, ColorInterp=Red
Band 2 Block=375x7 Type=Byte, ColorInterp=Green
Band 3 Block=375x7 Type=Byte, ColorInterp=Blue

d:\>copy to-be-decollared.tif 0-is-nodata.tif

d:\>gdalsetnull 0-is-nodata.tif
Initial nodata for band  1      None
Output nodata for band  1       0.0
Initial nodata for band  2      0.0
Output nodata for band  2       0.0
Initial nodata for band  3      0.0
Output nodata for band  3       0.0

d:\>gdalinfo 0-is-nodata.tif
...snip....
Band 1 Block=375x7 Type=Byte, ColorInterp=Red
    NoData Value=0
Band 2 Block=375x7 Type=Byte, ColorInterp=Green
    NoData Value=0
Band 3 Block=375x7 Type=Byte, ColorInterp=Blue
    NoData Value=0

d:\>nearblack -white -near 50 -o no-collar-white.tif 0-is-nodata.tif

d:\>gdalinfo no-collar-white.tif
...snip...
Band 1 Block=64x64 Type=Byte, ColorInterp=Undefined
    Description = Layer_1
    Metadata:
      LAYER_TYPE=athematic
Band 2 Block=64x64 Type=Byte, ColorInterp=Undefined
    Description = Layer_2
    Metadata:
      LAYER_TYPE=athematic
Band 3 Block=64x64 Type=Byte, ColorInterp=Undefined
    Description = Layer_3
    Metadata:
      LAYER_TYPE=athematic
}}}


[1] 
http://code.google.com/p/maphew/source/browse/trunk/gis/o4w_extras/bin/gdalsetnull.py

thanks in advance for your time and thoughts,

-- 
matt wilkie
--------------------------------------------
Geomatics Analyst
Information Management and Technology
Yukon Department of Environment
10 Burns Road * Whitehorse, Yukon * Y1A 4Y9
867-667-8133 Tel * 867-393-7003 Fax
http://environmentyukon.gov.yk.ca/geomatics/
--------------------------------------------



More information about the gdal-dev mailing list