Program: 150652
Project: 150652
Buggy source:
/** 
 * Examines the input image to detect fiducials inside of it
 * @param gray Undistorted input image
 */
public void process(T gray){
  configureContourDetector(gray);
  binary.reshape(gray.width,gray.height);
  inputToBinary.process(gray,binary);
  squareDetector.process(gray,binary);
  squareDetector.refineAll();
  squareDetector.getPolygons(candidates);
  found.reset();
  if (verbose)   System.out.println("String_Node_Str" + candidates.size());
  for (int i=0; i < candidates.size(); i++) {
    Polygon2D_F64 p=candidates.get(i);
    if (!checkSideSize(p)) {
      if (verbose)       System.out.println("String_Node_Str");
      continue;
    }
    double best=Double.MAX_VALUE;
    for (int j=0; j < 4; j++) {
      double found=p.get(0).normSq();
      if (found < best) {
        best=found;
        interpolationHack.set(p);
      }
      UtilPolygons2D_F64.shiftDown(p);
    }
    UtilPolygons2D_F64.convert(interpolationHack,q);
    pairsRemovePerspective.get(0).set(0,0,q.a.x,q.a.y);
    pairsRemovePerspective.get(1).set(square.width,0,q.b.x,q.b.y);
    pairsRemovePerspective.get(2).set(square.width,square.height,q.c.x,q.c.y);
    pairsRemovePerspective.get(3).set(0,square.height,q.d.x,q.d.y);
    if (!computeHomography.process(pairsRemovePerspective,H)) {
      if (verbose)       System.out.println("String_Node_Str");
      continue;
    }
    if (!refineHomography.fitModel(pairsRemovePerspective,H,H_refined)) {
      if (verbose)       System.out.println("String_Node_Str");
      continue;
    }
    ConvertDMatrixStruct.convert(H_refined,H_fixed);
    ConvertFloatType.convert(H_fixed,transformHomography.getModel());
    removePerspective.apply(gray,square);
    DetectPolygonFromContour.Info info=squareDetector.getPolygonInfo().get(i);
    if (minimumBorderBlackFraction > 0) {
      double pixelThreshold=(info.edgeInside + info.edgeOutside) / 2;
      double foundFraction=computeFractionBoundary((float)pixelThreshold);
      if (foundFraction < minimumBorderBlackFraction) {
        if (verbose)         System.out.println("String_Node_Str" + foundFraction);
        continue;
      }
    }
    if (processSquare(square,result,info.edgeInside,info.edgeOutside)) {
      prepareForOutput(q,result);
      if (verbose)       System.out.println("String_Node_Str");
    }
 else {
      if (verbose)       System.out.println("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Examines the input image to detect fiducials inside of it
 * @param gray Undistorted input image
 */
public void process(T gray){
  configureContourDetector(gray);
  binary.reshape(gray.width,gray.height);
  inputToBinary.process(gray,binary);
  squareDetector.process(gray,binary);
  squareDetector.refineAll();
  squareDetector.getPolygons(candidates,candidatesInfo);
  found.reset();
  if (verbose)   System.out.println("String_Node_Str" + candidates.size());
  for (int i=0; i < candidates.size(); i++) {
    Polygon2D_F64 p=candidates.get(i);
    if (!checkSideSize(p)) {
      if (verbose)       System.out.println("String_Node_Str");
      continue;
    }
    double best=Double.MAX_VALUE;
    for (int j=0; j < 4; j++) {
      double found=p.get(0).normSq();
      if (found < best) {
        best=found;
        interpolationHack.set(p);
      }
      UtilPolygons2D_F64.shiftDown(p);
    }
    UtilPolygons2D_F64.convert(interpolationHack,q);
    pairsRemovePerspective.get(0).set(0,0,q.a.x,q.a.y);
    pairsRemovePerspective.get(1).set(square.width,0,q.b.x,q.b.y);
    pairsRemovePerspective.get(2).set(square.width,square.height,q.c.x,q.c.y);
    pairsRemovePerspective.get(3).set(0,square.height,q.d.x,q.d.y);
    if (!computeHomography.process(pairsRemovePerspective,H)) {
      if (verbose)       System.out.println("String_Node_Str");
      continue;
    }
    if (!refineHomography.fitModel(pairsRemovePerspective,H,H_refined)) {
      if (verbose)       System.out.println("String_Node_Str");
      continue;
    }
    ConvertDMatrixStruct.convert(H_refined,H_fixed);
    ConvertFloatType.convert(H_fixed,transformHomography.getModel());
    removePerspective.apply(gray,square);
    DetectPolygonFromContour.Info info=candidatesInfo.get(i);
    if (minimumBorderBlackFraction > 0) {
      double pixelThreshold=(info.edgeInside + info.edgeOutside) / 2;
      double foundFraction=computeFractionBoundary((float)pixelThreshold);
      if (foundFraction < minimumBorderBlackFraction) {
        if (verbose)         System.out.println("String_Node_Str" + foundFraction);
        continue;
      }
    }
    if (processSquare(square,result,info.edgeInside,info.edgeOutside)) {
      prepareForOutput(q,result);
      if (verbose)       System.out.println("String_Node_Str");
    }
 else {
      if (verbose)       System.out.println("String_Node_Str");
    }
  }
}