Hi Gin and Arnaud,

Sorry for the late reply.

As Arnaud said in his previous message, images are handled with 
n-dimensional row vectors.

So you can use the 'mlt' or 'dv' operators to perform multiplications 
(divisions) between vectors and scalars; the correct expression is simply:

1) *im1 mlt d2 dv cose*   or   * im1 mlt (d2/cose)*
Here, im1 is similar to {pix_from_band1, pix_from_band2, pix_from_band3}. I 
think that the second expression is faster.

2) the expression *im1 mlt {d2} dv {cose}* is also correct, as I designed 
those operators to process 1d vectors as scalars (both for convenience and 
to make the operators more robust)

3) finally, a solution close to the one of Arnaud is *im1 mult {d2,d2,d2} 
div {cose,cose,cose}*
Here, the operators mult and div perform element-wise multiplications 
(divisions) between vectors. But *im1 * {d2,d2,d2} / {cose,cose,cose}* is 
not correct ! (the multiplication or the division of two row vectors aren't 
defined, you must use mlt/dv or mult/div operators).

Don't forget to define the constants 'd2' and 'cose' with the method 
SetConstant if you use the filter, or just provide a txt file to the field 
'import context' if you use the application. You can also define 'my_e', 
and use cos(my_e) within the above expressions (*but don't define 'e', 
because this constant already exists in muparserx!*), nevertheless it is 
better to evaluate cose once and for all.

Finally, looking at your expression, you really should consider the 
OpticalCalibration application, which will do the job faster than BandMathX 
:-)

Christophe.




Le jeudi 23 avril 2015 14:47:15 UTC+2, Arnaud Durand a écrit :
>
> Gin,
>
> Each pixel of your image is handled as a n-dimensional row vector, with n 
> the number of bands in your image. {n1, n2, n3, ...} is the syntax of 
> muParserX to declare row vectors that you can fill with scalars assigned by 
> band.
>
> Hope it helps.
> Arnaud
>
> Le jeudi 23 avril 2015 14:10:28 UTC+2, GiNN a écrit :
>>
>> Thank Arnaud,
>>
>> And yes, d and e are scalars. In fact, they are constant for the entire 
>> image, while the image has three bands. 
>>
>> If I understand you correctly, this still counts as a vector 
>> transformation?
>> On Apr 23, 2015 7:50 AM, "Arnaud Durand" <[email protected]> 
>> wrote:
>>
>>> Hi GiNN,
>>>
>>> I'm not sure that it is possible with such a simple expression, as the 
>>> doc said : 
>>>
>>>
>>>
>>> *For instance, it is not possible to add vectors of different dimensions 
>>> (this implies the addition of a row vector with a column vector),or add a 
>>> scalar to a vector or a matrix, or divide two vectors, and so on...Thus, it 
>>> is important to remember that a pixel of n components is always represented 
>>> as a row vector.*
>>>
>>> However, if you know the number of bands in your image, and if d and e 
>>> are scalars, you might try to use vector syntax in your expression like 
>>> that : im1*{d^2,d^2,d^2,d^2}/{cos e, cos e, cos e, cos e}
>>>
>>> Arnaud
>>>
>>> Le mercredi 22 avril 2015 21:02:15 UTC+2, GiNN a écrit :
>>>>
>>>>
>>>> I have three-band images and I want to apply the same expression to 
>>>> each band and get a three-bad output.
>>>> I am just starting with OTB and Monteverdi. Used installer on a 64 bit 
>>>> W7 machine.
>>>>
>>>> The expression is very simple:  output_pixel = (input_pixel*d^2)/cos e
>>>>
>>>> I read the cookbook recipe, and concluded BandmahX is what I need. But 
>>>> I am not sure how to formulate the expression so that the application goes 
>>>> through all pixels in all three bands.
>>>>
>>>> Any assistance is greatly appreciated.
>>>>
>>>> Gin
>>>>
>>>  -- 
>>> -- 
>>> Check the OTB FAQ at
>>> http://www.orfeo-toolbox.org/FAQ.html
>>>  
>>> You received this message because you are subscribed to the Google
>>> Groups "otb-users" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/otb-users?hl=en
>>> --- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "otb-users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/otb-users/UHugkLOJEmw/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
-- 
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to