Program: 150976
Project: 150976
Buggy source:
/** 
 * Converts the input image into a binary image.
 * @param input Input image.  Not modified.
 * @param output Output binary image.  Modified.
 */
public void process(ImageFloat32 input,ImageUInt8 output){
  inputPow2.reshape(input.width,input.height);
  inputMean.reshape(input.width,input.height);
  inputMeanPow2.reshape(input.width,input.height);
  inputPow2Mean.reshape(input.width,input.height);
  stdev.reshape(input.width,input.height);
  tmp.reshape(input.width,input.height);
  inputPow2.reshape(input.width,input.height);
  BlurImageOps.mean(input,inputMean,radius,tmp);
  PixelMath.pow2(input,inputPow2);
  BlurImageOps.mean(inputPow2,inputPow2Mean,radius,tmp);
  PixelMath.pow2(inputMean,inputMeanPow2);
  PixelMath.subtract(inputPow2Mean,inputMeanPow2,stdev);
  PixelMath.sqrt(stdev,stdev);
  float R=ImageStatistics.max(stdev);
  if (down) {
    for (int y=0; y < input.height; y++) {
      int i=y * stdev.width;
      int indexIn=input.startIndex + y * input.stride;
      int indexOut=output.startIndex + y * output.stride;
      for (int x=0; x < input.width; x++) {
        float threshold=inputMean.data[i] * (1.0f + k * (stdev.data[i] / R - 1.0f));
        output.data[indexOut++]=(byte)(input.data[indexIn++] <= threshold ? 1 : 0);
      }
    }
  }
 else {
    for (int y=0; y < input.height; y++) {
      int i=y * stdev.width;
      int indexIn=input.startIndex + y * input.stride;
      int indexOut=output.startIndex + y * output.stride;
      for (int x=0; x < input.width; x++) {
        float threshold=inputMean.data[i] * (1.0f + k * (stdev.data[i] / R - 1.0f));
        output.data[indexOut++]=(byte)(input.data[indexIn++] >= threshold ? 1 : 0);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Converts the input image into a binary image.
 * @param input Input image.  Not modified.
 * @param output Output binary image.  Modified.
 */
public void process(ImageFloat32 input,ImageUInt8 output){
  inputPow2.reshape(input.width,input.height);
  inputMean.reshape(input.width,input.height);
  inputMeanPow2.reshape(input.width,input.height);
  inputPow2Mean.reshape(input.width,input.height);
  stdev.reshape(input.width,input.height);
  tmp.reshape(input.width,input.height);
  inputPow2.reshape(input.width,input.height);
  BlurImageOps.mean(input,inputMean,radius,tmp);
  PixelMath.pow2(input,inputPow2);
  BlurImageOps.mean(inputPow2,inputPow2Mean,radius,tmp);
  PixelMath.pow2(inputMean,inputMeanPow2);
  PixelMath.subtract(inputPow2Mean,inputMeanPow2,stdev);
  PixelMath.sqrt(stdev,stdev);
  float R=ImageStatistics.max(stdev);
  if (down) {
    for (int y=0; y < input.height; y++) {
      int i=y * stdev.width;
      int indexIn=input.startIndex + y * input.stride;
      int indexOut=output.startIndex + y * output.stride;
      for (int x=0; x < input.width; x++, i++) {
        float threshold=inputMean.data[i] * (1.0f + k * (stdev.data[i] / R - 1.0f));
        output.data[indexOut++]=(byte)(input.data[indexIn++] <= threshold ? 1 : 0);
      }
    }
  }
 else {
    for (int y=0; y < input.height; y++) {
      int i=y * stdev.width;
      int indexIn=input.startIndex + y * input.stride;
      int indexOut=output.startIndex + y * output.stride;
      for (int x=0; x < input.width; x++, i++) {
        float threshold=inputMean.data[i] * (1.0f + k * (stdev.data[i] / R - 1.0f));
        output.data[indexOut++]=(byte)(input.data[indexIn++] >= threshold ? 1 : 0);
      }
    }
  }
}