[gdal-dev] nearblack troubles [SEC=UNCLASSIFIED]

Pinner, Luke Luke.Pinner at environment.gov.au
Wed Apr 27 19:19:28 EDT 2011


Worked for me using the following:

#Change black to white
gdalbuildvrt -srcnodata 0 -vrtnodata 255 to-be-decollared.vrt
to-be-decollared.tif 
#Run nearblack -white 
nearblack -white -o decollared.tif to-be-decollared.vrt

Luke

-----Original Message-----
From: gdal-dev-bounces at lists.osgeo.org
[mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Matt Wilkie
Sent: Thursday, 28 April 2011 1:57 AM
To: gdal-dev
Subject: [gdal-dev] nearblack troubles

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/g
dalsetnull.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/
--------------------------------------------

_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

If you have received this transmission in error please notify us immediately by return e-mail and delete all copies. If this e-mail or any attachments have been sent to you in error, that error does not constitute waiver of any confidentiality, privilege or copyright in respect of information in the e-mail or attachments.

Please consider the environment before printing this email.


More information about the gdal-dev mailing list