[gdal-dev] Pixel remap using the warp api question
Even Rouault
even.rouault at mines-paris.org
Sat Feb 9 05:35:54 PST 2013
Le vendredi 08 février 2013 23:35:26, Martin Chapman a écrit :
> I asked the following a couple of weeks ago and never got a reply. Frank,
> can you comment on this please?
>
>
>
> .
>
>
>
> I am trying to remap all "0" value pixels in the source images to the
> value "1" in the output image using gdalwarp like so:
>
>
>
> warpOptions->padfSrcNoDataReal[bandIndex] = 0;
>
> warpOptions->padfSrcNoDataImag[bandIndex] = NULL;
>
> warpOptions->padfDstNoDataReal[bandIndex] = 1;
>
> warpOptions->padfDstNoDataImag[bandIndex] = NULL;
>
>
>
> 1. I am setting INIT_DEST=0.
That might be the issue actually. Try with INIT_DEST=1 or INIT_DEST=NO_DATA
Using the warper to do that is however a bit overkill. You could just
RasterIO(GF_Read, ) each line/block, patch values, and then write back with
RasterIO(GF_Write).
>
> 2. not setting UNIFIED_SRC_NODATA.
>
> 3. the source images have no defined nodata value.
>
> 4. the output image has no defined nodata value.
>
>
>
> with no luck. My question is: Is gdalwarp supposed to do this? When I
> look at the pixel value of the output image the black pixels are still "0"
> and not "1".
>
>
>
> My input and output are both 8-bit 3 band images. I am using gdal 1.9.2.
>
>
>
> Best regards,
>
> Martin
More information about the gdal-dev
mailing list