Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 1
    Please share the details of these calculations with us so that we can understand your problem. See our help center for more guidance on asking good questions. Commented Feb 25, 2014 at 22:44
  • I am after a timeless answer, not a comment which leads to "move that bracket one position to the left". Nevertheless, the format of a successful calculation ((b5-b4)/float(b5+b4)) Commented Feb 25, 2014 at 22:48
  • What do unsuccessful calculation attempts look like? (I am sympathetic with your opinion of the "move that bracket" type of answer. But before you can get "timeless" answers first you need to ask an answerable question and that means providing sufficient information to pinpoint what might be going on. Otherwise all you will get are generic answers from people who have to guess what you are doing.) Commented Feb 25, 2014 at 23:19
  • Thanks @whuber. I am on another computer now, but for the 4th calculation (float((img1-img2)/img2)) springs to mind. I have tried a lot of combinations of where the float is located, plus iterations like (float(img1-img2)/float(img2*1.0)) Commented Feb 26, 2014 at 0:18
  • 1
    I agree that repositioning float in these expressions is unlikely to cure the problem. It seems more likely that you might have a divide-by-zero issue, since all the expressions you offer are divisions and image bands typically do have zero values. Thus you should expect there to be problematic results (such as Inf) anywhere one or more of the denominators is zero (regardless of whether you use integral or floating point arithmetic). You can check this by forming the local minimum of all the bands to see whether it is everywhere zero. Commented Feb 26, 2014 at 14:20