[gdal-dev] Proposal: gdal_muladd.py
Greg Coats
gregcoats at mac.com
Mon Feb 1 10:07:24 EST 2010
I would prefer to obtain in one step the absolute value of the difference between two pixels, in part because I do not see the meaning of a negative pixel value. In my example, I do not see meaning to a signed byte value for a pixel channel being red=-51. Greg
On Feb 1, 2010, at 3:08 AM, Antonio Valentino wrote:
> Hi Greg,
>
> Il giorno Sun, 31 Jan 2010 14:58:19 -0500
> Greg Coats <gregcoats at mac.com> ha scritto:
>
>> Regarding the diff function
>> "diff": computes the difference between 2 raster bands (b1 - b2)
>> Since the result of diff could be a negative number, for example
>> 99-150=-51, I suggest that there be an additional function that
>> provides the absolute value of diff, which would be 51 in this
>> example. Greg
>
> Of course, it would not be a problem to include but my original idea
> was to provide only base functions and use them to get complex
> expressions.
>
> In this case, what you need can be obtained using two stacked virtual
> files:
> - diff (using appropriate band data type and SourceTransferType)
> - mod
>
> Is it a reasonable approach for you?
>
> Even more interesting for common tasks should be to compute
>
> abs((b1-b2)/(b1+b2))
>
>
>> On Jan 31, 2010, at 12:18 PM, Antonio Valentino wrote:
>>
>>> Hi Matt,
>>>
>>> Il giorno Mon, 25 Jan 2010 20:57:58 -0600
>>> Matt Klaric <matt at klaric.com> ha scritto:
>>>
>>>> On Mon, Jan 25, 2010 at 8:38 PM, Frank Warmerdam
>>>> <warmerdam at pobox.com>wrote:
>>>>
>>>>> I don't think the VRT approach supports actually adding
>>>>> different images together, only overlaying and rescaling.
>>>>>
>>>>>
>>>> However, pixel functions could be used in a VRT file to accomplish
>>>> the desired outcome.
>>>>
>>>> --matt
>>>
>>> Indeed, it would require a pixel function for sum and the ScaleRatio
>>> property of ComplexSource.
>>>
>>> I have just submitted a patch
>>>
>>> http://trac.osgeo.org/gdal/ticket/3367
>>>
>>> that provides a set of standard pixel functions, including sum (of 2
>>> or more raster bands).
>>>
>>> Using this set of functions it should be quite easy to write a
>>> python program that performs generic bands arithmetic.
>
>
> best regards
>
> --
> Antonio Valentino
More information about the gdal-dev
mailing list