X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 07 Sep 2015 09:00 AM by  anon
band math conditional
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
07 Sep 2015 09:00 AM
    I need to use the conditional statements in band math and I don´t know how. I have a follow-on question that I hope someone can address. My images have values from 0 to 1. I need to apply a lineal equation (B1 * 1.515 - 0.33) if the value is greater than 0.2179 and less than 0.8449. If the value is less than 0.2179, it has to take the value 0, and if the value is greater than 0.8449, it has to take the value 0.95. Any suggestions would be greatly appreciated. Thanks a lot. Pablo

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    08 Sep 2015 01:59 PM
    I don't think you can do it in a single statement but its easy to do in 2. The first creates a mask of pixels greater than 0.2179 and less than 0.8449. Pixels with values that meet this threshold are assigned a 1 in the mask and all others are set to 0. Then multiply by the original data: (b1 gt 0.2179 and b1 lt 0.8449) * (b1 * 1.515 - 0.33) This one finds the pixels greater than 0.8449 in the original image and multiplies them by 0.95 (all other pixels are 0 in the mask) and then add it to the result from above: ((b1 gt 0.8449)*0.95) + b2 There are probably other ways to do this but you get the idea of how you can apply a conditional statement.
    You are not authorized to post a reply.