[gdal-dev] Border slivers and JPEG2000 compression

Matt Wilkie matt.wilkie at gov.yk.ca
Tue Dec 16 13:50:01 EST 2008


Hi Micheal, try the nearblack utility (which is a relatively new 
addition): http://www.gdal.org/nearblack.html

"This utility will scan an image and try to set all pixels that are 
nearly black (or nearly white) around the collar to exactly black (or 
white). This is often used to "fix up" lossy compressed airphotos so 
that color pixels can be treated as transparent when mosaicing."

cheers,

matt wilkie
--------------------------------------------
Geographic Information,
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/
--------------------------------------------


Smith, Michael wrote:
> I have several orthophotos which are TIFFs, and they align with the USGS 
> quadrangle corners, which means they are rotated slightly, leaving small 
> uneven slivers along the edges where pixel value is 0 (the data for 
> these are available from adjacent tiles).  All the pixels inside the 
> 'real' area of the photo are value > 0.
> 
> This is no problem with TIFFs, as the 0 can be turned off in 
> applications such as ArcGIS or serving them out via MapServer WMS.  But 
> when I convert to JPEG2000 (using Kakadu), the edge pixels are 
> interpolated to different values, typically something like 0, 1, 2, or 
> 3.  Thus I can't just filter them out. Also inside the photo, sometimes 
> very dark pixels (which should really be value 2, 3, etc) are converted 
> to value 0.  Thus they show up as 'holes' in applications when pixel 
> value 0 is filtered out.
> 
> What I want to do is simply show a bunch of JP2 tiles, with the border 
> pixels staying as value 0, and no other pixels having value 0.
> 
> I have tried a couple approaches, including
> 
> gdal_translate -a_nodata 0   (the border pixels still have values > 0)
> 
> gdal_rasterize -i -burn 0    (won't write JP2KAK)
> 
> Surely I'm not the first to try this, but I can't find the right steps 
> on the web.  Any suggestions would be appreciated.
> 
> **********
> Michael Smith
> State GIS Manager
> Maine Office of GIS
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list