[gdal-dev] RE: Border slivers and JPEG2000 compression
even.rouault at mines-paris.org
Tue Dec 30 15:10:08 EST 2008
As Jukka Rahkonen has already suggested, I think that there's no possibility
of doing what you want, with GDAL or any other tool. It is the nature
of the lossy compression to return something close to 0, but not 0 (or the
other way round), when you decompress the data. You can observe the same
effect with traditionnal JPEG too.
Your current solution is probably the best one. Or use lossless JPEG2000.
Le Tuesday 30 December 2008 20:49:01 Smith, Michael, vous avez écrit :
> I never found a good solution to this - one thing I am doing is taking
> the TIFFs and mosaicking them with their neighbors to fill these slivers
> with data from the adjacent tile, so there are no slivers. That is a
> brute-force and inelegant solution though.
> Any suggestions on how to keep border pixels with value 0 in a TIFF to
> stay 0 in a resulting JP2 (with Kakadu) in GDAL?
> Michael Smith
> State GIS Manager
> Maine Office of GIS
> > _____________________________________________
> > From: Smith, Michael
> > Sent: Monday, December 15, 2008 5:04 PM
> > To: 'gdal-dev at lists.osgeo.org'
> > Subject: Border slivers and JPEG2000 compression
> > 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
More information about the gdal-dev