raster layer properties and mask patches

Jonathan Coles jonathan at jpcoles.com
Wed Jan 26 17:44:27 CET 2005


Am Mittwoch, den 26.01.2005, 17:12 +0100 schrieb Bernhard Herzog:
> Jonathan Coles <jonathan at jpcoles.com> writes:
> 
> > gdal specifically requests values for each band for NO_DATA values. when
> > it projects an image, the output is initialized to the NO_DATA values.
> > any part of the output that is not real data will retain the NO_DATA
> > value for a particular band.
> 
> An RGB image has three bands in gdal, one for each color, right?  So if
> the user specifies an RGB color for the transparent pixels it must not
> simply be a color that not used in the image, it must be a color such
> that each of its components must be unique in the corresponding band.
> That is there must be no color which uses e.g. the same red value as the
> special color selected by the user?  If so, the situation is even worse
> than I thought.

not quite. yes, one value is used per band to be NO_DATA. if you looked
at a single band the real parts and the NO_DATA parts may be
indistinguishable. however, the mask is created by the wx code, which
wants the RGB triple, so only pixels which match all three values will
be considered part of the mask. not quite so bad, but as you point out
below, not an optimal solution if all colors are used.

> It would be much better if they didn't have to do that.  Such things
> should just work.  After all this is something which the computer should
> be able to figure out by itself.

agreed. in fact, i think that gdal supports specifying NO_DATA values as
complex numbers. i imagine that the color bands will all be real values,
so it could be possible to distinguish what truly is part of the
original image. ProjectRasterFile could return the image array and also
a mask array.

this will take some time to prepare because the interface that we
currently use for the warping code is the "simple" version, which
doesn't allow for things such as specifying NO_DATA values as complex
numbers. for now, do you think that what i currently have is an
acceptable half way point? at least people are able to overlay images.

> What should happen when the image contains all possible color values?

(see above solution).

> An alpha channel, even if it's just one bit per pixel, is better.

(see above solution).

--jonathan

-- 
=====================================================================
 Jonathan Coles                               http://www.jpcoles.com
 jonathan at jpcoles.com                    GnuPG Key: /gpg_pub_key.asc
=====================================================================




More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)