nus-yam/ex-repair huggingface dataset:
Program: 151007
Project: 151007
Buggy source:
private void setAllowedBounds(KltFeature feature){
  allowedLeft=feature.radius + config.forbiddenBorder;
  allowedTop=feature.radius + config.forbiddenBorder;
  allowedRight=image.width - (feature.radius + config.forbiddenBorder);
  allowedBottom=image.height - (feature.radius + config.forbiddenBorder);
  outsideLeft=-feature.radius + config.forbiddenBorder;
  outsideTop=-feature.radius + config.forbiddenBorder;
  outsideRight=image.width + (feature.radius - config.forbiddenBorder);
  outsideBottom=image.height + (feature.radius - config.forbiddenBorder);
}

Fixed version (ground truth):
/** 
 * Precompute image bounds that the feature is allowed inside of
 */
protected void setAllowedBounds(KltFeature feature){
  widthFeature=feature.radius * 2 + 1;
  lengthFeature=widthFeature * widthFeature;
  allowedLeft=feature.radius;
  allowedTop=feature.radius;
  allowedRight=image.width - feature.radius - 1;
  allowedBottom=image.height - feature.radius - 1;
  outsideLeft=-feature.radius;
  outsideTop=-feature.radius;
  outsideRight=image.width + feature.radius - 1;
  outsideBottom=image.height + feature.radius - 1;
}
Program: 151008
Project: 151008
Buggy source:
/** 
 * Returns true if the features is entirely enclosed inside of the image.
 */
public boolean isFullyInside(float x,float y){
  if (x < allowedLeft || x >= allowedRight)   return false;
  if (y < allowedTop || y >= allowedBottom)   return false;
  return true;
}

Fixed version (ground truth):
/** 
 * Returns true if the features is entirely enclosed inside of the image.
 */
public boolean isFullyInside(float x,float y){
  if (x < allowedLeft || x > allowedRight)   return false;
  if (y < allowedTop || y > allowedBottom)   return false;
  return true;
}
Program: 151009
Project: 151009
Buggy source:
/** 
 * Computes the descriptor for border features.  All it needs to do is save the pixel value, but derivative information is also computed so that it can reject bad features immediately.
 */
private boolean internalSetDescriptionBorder(KltFeature feature){
  int total=0;
  Gxx=Gyy=Gxy=0;
  int i=0;
  for (int y=0; y < widthFeature; y++) {
    float pixelY=feature.y - feature.radius + y;
    for (int x=0; x < widthFeature; x++, i++) {
      float pixelX=feature.x - feature.radius + x;
      float dX, dY, value;
      if (interpPixelDX.isInFastBounds(pixelX,pixelY)) {
        value=interpPixelI.get_fast(pixelX,pixelY);
        dX=interpPixelDX.get_fast(pixelX,pixelY);
        dY=interpPixelDY.get_fast(pixelX,pixelY);
      }
 else       if (image.isInBounds((int)pixelX,(int)pixelY)) {
        value=interpPixelI.get(pixelX,pixelY);
        dX=interpPixelDX.get(pixelX,pixelY);
        dY=interpPixelDY.get(pixelX,pixelY);
      }
 else {
        feature.desc.data[i]=Float.NaN;
        continue;
      }
      total++;
      feature.desc.data[i]=value;
      Gxx+=dX * dX;
      Gyy+=dY * dY;
      Gxy+=dX * dY;
    }
  }
  feature.Gxx=Gxx;
  feature.Gyy=Gyy;
  feature.Gxy=Gxy;
  float det=Gxx * Gyy - Gxy * Gxy;
  return (det >= config.minDeterminant * total);
}

Fixed version (ground truth):
/** 
 * Computes the descriptor for border features.  All it needs to do is save the pixel value, but derivative information is also computed so that it can reject bad features immediately.
 */
private boolean internalSetDescriptionBorder(KltFeature feature){
  int total=0;
  Gxx=Gyy=Gxy=0;
  int i=0;
  for (int y=0; y < widthFeature; y++) {
    float pixelY=feature.y - feature.radius + y;
    for (int x=0; x < widthFeature; x++, i++) {
      float pixelX=feature.x - feature.radius + x;
      float dX, dY, value;
      if (interpPixelI.isInFastBounds(pixelX,pixelY)) {
        value=interpPixelI.get_fast(pixelX,pixelY);
        dX=interpPixelDX.get_fast(pixelX,pixelY);
        dY=interpPixelDY.get_fast(pixelX,pixelY);
      }
 else       if (image.isInBounds((int)pixelX,(int)pixelY)) {
        value=interpPixelI.get(pixelX,pixelY);
        dX=interpPixelDX.get(pixelX,pixelY);
        dY=interpPixelDY.get(pixelX,pixelY);
      }
 else {
        feature.desc.data[i]=Float.NaN;
        continue;
      }
      total++;
      feature.desc.data[i]=value;
      feature.derivX.data[i]=dX;
      feature.derivY.data[i]=dY;
      Gxx+=dX * dX;
      Gyy+=dY * dY;
      Gxy+=dX * dY;
    }
  }
  feature.Gxx=Gxx;
  feature.Gyy=Gyy;
  feature.Gxy=Gxy;
  float det=Gxx * Gyy - Gxy * Gxy;
  return (det >= config.minDeterminant * total);
}
Program: 151011
Project: 151011
Buggy source:
/** 
 * Sets the current image it should be tracking with.
 * @param image  Original input image.
 * @param derivX Image derivative along the x-axis
 * @param derivY Image derivative along the y-axis
 */
public void setImage(InputImage image,DerivativeImage derivX,DerivativeImage derivY){
  if (derivX != null && derivY != null)   InputSanityCheck.checkSameShape(image,derivX,derivY);
  this.image=image;
  interpInput.setImage(image);
  this.derivX=derivX;
  this.derivY=derivY;
  interpPixelI.setImage(image);
  interpPixelDX.setImage(derivX);
  interpPixelDY.setImage(derivY);
}

Fixed version (ground truth):
/** 
 * Sets the current image it should be tracking with.
 * @param image  Original input image.
 * @param derivX Image derivative along the x-axis
 * @param derivY Image derivative along the y-axis
 */
public void setImage(InputImage image,DerivativeImage derivX,DerivativeImage derivY){
  InputSanityCheck.checkSameShape(image,derivX,derivY);
  this.image=image;
  interpInput.setImage(image);
  this.derivX=derivX;
  this.derivY=derivY;
  interpPixelI.setImage(image);
  interpPixelDX.setImage(derivX);
  interpPixelDY.setImage(derivY);
}
Program: 151012
Project: 151012
Buggy source:
/** 
 * Decomposed the provided homography matrix into its R,T/d,N components. Four solutions will be produced and can be accessed with   {@link #getSolutionsN()} and{@link #getSolutionsSE()}.
 * @param H Homography matrix.  Not modified.
 */
public void decompose(DenseMatrix64F H){
  if (svd.inputModified()) {
    H_copy.set(H);
    if (!svd.decompose(H_copy))     throw new RuntimeException("String_Node_Str");
  }
 else {
    if (!svd.decompose(H))     throw new RuntimeException("String_Node_Str");
  }
  DenseMatrix64F V=svd.getV(null,false);
  DenseMatrix64F S=svd.getW(null);
  SingularOps.descendingOrder(null,false,S,V,false);
  double s0=S.get(0,0) * S.get(0,0);
  double s2=S.get(2,2) * S.get(2,2);
  v2.set(V.get(0,1),V.get(1,1),V.get(2,1));
  double a=Math.sqrt(1 - s2);
  double b=Math.sqrt(s0 - 1);
  double div=Math.sqrt(s0 - s2);
  for (int i=0; i < 3; i++) {
    double e1=(a * V.get(i,0) + b * V.get(i,2)) / div;
    double e2=(a * V.get(i,0) - b * V.get(i,2)) / div;
    u1.setIndex(i,e1);
    u2.setIndex(i,e2);
  }
  setU(U1,v2,u1);
  setU(U2,v2,u2);
  setW(W1,H,v2,u1);
  setW(W2,H,v2,u2);
  createSolution(W1,U1,u1,H,solutionsSE.get(0),solutionsN.get(0));
  createSolution(W2,U2,u2,H,solutionsSE.get(1),solutionsN.get(1));
  createMirrorSolution(0,2);
  createMirrorSolution(1,3);
}

Fixed version (ground truth):
/** 
 * Decomposed the provided homography matrix into its R,T/d,N components. Four solutions will be produced and can be accessed with   {@link #getSolutionsN()} and{@link #getSolutionsSE()}.
 * @param H Homography matrix.  Not modified.
 */
public void decompose(DenseMatrix64F H){
  if (!svd.decompose(H))   throw new RuntimeException("String_Node_Str");
  DenseMatrix64F V=svd.getV(null,false);
  DenseMatrix64F S=svd.getW(null);
  SingularOps.descendingOrder(null,false,S,V,false);
  double s0=S.get(0,0) * S.get(0,0);
  double s2=S.get(2,2) * S.get(2,2);
  v2.set(V.get(0,1),V.get(1,1),V.get(2,1));
  double a=Math.sqrt(1 - s2);
  double b=Math.sqrt(s0 - 1);
  double div=Math.sqrt(s0 - s2);
  for (int i=0; i < 3; i++) {
    double e1=(a * V.get(i,0) + b * V.get(i,2)) / div;
    double e2=(a * V.get(i,0) - b * V.get(i,2)) / div;
    u1.setIndex(i,e1);
    u2.setIndex(i,e2);
  }
  setU(U1,v2,u1);
  setU(U2,v2,u2);
  setW(W1,H,v2,u1);
  setW(W2,H,v2,u2);
  createSolution(W1,U1,u1,H,solutionsSE.get(0),solutionsN.get(0));
  createSolution(W2,U2,u2,H,solutionsSE.get(1),solutionsN.get(1));
  createMirrorSolution(0,2);
  createMirrorSolution(1,3);
}
Program: 151013
Project: 151013
Buggy source:
public DecomposeHomography(){
  for (int i=0; i < 4; i++) {
    solutionsN.add(new Vector3D_F64());
    solutionsSE.add(new Se3_F64());
  }
}

Fixed version (ground truth):
public DecomposeHomography(){
  for (int i=0; i < 4; i++) {
    solutionsN.add(new Vector3D_F64());
    solutionsSE.add(new Se3_F64());
  }
  svd=new SafeSvd(DecompositionFactory.svd(3,3,false,true,false));
}
Program: 151014
Project: 151014
Buggy source:
/** 
 * <p> Extracts the epipoles from an essential or fundamental matrix.  The epipoles are extracted from the left and right null space of the provided matrix.  Note that the found epipoles are in homogeneous coordinates.  If the epipole is at infinity then z=0 </p> <p> Left: e<sub>2</sub><sup>T</sup>*F = 0 <br> Right: F*e<sub>1</sub> = 0 </p>
 * @param F Input: Fundamental or Essential 3x3 matrix.  Not modified.
 * @param e1 Output: Right epipole in homogeneous coordinates, Modified.
 * @param e2 Output: Left epipole in homogeneous coordinates, Modified.
 */
public static void extractEpipoles(DenseMatrix64F F,Point3D_F64 e1,Point3D_F64 e2){
  SimpleMatrix f=SimpleMatrix.wrap(F);
  SimpleSVD svd=f.svd();
  SimpleMatrix U=svd.getU();
  SimpleMatrix V=svd.getV();
  e2.set(U.get(0,2),U.get(1,2),U.get(2,2));
  e1.set(V.get(0,2),V.get(1,2),V.get(2,2));
}

Fixed version (ground truth):
/** 
 * <p> Extracts the epipoles from an essential or fundamental matrix.  The epipoles are extracted from the left and right null space of the provided matrix.  Note that the found epipoles are in homogeneous coordinates.  If the epipole is at infinity then z=0 </p> <p> Left: e<sub>2</sub><sup>T</sup>*F = 0 <br> Right: F*e<sub>1</sub> = 0 </p>
 * @param F Input: Fundamental or Essential 3x3 matrix.  Not modified.
 * @param e1 Output: Right epipole in homogeneous coordinates. Can be null. Modified.
 * @param e2 Output: Left epipole in homogeneous coordinates. Can be null. Modified.
 */
public static void extractEpipoles(DenseMatrix64F F,Point3D_F64 e1,Point3D_F64 e2){
  SimpleMatrix f=SimpleMatrix.wrap(F);
  SimpleSVD svd=f.svd();
  SimpleMatrix U=svd.getU();
  SimpleMatrix V=svd.getV();
  if (e2 != null)   e2.set(U.get(0,2),U.get(1,2),U.get(2,2));
  if (e1 != null)   e1.set(V.get(0,2),V.get(1,2),V.get(2,2));
}
Program: 151015
Project: 151015
Buggy source:
/** 
 * Computes the homography based on two unique lines on the plane
 * @param line0 Line on the plane
 * @param line1 Line on the plane
 */
public boolean process(PairLineNorm line0,PairLineNorm line1){
  double a0=GeometryMath_F64.dot(e2,line0.l2);
  double a1=GeometryMath_F64.dot(e2,line1.l2);
  GeometryMath_F64.multTran(A,line0.l2,Al0);
  GeometryMath_F64.multTran(A,line1.l2,Al1);
  planeA.set(line0.l1.x,line0.l1.y,line0.l1.z,0);
  planeB.set(Al0.x,Al0.y,Al0.z,a0);
  if (!Intersection3D_F64.intersect(planeA,planeB,intersect0))   return false;
  intersect0.slope.normalize();
  planeA.set(line1.l1.x,line1.l1.y,line1.l1.z,0);
  planeB.set(Al1.x,Al1.y,Al1.z,a1);
  if (!Intersection3D_F64.intersect(planeA,planeB,intersect1))   return false;
  intersect1.slope.normalize();
  from0to1.x=intersect1.p.x - intersect0.p.x;
  from0to1.y=intersect1.p.y - intersect0.p.y;
  from0to1.z=intersect1.p.z - intersect0.p.z;
  GeometryMath_F64.cross(intersect0.slope,from0to1,pi.n);
  pi.p.set(intersect0.p);
  UtilPlane3D_F64.convert(pi,pi_gen);
  v.set(pi_gen.A / pi_gen.D,pi_gen.B / pi_gen.D,pi_gen.C / pi_gen.D);
  GeometryMath_F64.outerProd(e2,v,av);
  CommonOps.sub(A,av,H);
  return true;
}

Fixed version (ground truth):
/** 
 * Computes the homography based on two unique lines on the plane
 * @param line0 Line on the plane
 * @param line1 Line on the plane
 */
public boolean process(PairLineNorm line0,PairLineNorm line1){
  double a0=GeometryMath_F64.dot(e2,line0.l2);
  double a1=GeometryMath_F64.dot(e2,line1.l2);
  GeometryMath_F64.multTran(A,line0.l2,Al0);
  GeometryMath_F64.multTran(A,line1.l2,Al1);
  planeA.set(line0.l1.x,line0.l1.y,line0.l1.z,0);
  planeB.set(Al0.x,Al0.y,Al0.z,a0);
  if (!Intersection3D_F64.intersect(planeA,planeB,intersect0))   return false;
  intersect0.slope.normalize();
  planeA.set(line1.l1.x,line1.l1.y,line1.l1.z,0);
  planeB.set(Al1.x,Al1.y,Al1.z,a1);
  if (!Intersection3D_F64.intersect(planeA,planeB,intersect1))   return false;
  intersect1.slope.normalize();
  from0to1.x=intersect1.p.x - intersect0.p.x;
  from0to1.y=intersect1.p.y - intersect0.p.y;
  from0to1.z=intersect1.p.z - intersect0.p.z;
  GeometryMath_F64.cross(intersect0.slope,from0to1,pi.n);
  pi.p.set(intersect0.p);
  UtilPlane3D_F64.convert(pi,pi_gen);
  v.set(pi_gen.A / pi_gen.D,pi_gen.B / pi_gen.D,pi_gen.C / pi_gen.D);
  GeometryMath_F64.outerProd(e2,v,av);
  CommonOps.sub(A,av,H);
  adjust.adjust(H,line0);
  return true;
}
Program: 151016
Project: 151016
Buggy source:
/** 
 * Estimates the homography from view 1 to view 2 induced by a plane from 3 point associations. Each pair must pass the epipolar constraint.  This can fail if the points are colinear.
 * @param p1 Associated point observation
 * @param p2 Associated point observation
 * @param p3 Associated point observation
 * @return True if successful or false if it failed
 */
public boolean process(AssociatedPair p1,AssociatedPair p2,AssociatedPair p3){
  fillM(p1.p1,p2.p1,p3.p1);
  b.x=computeB(p1.p2);
  b.y=computeB(p2.p2);
  b.z=computeB(p3.p2);
  if (!solver.setA(M))   return false;
  GeometryMath_F64.toMatrix(b,temp0);
  solver.solve(temp0,temp1);
  GeometryMath_F64.toTuple3D(temp1,A_inv_b);
  GeometryMath_F64.addOuterProd(A,-1,e2,A_inv_b,H);
  return true;
}

Fixed version (ground truth):
/** 
 * Estimates the homography from view 1 to view 2 induced by a plane from 3 point associations. Each pair must pass the epipolar constraint.  This can fail if the points are colinear.
 * @param p1 Associated point observation
 * @param p2 Associated point observation
 * @param p3 Associated point observation
 * @return True if successful or false if it failed
 */
public boolean process(AssociatedPair p1,AssociatedPair p2,AssociatedPair p3){
  fillM(p1.p1,p2.p1,p3.p1);
  b.x=computeB(p1.p2);
  b.y=computeB(p2.p2);
  b.z=computeB(p3.p2);
  if (!solver.setA(M))   return false;
  GeometryMath_F64.toMatrix(b,temp0);
  solver.solve(temp0,temp1);
  GeometryMath_F64.toTuple3D(temp1,A_inv_b);
  GeometryMath_F64.addOuterProd(A,-1,e2,A_inv_b,H);
  adjust.adjust(H,p1);
  return true;
}
Program: 151017
Project: 151017
Buggy source:
/** 
 * Computes the homography based on a line and point on the plane
 * @param line Line on the plane
 * @param point Point on the plane
 */
public void process(PairLineNorm line,AssociatedPair point){
  GeometryMath_F64.mult(F,point.p1,Fx);
  GeometryMath_F64.cross(Fx,line.getL2(),t0);
  GeometryMath_F64.cross(point.p2,t0,t1);
  GeometryMath_F64.cross(point.p2,e2,t0);
  double top=GeometryMath_F64.dot(t0,t1);
  double bottom=t0.normSq() * (line.l1.x * point.p1.x + line.l1.y * point.p1.y + line.l1.z);
  GeometryMath_F64.outerProd(e2,line.l1,el);
  GeometryMath_F64.multCrossA(line.l2,F,lf);
  CommonOps.add(lf,top / bottom,el,H);
}

Fixed version (ground truth):
/** 
 * Computes the homography based on a line and point on the plane
 * @param line Line on the plane
 * @param point Point on the plane
 */
public void process(PairLineNorm line,AssociatedPair point){
  GeometryMath_F64.mult(F,point.p1,Fx);
  GeometryMath_F64.cross(Fx,line.getL2(),t0);
  GeometryMath_F64.cross(point.p2,t0,t1);
  GeometryMath_F64.cross(point.p2,e2,t0);
  double top=GeometryMath_F64.dot(t0,t1);
  double bottom=t0.normSq() * (line.l1.x * point.p1.x + line.l1.y * point.p1.y + line.l1.z);
  GeometryMath_F64.outerProd(e2,line.l1,el);
  GeometryMath_F64.multCrossA(line.l2,F,lf);
  CommonOps.add(lf,top / bottom,el,H);
  adjust.adjust(H,point);
}
Program: 151018
Project: 151018
Buggy source:
/** 
 * Specify the fundamental matrix and the camera 2 epipole.
 * @param F Fundamental matrix.
 * @param e2 Epipole for camera 2.  If null it will be computed internally.
 */
public void setFundamental(DenseMatrix64F F,Point3D_F64 e2){
  this.F=F;
  if (e2 != null)   this.e2=e2;
 else {
    MultiViewOps.extractEpipoles(F,new Point3D_F64(),e2);
  }
}

Fixed version (ground truth):
/** 
 * Specify the fundamental matrix and the camera 2 epipole.
 * @param F Fundamental matrix.
 * @param e2 Epipole for camera 2.  If null it will be computed internally.
 */
public void setFundamental(DenseMatrix64F F,Point3D_F64 e2){
  this.F=F;
  if (e2 != null)   this.e2.set(e2);
 else {
    MultiViewOps.extractEpipoles(F,new Point3D_F64(),this.e2);
  }
}
Program: 151019
Project: 151019
Buggy source:
/** 
 * <p> Computes the homography matrix given a set of observed points in two images.  A set of   {@link AssociatedPair}is passed in.  The computed homography 'H' is found such that the attributes 'keyLoc' and 'currLoc' in   {@link AssociatedPair}refers to x1 and x2, respectively, in the equation  below:<br> x<sub>2</sub> = H*x<sub>1</sub> </p>
 * @param points A set of observed image points that are generated from a planar object.  Minimum of 4 pairs required.
 * @param foundH Output: Storage for the found solution. 3x3 matrix.
 * @return true if the calculation was a success.
 */
public boolean process(List<AssociatedPair> points,DenseMatrix64F foundH){
  if (points.size() < 4)   throw new IllegalArgumentException("String_Node_Str");
  if (normalize) {
    LowLevelMultiViewOps.computeNormalization(points,N1,N2);
    createANormalized(points,A);
  }
 else {
    createA(points,A);
  }
  if (computeH(A,foundH))   return false;
  if (normalize)   undoNormalizationH(foundH,N1,N2);
  if (!findScaleH(foundH))   return false;
  adjustHomographSign(points.get(0),foundH);
  return true;
}

Fixed version (ground truth):
/** 
 * <p> Computes the homography matrix given a set of observed points in two images.  A set of   {@link AssociatedPair}is passed in.  The computed homography 'H' is found such that the attributes 'keyLoc' and 'currLoc' in   {@link AssociatedPair}refers to x1 and x2, respectively, in the equation  below:<br> x<sub>2</sub> = H*x<sub>1</sub> </p>
 * @param points A set of observed image points that are generated from a planar object.  Minimum of 4 pairs required.
 * @param foundH Output: Storage for the found solution. 3x3 matrix.
 * @return true if the calculation was a success.
 */
public boolean process(List<AssociatedPair> points,DenseMatrix64F foundH){
  if (points.size() < 4)   throw new IllegalArgumentException("String_Node_Str");
  if (normalize) {
    LowLevelMultiViewOps.computeNormalization(points,N1,N2);
    createANormalized(points,A);
  }
 else {
    createA(points,A);
  }
  if (computeH(A,foundH))   return false;
  if (normalize)   undoNormalizationH(foundH,N1,N2);
  adjust.adjust(foundH,points.get(0));
  return true;
}
Program: 151021
Project: 151021
Buggy source:
/** 
 * Creates a point cloud from a depth image and saves the color information.  The depth and color images are assumed to be aligned.
 * @param param Intrinsic camera parameters for depth image
 * @param depth depth image.  each value is in millimeters.
 * @param rgb Color image that's aligned to the depth.
 * @param cloud Output point cloud
 * @param cloudColor Output color for each point in the cloud
 */
public static void depthTo3D(IntrinsicParameters param,MultiSpectral<ImageUInt8> rgb,ImageUInt16 depth,FastQueue<Point3D_F64> cloud,FastQueueArray_I32 cloudColor){
  cloud.reset();
  cloudColor.reset();
  PixelToNormalized_F64 p2n=new PixelToNormalized_F64();
  p2n.set(param.fx,param.fy,param.skew,param.cx,param.cy);
  Point2D_F64 n=new Point2D_F64();
  ImageUInt8 colorR=rgb.getBand(0);
  ImageUInt8 colorG=rgb.getBand(1);
  ImageUInt8 colorB=rgb.getBand(2);
  for (int y=0; y < depth.height; y++) {
    int index=depth.startIndex + y * depth.stride;
    for (int x=0; x < depth.width; x++) {
      int mm=depth.data[index++] & 0xFFFF;
      if (mm == 0)       continue;
      p2n.compute(x,y,n);
      double l=Math.sqrt(n.x * n.x + n.y * n.y + 1);
      Point3D_F64 p=cloud.grow();
      p.x=(n.x / l) * mm;
      p.y=(n.y / l) * mm;
      p.z=(1.0 / l) * mm;
      int color[]=cloudColor.grow();
      color[0]=colorR.unsafe_get(x,y);
      color[1]=colorG.unsafe_get(x,y);
      color[2]=colorB.unsafe_get(x,y);
    }
  }
}

Fixed version (ground truth):
/** 
 * Creates a point cloud from a depth image and saves the color information.  The depth and color images are assumed to be aligned.
 * @param param Intrinsic camera parameters for depth image
 * @param depth depth image.  each value is in millimeters.
 * @param rgb Color image that's aligned to the depth.
 * @param cloud Output point cloud
 * @param cloudColor Output color for each point in the cloud
 */
public static void depthTo3D(IntrinsicParameters param,MultiSpectral<ImageUInt8> rgb,ImageUInt16 depth,FastQueue<Point3D_F64> cloud,FastQueueArray_I32 cloudColor){
  cloud.reset();
  cloudColor.reset();
  PixelToNormalized_F64 p2n=new PixelToNormalized_F64();
  p2n.set(param.fx,param.fy,param.skew,param.cx,param.cy);
  Point2D_F64 n=new Point2D_F64();
  ImageUInt8 colorR=rgb.getBand(0);
  ImageUInt8 colorG=rgb.getBand(1);
  ImageUInt8 colorB=rgb.getBand(2);
  for (int y=0; y < depth.height; y++) {
    int index=depth.startIndex + y * depth.stride;
    for (int x=0; x < depth.width; x++) {
      int mm=depth.data[index++] & 0xFFFF;
      if (mm == 0)       continue;
      p2n.compute(x,y,n);
      Point3D_F64 p=cloud.grow();
      p.z=mm;
      p.x=n.x * p.z;
      p.y=n.y * p.z;
      int color[]=cloudColor.grow();
      color[0]=colorR.unsafe_get(x,y);
      color[1]=colorG.unsafe_get(x,y);
      color[2]=colorB.unsafe_get(x,y);
    }
  }
}
Program: 151022
Project: 151022
Buggy source:
public void process() throws IOException {
  logFile=new DataOutputStream(new FileOutputStream("String_Node_Str"));
  logFile.write("String_Node_Str".getBytes());
  int w=UtilOpenKinect.getWidth(resolution);
  int h=UtilOpenKinect.getHeight(resolution);
  buffRgb=new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);
  buffer=new byte[w * h * 3];
  StreamOpenKinectRgbDepth stream=new StreamOpenKinectRgbDepth();
  Context kinect=Freenect.createContext();
  if (kinect.numDevices() < 0)   throw new RuntimeException("String_Node_Str");
  Device device=kinect.openDevice(0);
  stream.start(device,resolution,this);
}

Fixed version (ground truth):
public void process() throws IOException {
  logFile=new DataOutputStream(new FileOutputStream("String_Node_Str"));
  logFile.write("String_Node_Str".getBytes());
  int w=UtilOpenKinect.getWidth(resolution);
  int h=UtilOpenKinect.getHeight(resolution);
  buffRgb=new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);
  buffer=new byte[w * h * 3];
  if (showImage) {
    gui=ShowImages.showWindow(buffRgb,"String_Node_Str");
  }
  StreamOpenKinectRgbDepth stream=new StreamOpenKinectRgbDepth();
  Context kinect=Freenect.createContext();
  if (kinect.numDevices() < 0)   throw new RuntimeException("String_Node_Str");
  Device device=kinect.openDevice(0);
  stream.start(device,resolution,this);
  if (maxImages > 0) {
    while (frameNumber < maxImages) {
      BoofMiscOps.pause(100);
    }
    stream.stop();
    System.out.println("String_Node_Str");
    System.exit(0);
  }
}
Program: 151023
Project: 151023
Buggy source:
public static void main(String args[]) throws IOException {
  LogKinectDataApp app=new LogKinectDataApp();
  app.process();
}

Fixed version (ground truth):
public static void main(String args[]) throws IOException {
  LogKinectDataApp app=new LogKinectDataApp(30,true);
  app.process();
}
Program: 151024
Project: 151024
Buggy source:
@Override public void processKinect(MultiSpectral<ImageUInt8> rgb,ImageUInt16 depth,long timeRgb,long timeDepth){
  System.out.println(frameNumber + "String_Node_Str" + timeRgb);
  try {
    logFile.write(String.format("String_Node_Str",frameNumber,timeRgb,timeDepth).getBytes());
    logFile.flush();
    savePPM(rgb);
    saveDepth(depth);
    frameNumber++;
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void processKinect(MultiSpectral<ImageUInt8> rgb,ImageUInt16 depth,long timeRgb,long timeDepth){
  System.out.println(frameNumber + "String_Node_Str" + timeRgb);
  try {
    logFile.write(String.format("String_Node_Str",frameNumber,timeRgb,timeDepth).getBytes());
    logFile.flush();
    savePPM(rgb);
    saveDepth(depth);
    frameNumber++;
    if (showImage) {
      ConvertBufferedImage.convertTo_U8(rgb,buffRgb);
      gui.repaint();
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 151025
Project: 151025
Buggy source:
protected void processRgb(FrameMode mode,ByteBuffer frame,int timestamp){
  if (mode.getVideoFormat() != VideoFormat.RGB) {
    System.out.println("String_Node_Str");
  }
  System.out.println("String_Node_Str" + timestamp);
  if (outRgb == null) {
    rgb.reshape(mode.getWidth(),mode.getHeight());
    outRgb=new BufferedImage(rgb.width,rgb.height,BufferedImage.TYPE_INT_BGR);
    guiRgb=ShowImages.showWindow(outRgb,"String_Node_Str");
  }
  UtilOpenKinect.bufferRgbToMsU8(frame,rgb);
  ConvertBufferedImage.convertTo_U8(rgb,outRgb);
  guiRgb.repaint();
}

Fixed version (ground truth):
protected void processRgb(FrameMode mode,ByteBuffer frame,int timestamp){
  if (mode.getVideoFormat() != VideoFormat.RGB) {
    System.out.println("String_Node_Str");
  }
  System.out.println("String_Node_Str" + timestamp);
  if (outRgb == null) {
    rgb.reshape(mode.getWidth(),mode.getHeight());
    outRgb=new BufferedImage(rgb.width,rgb.height,BufferedImage.TYPE_INT_RGB);
    guiRgb=ShowImages.showWindow(outRgb,"String_Node_Str");
  }
  UtilOpenKinect.bufferRgbToMsU8(frame,rgb);
  ConvertBufferedImage.convertTo_U8(rgb,outRgb);
  guiRgb.repaint();
}
Program: 151026
Project: 151026
Buggy source:
protected void processDepth(FrameMode mode,ByteBuffer frame,int timestamp){
  System.out.println("String_Node_Str" + timestamp);
  if (outDepth == null) {
    depth.reshape(mode.getWidth(),mode.getHeight());
    outDepth=new BufferedImage(depth.width,depth.height,BufferedImage.TYPE_INT_BGR);
    guiDepth=ShowImages.showWindow(outDepth,"String_Node_Str");
  }
  UtilOpenKinect.bufferDepthToU16(frame,depth);
  VisualizeImageData.grayUnsigned(depth,outDepth,1000);
  guiDepth.repaint();
}

Fixed version (ground truth):
protected void processDepth(FrameMode mode,ByteBuffer frame,int timestamp){
  System.out.println("String_Node_Str" + timestamp);
  if (outDepth == null) {
    depth.reshape(mode.getWidth(),mode.getHeight());
    outDepth=new BufferedImage(depth.width,depth.height,BufferedImage.TYPE_INT_RGB);
    guiDepth=ShowImages.showWindow(outDepth,"String_Node_Str");
  }
  UtilOpenKinect.bufferDepthToU16(frame,depth);
  VisualizeImageData.grayUnsigned(depth,outDepth,1000);
  guiDepth.repaint();
}
Program: 151027
Project: 151027
Buggy source:
/** 
 * Converts byte array that contains RGB data into a 3-channel MultiSpectral image
 * @param input Input array
 * @param output Output depth image
 */
public static void bufferRgbToMsU8(byte[] input,MultiSpectral<ImageUInt8> output){
  ImageUInt8 band0=output.getBand(0);
  ImageUInt8 band1=output.getBand(1);
  ImageUInt8 band2=output.getBand(2);
  int indexIn=0;
  for (int y=0; y < output.height; y++) {
    int indexOut=output.startIndex + y * output.stride;
    for (int x=0; x < output.width; x++, indexOut++) {
      band2.data[indexOut]=input[indexIn++];
      band1.data[indexOut]=input[indexIn++];
      band0.data[indexOut]=input[indexIn++];
    }
  }
}

Fixed version (ground truth):
/** 
 * Converts byte array that contains RGB data into a 3-channel MultiSpectral image
 * @param input Input array
 * @param output Output depth image
 */
public static void bufferRgbToMsU8(byte[] input,MultiSpectral<ImageUInt8> output){
  ImageUInt8 band0=output.getBand(0);
  ImageUInt8 band1=output.getBand(1);
  ImageUInt8 band2=output.getBand(2);
  int indexIn=0;
  for (int y=0; y < output.height; y++) {
    int indexOut=output.startIndex + y * output.stride;
    for (int x=0; x < output.width; x++, indexOut++) {
      band0.data[indexOut]=input[indexIn++];
      band1.data[indexOut]=input[indexIn++];
      band2.data[indexOut]=input[indexIn++];
    }
  }
}
Program: 151028
Project: 151028
Buggy source:
private Affine2D_F64 createInitialTransform(){
  float scale=0.8f;
  Affine2D_F64 H=new Affine2D_F64(scale,0,0,scale,stitchWidth / 4,stitchHeight / 4);
  return H.invert(null);
}

Fixed version (ground truth):
private IT createInitialTransform(){
  float scale=0.8f;
  if (fitModel instanceof Affine2D_F64) {
    Affine2D_F64 H=new Affine2D_F64(scale,0,0,scale,stitchWidth / 4,stitchHeight / 4);
    return (IT)H.invert(null);
  }
 else   if (fitModel instanceof Homography2D_F64) {
    Homography2D_F64 H=new Homography2D_F64(scale,0,stitchWidth / 4,0,scale,stitchHeight / 4,0,0,1);
    return (IT)H.invert(null);
  }
 else {
    throw new RuntimeException("String_Node_Str" + fitModel.getClass().getSimpleName());
  }
}
Program: 151029
Project: 151029
Buggy source:
public static void saveXML(Object o,String fileName){
  XStream xstream=new XStream(new DomDriver());
  xstream.registerConverter(new JavaBeanConverter(xstream.getMapper()));
  try {
    xstream.toXML(o,new FileOutputStream(fileName));
  }
 catch (  FileNotFoundException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public static void saveXML(Object o,String fileName){
  XStreamClassLoader loader=new BoofcvClassLoader();
  XStream xstream=new XStream(new PureJavaReflectionProvider(),new DomDriver(),loader,null,new DefaultConverterLookup(),null);
  xstream.registerConverter(new JavaBeanConverter(xstream.getMapper()));
  try {
    xstream.toXML(o,new FileOutputStream(fileName));
  }
 catch (  FileNotFoundException e) {
    throw new RuntimeException(e);
  }
}
Program: 151030
Project: 151030
Buggy source:
public static <T>T loadXML(Reader r){
  XMLDecoder decoder=new XMLDecoder(new ByteArrayInputStream(toString(r).getBytes()));
  T ret=(T)decoder.readObject();
  decoder.close();
  return ret;
}

Fixed version (ground truth):
public static <T>T loadXML(Reader r){
  XStream xstream=new XStream(new DomDriver());
  return (T)xstream.fromXML(r);
}
Program: 151031
Project: 151031
Buggy source:
public void setSelected(int selected){
  this.selectedImage=selected;
  this.isUndistorted=false;
  BufferedImage image=images.get(selected);
  int numBands=image.getRaster().getNumBands();
  if (origMS == null || origMS.getNumBands() != numBands) {
    origMS=new MultiSpectral<ImageFloat32>(ImageFloat32.class,1,1,numBands);
    correctedMS=new MultiSpectral<ImageFloat32>(ImageFloat32.class,1,1,numBands);
  }
  if (image.getWidth() != origMS.getWidth() || image.getHeight() != origMS.getHeight()) {
    int type=numBands == 1 ? BufferedImage.TYPE_INT_BGR : image.getType();
    undistorted=new BufferedImage(image.getWidth(),image.getHeight(),type);
    origMS.reshape(image.getWidth(),image.getHeight());
    correctedMS.reshape(image.getWidth(),image.getHeight());
  }
}

Fixed version (ground truth):
public void setSelected(int selected){
  this.selectedImage=selected;
  this.isUndistorted=false;
  if (origMS == null) {
    BufferedImage image=images.get(selected);
    origMS=ConvertBufferedImage.convertFromMulti(image,null,ImageFloat32.class);
    correctedMS=ConvertBufferedImage.convertFromMulti(image,null,ImageFloat32.class);
    undistorted=new BufferedImage(image.getWidth(),image.getHeight(),image.getType());
  }
}
Program: 151033
Project: 151033
Buggy source:
/** 
 * Loads the default   {@link VideoInterface}.
 * @return Video interface
 */
public static VideoInterface loadManagerDefault(){
  return loadManager("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Loads the default   {@link VideoInterface}.
 * @return Video interface
 */
public static VideoInterface loadManagerDefault(){
  try {
    return loadManager("String_Node_Str");
  }
 catch (  RuntimeException e) {
    return new BoofMjpegVideo();
  }
}
Program: 151035
Project: 151035
Buggy source:
public void optimizeUsingZhang(){
  ComputeZhangErrors.nonlinearUsingZhang(observations,target.points);
}

Fixed version (ground truth):
public void optimizeUsingZhang(){
  ComputeZhangErrors.nonlinearUsingZhang(observations,target);
}
Program: 151036
Project: 151036
Buggy source:
/** 
 * Zhang's results have a fairly different focal length.  Use Zhang's parameters as the initial value when optimizing to see if the focal length stays the same.
 */
public static void nonlinearUsingZhang(List<List<Point2D_F64>> observations,List<Point2D_F64> target){
  Zhang99Parameters param=getZhangParam();
  Zhang99Parameters found=new Zhang99Parameters(false,2,5);
  CalibrationPlanarGridZhang99.optimizedParam(observations,target,param,found,null);
  found.convertToIntrinsic().print();
  List<ImageResults> errors=CalibrateMonoPlanar.computeErrors(observations,found,target);
  CalibrateMonoPlanar.printErrors(errors);
}

Fixed version (ground truth):
/** 
 * Zhang's results have a fairly different focal length.  Use Zhang's parameters as the initial value when optimizing to see if the focal length stays the same.
 */
public static void nonlinearUsingZhang(List<List<Point2D_F64>> observations,PlanarCalibrationTarget target){
  Zhang99Parameters param=getZhangParam();
  Zhang99Parameters found=new Zhang99Parameters(false,2,5);
  CalibrationPlanarGridZhang99 alg=new CalibrationPlanarGridZhang99(target,false,1);
  alg.optimizedParam(observations,target.points,param,found,null);
  found.convertToIntrinsic().print();
  List<ImageResults> errors=CalibrateMonoPlanar.computeErrors(observations,found,target.points);
  CalibrateMonoPlanar.printErrors(errors);
}
Program: 151037
Project: 151037
Buggy source:
@Override public void process(I image){
  detected=false;
  updaterP.update(image,pyramid);
  PyramidOps.gradient(pyramid,gradient,derivX,derivY);
  tracker.updateTracks(image,pyramid,derivX,derivY);
  if (previousSpawn < 0)   return;
  int numActive=tracker.getPureKlt().size() + tracker.getReactivated().size();
  if (previousSpawn - numActive > reactivateThreshold) {
    detected=true;
    tracker.associateAllToDetected();
    previousSpawn=tracker.getPureKlt().size() + tracker.getReactivated().size();
  }
  for (  CombinedTrack<Desc> t : tracker.getPureKlt()) {
    ((PointTrack)t.getCookie()).set(t);
  }
  for (  CombinedTrack<Desc> t : tracker.getReactivated()) {
    ((PointTrack)t.getCookie()).set(t);
  }
}

Fixed version (ground truth):
@Override public void process(I image){
  detected=false;
  updaterP.update(image,pyramid);
  PyramidOps.gradient(pyramid,gradient,derivX,derivY);
  tracker.updateTracks(image,pyramid,derivX,derivY);
  int numActive=tracker.getPureKlt().size() + tracker.getReactivated().size();
  if (previousSpawn - numActive > reactivateThreshold) {
    detected=true;
    tracker.associateAllToDetected();
    previousSpawn=tracker.getPureKlt().size() + tracker.getReactivated().size();
  }
  for (  CombinedTrack<Desc> t : tracker.getPureKlt()) {
    ((PointTrack)t.getCookie()).set(t);
  }
  for (  CombinedTrack<Desc> t : tracker.getReactivated()) {
    ((PointTrack)t.getCookie()).set(t);
  }
}
Program: 151038
Project: 151038
Buggy source:
/** 
 * Estimates the image motion then combines images together.  Can be used for mosaic and stabilization
 * @param maxJumpFraction If the area changes by this much between two consecuative frames then the transformis reset.
 * @param motion2D Estimates the image motion.
 * @param imageType Type of image processed
 * @param < I > Image input type.
 * @param < IT > Model model
 * @return StitchingFromMotion2D
 */
public static <I extends ImageSingleBand,IT extends InvertibleTransform>StitchingFromMotion2D<I,IT> createVideoStitch(double maxJumpFraction,ImageMotion2D<I,IT> motion2D,Class<I> imageType){
  StitchingTransform transform;
  if (motion2D.getTransformType() == Affine2D_F64.class) {
    transform=FactoryStitchingTransform.createAffine_F64();
  }
 else {
    transform=FactoryStitchingTransform.createHomography_F64();
  }
  InterpolatePixel<I> interp=FactoryInterpolation.createPixel(0,255,TypeInterpolate.BILINEAR,imageType);
  ImageDistort<I> distorter=FactoryDistort.distort(interp,null,imageType);
  return new StitchingFromMotion2D<I,IT>(motion2D,distorter,transform,maxJumpFraction);
}

Fixed version (ground truth):
/** 
 * Estimates the image motion then combines images together.  Typically used for mosaics and stabilization.
 * @param maxJumpFraction If the area changes by this much between two consecuative frames then the transformis reset.
 * @param motion2D Estimates the image motion.
 * @param imageType Type of image processed
 * @param < I > Image input type.
 * @param < IT > Model model
 * @return StitchingFromMotion2D
 */
public static <I extends ImageSingleBand,IT extends InvertibleTransform>StitchingFromMotion2D<I,IT> createVideoStitch(double maxJumpFraction,ImageMotion2D<I,IT> motion2D,Class<I> imageType){
  StitchingTransform transform;
  if (motion2D.getTransformType() == Affine2D_F64.class) {
    transform=FactoryStitchingTransform.createAffine_F64();
  }
 else {
    transform=FactoryStitchingTransform.createHomography_F64();
  }
  InterpolatePixel<I> interp=FactoryInterpolation.createPixel(0,255,TypeInterpolate.BILINEAR,imageType);
  ImageDistort<I> distorter=FactoryDistort.distort(interp,null,imageType);
  return new StitchingFromMotion2D<I,IT>(motion2D,distorter,transform,maxJumpFraction);
}
Program: 151040
Project: 151040
Buggy source:
@Override public GrowingArrayInt getUnassociatedSource(){
  return null;
}

Fixed version (ground truth):
@Override public GrowingArrayInt getUnassociatedSource(){
  return alg.getUnassociatedSource();
}
Program: 151041
Project: 151041
Buggy source:
public void printAll(){
  AutoTypeImage types[]=AutoTypeImage.getSpecificTypes();
  for (  AutoTypeImage t : types) {
    input=t;
    printMultiply();
    printMultiplyBounded();
    printDivide();
    printDivideBounded();
    printPlus();
    printPlusBounded();
    printBoundImage();
    printDiffAbs();
    printAverageBand();
  }
  AutoTypeImage outputs[]=new AutoTypeImage[]{U16,S16,S32,S32,S32,S64,F32,F64};
  for (int i=0; i < types.length; i++) {
    printAddTwoImages(types[i],outputs[i]);
    printSubtractTwoImages(types[i],outputs[i]);
  }
}

Fixed version (ground truth):
public void printAll(){
  AutoTypeImage types[]=AutoTypeImage.getSpecificTypes();
  for (  AutoTypeImage t : types) {
    input=t;
    printMultiply();
    printMultiplyBounded();
    printDivide();
    printDivideBounded();
    printPlus();
    printPlusBounded();
    printBoundImage();
    printDiffAbs();
    printAverageBand();
  }
  AutoTypeImage outputsAdd[]=new AutoTypeImage[]{U16,S16,S32,S32,S32,S64,F32,F64};
  AutoTypeImage outputsSub[]=new AutoTypeImage[]{I16,S16,S32,S32,S32,S64,F32,F64};
  for (int i=0; i < types.length; i++) {
    printAddTwoImages(types[i],outputsAdd[i]);
    printSubtractTwoImages(types[i],outputsSub[i]);
  }
}
Program: 151043
Project: 151043
Buggy source:
/** 
 * <p> Performs pixel-wise subtraction, but ensures the result is between two bounds.<br> d(x,y) = imgA(x,y) - imgB(x,y) </p>
 * @param imgA Input image. Not modified.
 * @param imgB Input image. Not modified.
 * @param output Output image. Modified.
 */
public static void subtract(ImageFloat64 imgA,ImageFloat64 imgB,ImageFloat64 output){
  InputSanityCheck.checkSameShape(imgA,imgB,output);
  final int h=imgA.getHeight();
  final int w=imgA.getWidth();
  for (int y=0; y < h; y++) {
    int indexA=imgA.getStartIndex() + y * imgA.getStride();
    int indexB=imgB.getStartIndex() + y * imgB.getStride();
    int indexOut=output.getStartIndex() + y * output.getStride();
    int indexEnd=indexA + w;
    for (; indexA < indexEnd; indexA++, indexB++, indexOut++) {
      output.data[indexOut]=((imgA.data[indexA]) - (imgB.data[indexB]));
    }
  }
}

Fixed version (ground truth):
/** 
 * <p> Performs pixel-wise subtraction.<br> d(x,y) = imgA(x,y) - imgB(x,y) </p>
 * @param imgA Input image. Not modified.
 * @param imgB Input image. Not modified.
 * @param output Output image. Modified.
 */
public static void subtract(ImageFloat64 imgA,ImageFloat64 imgB,ImageFloat64 output){
  InputSanityCheck.checkSameShape(imgA,imgB,output);
  final int h=imgA.getHeight();
  final int w=imgA.getWidth();
  for (int y=0; y < h; y++) {
    int indexA=imgA.getStartIndex() + y * imgA.getStride();
    int indexB=imgB.getStartIndex() + y * imgB.getStride();
    int indexOut=output.getStartIndex() + y * output.getStride();
    int indexEnd=indexA + w;
    for (; indexA < indexEnd; indexA++, indexB++, indexOut++) {
      output.data[indexOut]=((imgA.data[indexA]) - (imgB.data[indexB]));
    }
  }
}
Program: 151044
Project: 151044
Buggy source:
@Override protected void startEverything(){
  tracker.dropAllTracks();
  createModelMatcher(maxIterations,4);
  distortAlg=new MotionMosaicPointKey<I,T>(tracker,modelMatcher,modelRefiner,fitModel,40,0.3,0.8);
  T initTran=ConvertTransform_F64.convert(createInitialTransform(),fitModel.createInstance());
  distortAlg.setInitialTransform(initTran);
  totalKeyFrames=0;
  motionRender.clear();
  startWorkerThread();
}

Fixed version (ground truth):
@Override protected void startEverything(){
  tracker.dropAllTracks();
  createModelMatcher(maxIterations,4);
  distortAlg=new MotionMosaicPointKey<I,T>(tracker,modelMatcher,modelRefiner,fitModel,40,0.3,pruneThreshold,0.8);
  T initTran=ConvertTransform_F64.convert(createInitialTransform(),fitModel.createInstance());
  distortAlg.setInitialTransform(initTran);
  totalKeyFrames=0;
  motionRender.clear();
  startWorkerThread();
}
Program: 151045
Project: 151045
Buggy source:
public VideoMosaicSequentialPointApp(Class<I> imageType,Class<D> derivType){
  super(false,imageType,2);
  setOutputSize(1000,600);
  PkltConfig<I,D> config=PkltConfig.createDefault(imageType,derivType);
  config.maxFeatures=maxFeatures;
  config.featureRadius=3;
  config.pyramidScaling=new int[]{1,2,4,8};
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.klt(config,1,1));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_BRIEF(400,150,1,10,imageType,null));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_FH_SURF(300,200,2,imageType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.combined_FH_SURF_KLT(300,200,3,config.config,config.pyramidScaling,200,imageType));
  addAlgorithm(1,"String_Node_Str",new Affine2D_F64());
  addAlgorithm(1,"String_Node_Str",new Homography2D_F64());
}

Fixed version (ground truth):
public VideoMosaicSequentialPointApp(Class<I> imageType,Class<D> derivType){
  super(false,imageType,2);
  setOutputSize(1000,600);
  PkltConfig<I,D> config=PkltConfig.createDefault(imageType,derivType);
  config.maxFeatures=maxFeatures;
  config.featureRadius=3;
  config.pyramidScaling=new int[]{1,2,4,8};
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.klt(config,1,1));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_BRIEF(400,150,1,10,imageType,null));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_NCC(500,11,11,10,imageType,derivType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_FH_SURF(300,2,200,1,imageType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.combined_FH_SURF_KLT(300,200,3,config.config,config.pyramidScaling,200,imageType));
  addAlgorithm(1,"String_Node_Str",new Affine2D_F64());
  addAlgorithm(1,"String_Node_Str",new Homography2D_F64());
}
Program: 151046
Project: 151046
Buggy source:
public VideoStabilizeSequentialPointApp(Class<I> imageType,Class<D> derivType){
  super(true,imageType,2);
  PkltConfig<I,D> config=PkltConfig.createDefault(imageType,derivType);
  config.maxFeatures=maxFeatures;
  config.featureRadius=3;
  config.pyramidScaling=new int[]{1,2,4,8};
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.klt(config,1,1));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_BRIEF(400,100,1,10,imageType,derivType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_FH_SURF(300,200,2,imageType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_NCC(500,11,11,10,imageType,derivType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.combined_FH_SURF_KLT(300,200,2,config.config,config.pyramidScaling,100,imageType));
  addAlgorithm(1,"String_Node_Str",new Affine2D_F64());
  addAlgorithm(1,"String_Node_Str",new Homography2D_F64());
}

Fixed version (ground truth):
public VideoStabilizeSequentialPointApp(Class<I> imageType,Class<D> derivType){
  super(true,imageType,2);
  PkltConfig<I,D> config=PkltConfig.createDefault(imageType,derivType);
  config.maxFeatures=maxFeatures;
  config.featureRadius=3;
  config.pyramidScaling=new int[]{1,2,4,8};
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.klt(config,1,1));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_BRIEF(400,100,1,10,imageType,derivType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_NCC(500,11,11,10,imageType,derivType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_FH_SURF(400,2,200,2,imageType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.combined_FH_SURF_KLT(300,200,2,config.config,config.pyramidScaling,100,imageType));
  addAlgorithm(1,"String_Node_Str",new Affine2D_F64());
  addAlgorithm(1,"String_Node_Str",new Homography2D_F64());
}
Program: 151047
Project: 151047
Buggy source:
@Override protected void startEverything(){
  tracker.dropAllTracks();
  createModelMatcher(maxIterations,4);
  distortAlg=new MotionStabilizePointKey<I,T>(tracker,modelMatcher,modelRefiner,fitModel,thresholdKeyFrame,thresholdReset,largeMotionThreshold);
  totalKeyFrames=0;
  I image=sequence.next();
  setOutputSize(image.width,image.height);
  motionRender.clear();
  startWorkerThread();
}

Fixed version (ground truth):
@Override protected void startEverything(){
  tracker.dropAllTracks();
  createModelMatcher(maxIterations,4);
  distortAlg=new MotionStabilizePointKey<I,T>(tracker,modelMatcher,modelRefiner,fitModel,thresholdKeyFrame,thresholdReset,pruneThreshold,largeMotionThreshold);
  totalKeyFrames=0;
  I image=sequence.next();
  setOutputSize(image.width,image.height);
  motionRender.clear();
  startWorkerThread();
}
Program: 151048
Project: 151048
Buggy source:
public VideoTrackFeaturesApp(Class<I> imageType,Class<D> derivType){
  super(1,imageType);
  PkltConfig<I,D> config=PkltConfig.createDefault(imageType,derivType);
  config.maxFeatures=maxFeatures;
  config.featureRadius=3;
  config.pyramidScaling=new int[]{1,2,4,8};
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.klt(config,1,1));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_BRIEF(300,200,1,1,imageType,derivType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_FH_SURF(300,200,2,imageType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_NCC(500,5,5,20,imageType,derivType));
  gui.addMouseListener(this);
  gui.requestFocus();
  setMainGUI(gui);
}

Fixed version (ground truth):
public VideoTrackFeaturesApp(Class<I> imageType,Class<D> derivType){
  super(1,imageType);
  PkltConfig<I,D> config=PkltConfig.createDefault(imageType,derivType);
  config.maxFeatures=maxFeatures;
  config.featureRadius=3;
  config.pyramidScaling=new int[]{1,2,4,8};
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.klt(config,1,1));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_BRIEF(300,200,1,1,imageType,derivType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_FH_SURF(300,2,200,1,imageType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_NCC(500,5,5,20,imageType,derivType));
  gui.addMouseListener(this);
  gui.requestFocus();
  setMainGUI(gui);
}
Program: 151049
Project: 151049
Buggy source:
/** 
 * Creates a SURF feature tracker.
 */
public void createSURF(){
  tracker=FactoryPointSequentialTracker.dda_FH_SURF(200,80,3,imageType);
}

Fixed version (ground truth):
/** 
 * Creates a SURF feature tracker.
 */
public void createSURF(){
  tracker=FactoryPointSequentialTracker.dda_FH_SURF(200,3,200,2,imageType);
}