Thanks for the clarification Manuel! The workaround seems OK for the time being... I'll keep an eye on the bug tracker though.
Cheers, André On Tuesday, December 6, 2016 at 3:26:23 PM UTC+1, Manuel Grizonnet wrote: > > Hi Andre, > > I think that i understand the issue. The input image is an indexed color > image with a palette associated. > > OTB interpret the color table and read directly this value (you can't > access the pixel value in the image but only the interpreted value) > > Note that there is a bug related to this issue: > > https://bugs.orfeo-toolbox.org/view.php?id=1079 > > Guillaume had proposed a fix (see bug thread) but it is not yet > integrated... > > Easy fix for you: use the interpreted value in your bandmath expression > (im1b1==2 will corresponds to im1b1==255 and im1b2==0 and im1b3==255 and > im1b4==255). It is a bit cumbersome but it should work. > > Hope we'll get soon a patch to handle palette color indexed image properly > in OTB. > > Regards, > > Manu > > > > 2016-12-06 14:36 GMT+01:00 André Stumpf <[email protected] <javascript:>>: > >> ...I forgot to attach the input file. The problem is mainly that, using >> the commands I described, I get a test.tif with all pixels set to nan. >> Maybe it's related to the input file than? By the way I'm running version >> 5.6.1 >> >> On Tuesday, December 6, 2016 at 2:28:01 PM UTC+1, Manuel Grizonnet wrote: >>> >>> Hi André, >>> >>> I don't think that there is something wrong with the syntax. >>> >>> Can you give more info on what is wrong or what does not work in the >>> output of the BandMath compare to what you expect? >>> >>> 2016-12-06 14:15 GMT+01:00 André Stumpf <[email protected]>: >>> >>>> Hi, >>>> >>>> I have the attached raster which is the output of a cloud masking >>>> algorithm and would like to produce a binary mask from it. >>>> I was thinking that I could use the following syntax to set for example >>>> all pixel==2 to 1 and the rest to 0. >>>> >>>> otbcli_BandMath -il >>>> S2A_OPER_MSI_L1C_TL_SGS__20161003T232748_A006704_T60GTU_cloud_mask.img >>>> -out >>>> test.tif uint8 -exp "im1b1==2 ? 1 : 0" >>>> >>>> The output tif however comprises only missing values. >>>> >>>> Ideally I would like to set all pixel which are equal to 2 or 4 or 5 to >>>> 1 and the rest to 0 like this: >>>> otbcli_BandMath -il >>>> S2A_OPER_MSI_L1C_TL_SGS__20161003T232748_A006704_T60GTU_cloud_mask.img >>>> -out >>>> test.tif uint8 -exp "im1b1==2 or im1b1==4 or im1b1==5 ? 1 : 0" >>>> ...which of course doesn't work neither. >>>> >>>> Maybe somebody has an idea what is wrong with the syntax or the input >>>> data? >>>> >>>> Cheers, >>>> André >>>> >>>> -- >>>> -- >>>> 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. >>>> >>> >>> >>> >>> -- >>> Manuel Grizonnet >>> >> -- >> -- >> 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] >> <javascript:> >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> 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] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Manuel Grizonnet > -- -- 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.
