nus-yam/ex-repair huggingface dataset:
Program: 151051
Project: 151051
Buggy source:
/** 
 * Processes the next frame in the sequence.
 * @param frame Next frame in the video sequence
 * @return true if motion was estimated and false if no motion was estimated
 */
public boolean process(I frame){
  tracker.process(frame);
  totalProcessed++;
  List<PointTrack> tracks=tracker.getActiveTracks(null);
  if (tracks.size() == 0)   return false;
  List<AssociatedPair> pairs=new ArrayList<AssociatedPair>();
  for (  PointTrack t : tracks) {
    pairs.add((AssociatedPair)t.getCookie());
  }
  if (!modelMatcher.process((List)pairs)) {
    return false;
  }
  if (modelRefiner == null || !modelRefiner.fitModel(modelMatcher.getMatchSet(),modelMatcher.getModel(),keyToCurr)) {
    keyToCurr.set(modelMatcher.getModel());
  }
  worldToKey.concat(keyToCurr,worldToCurr);
  return true;
}

Fixed version (ground truth):
/** 
 * Processes the next frame in the sequence.
 * @param frame Next frame in the video sequence
 * @return true if motion was estimated and false if no motion was estimated
 */
public boolean process(I frame){
  tracker.process(frame);
  totalProcessed++;
  List<PointTrack> tracks=tracker.getActiveTracks(null);
  if (tracks.size() == 0)   return false;
  List<AssociatedPair> pairs=new ArrayList<AssociatedPair>();
  for (  PointTrack t : tracks) {
    pairs.add((AssociatedPair)t.getCookie());
  }
  if (!modelMatcher.process((List)pairs)) {
    return false;
  }
  for (  AssociatedPair p : modelMatcher.getMatchSet()) {
    ((AssociatedPairTrack)p).lastUsed=totalProcessed;
  }
  if (modelRefiner == null || !modelRefiner.fitModel(modelMatcher.getMatchSet(),modelMatcher.getModel(),keyToCurr)) {
    keyToCurr.set(modelMatcher.getModel());
  }
  worldToKey.concat(keyToCurr,worldToCurr);
  List<PointTrack> all=tracker.getAllTracks(null);
  for (  PointTrack t : all) {
    AssociatedPairTrack p=t.getCookie();
    if (totalProcessed - p.lastUsed >= pruneThreshold) {
      System.out.println("String_Node_Str" + (totalProcessed - p.lastUsed));
      tracker.dropTrack(t);
    }
  }
  return true;
}
Program: 151052
Project: 151052
Buggy source:
/** 
 * Specify algorithms to use internally.  Each of these classes must work with compatible data structures.
 * @param tracker feature tracker
 * @param modelMatcher Fits model to track data
 * @param modelRefiner (Optional) Refines the found model using the entire inlier set. Can be null.
 * @param model Motion model data structure
 */
public ImageMotionPointKey(ImagePointTracker<I> tracker,ModelMatcher<T,AssociatedPair> modelMatcher,ModelFitter<T,AssociatedPair> modelRefiner,T model){
  this.tracker=tracker;
  this.modelMatcher=modelMatcher;
  this.modelRefiner=modelRefiner;
  worldToInit=(T)model.createInstance();
  worldToKey=(T)model.createInstance();
  keyToCurr=(T)model.createInstance();
  worldToCurr=(T)model.createInstance();
}

Fixed version (ground truth):
/** 
 * Specify algorithms to use internally.  Each of these classes must work with compatible data structures.
 * @param tracker feature tracker
 * @param modelMatcher Fits model to track data
 * @param modelRefiner (Optional) Refines the found model using the entire inlier set. Can be null.
 * @param model Motion model data structure
 * @param pruneThreshold Tracks not in the inlier set for this many frames in a row are pruned
 */
public ImageMotionPointKey(ImagePointTracker<I> tracker,ModelMatcher<T,AssociatedPair> modelMatcher,ModelFitter<T,AssociatedPair> modelRefiner,T model,int pruneThreshold){
  this.tracker=tracker;
  this.modelMatcher=modelMatcher;
  this.modelRefiner=modelRefiner;
  this.pruneThreshold=pruneThreshold;
  worldToInit=(T)model.createInstance();
  worldToKey=(T)model.createInstance();
  keyToCurr=(T)model.createInstance();
  worldToCurr=(T)model.createInstance();
}
Program: 151053
Project: 151053
Buggy source:
/** 
 * Make the current frame the first frame in the sequence
 */
public void changeKeyFrame(){
  tracker.dropAllTracks();
  tracker.spawnTracks();
  List<PointTrack> spawned=tracker.getNewTracks(null);
  for (  PointTrack l : spawned) {
    AssociatedPair p=l.getCookie();
    if (p == null) {
      l.cookie=p=new AssociatedPair();
      p.p2=l;
      l.cookie=p;
    }
    p.p1.set(p.p2);
  }
  totalSpawned=spawned.size();
  worldToKey.set(worldToCurr);
}

Fixed version (ground truth):
/** 
 * Make the current frame the first frame in the sequence
 */
public void changeKeyFrame(){
  tracker.dropAllTracks();
  tracker.spawnTracks();
  List<PointTrack> spawned=tracker.getNewTracks(null);
  for (  PointTrack l : spawned) {
    AssociatedPairTrack p=l.getCookie();
    if (p == null) {
      l.cookie=p=new AssociatedPairTrack();
      p.p2=l;
      l.cookie=p;
    }
    p.p1.set(l);
    p.lastUsed=totalProcessed;
  }
  totalSpawned=spawned.size();
  worldToKey.set(worldToCurr);
}
Program: 151054
Project: 151054
Buggy source:
/** 
 * Specify algorithms to use internally.  Each of these classes must work with compatible data structures.
 * @param tracker feature tracker
 * @param modelMatcher Fits model to track data
 * @param modelRefiner (Optional) Refines the found model using the entire inlier set. Can be null.
 * @param model Motion model data structure
 */
public MotionMosaicPointKey(ImagePointTracker<I> tracker,ModelMatcher<T,AssociatedPair> modelMatcher,ModelFitter<T,AssociatedPair> modelRefiner,T model,int absoluteMinimumTracks,double respawnTrackFraction,double respawnCoverageFraction){
  super(tracker,modelMatcher,modelRefiner,model);
  this.absoluteMinimumTracks=absoluteMinimumTracks;
  this.respawnTrackFraction=respawnTrackFraction;
  this.respawnCoverageFraction=respawnCoverageFraction;
}

Fixed version (ground truth):
/** 
 * Specify algorithms to use internally.  Each of these classes must work with compatible data structures.
 * @param tracker feature tracker
 * @param modelMatcher Fits model to track data
 * @param modelRefiner (Optional) Refines the found model using the entire inlier set. Can be null.
 * @param model Motion model data structure
 */
public MotionMosaicPointKey(ImagePointTracker<I> tracker,ModelMatcher<T,AssociatedPair> modelMatcher,ModelFitter<T,AssociatedPair> modelRefiner,T model,int absoluteMinimumTracks,double respawnTrackFraction,int pruneThreshold,double respawnCoverageFraction){
  super(tracker,modelMatcher,modelRefiner,model,pruneThreshold);
  this.absoluteMinimumTracks=absoluteMinimumTracks;
  this.respawnTrackFraction=respawnTrackFraction;
  this.respawnCoverageFraction=respawnCoverageFraction;
}
Program: 151055
Project: 151055
Buggy source:
/** 
 * Specify algorithms to use internally.  Each of these classes must work with compatible data structures.
 * @param tracker feature tracker
 * @param modelMatcher Fits model to track data
 * @param modelRefiner (Optional) Refines the found model using the entire inlier set. Can be null.
 * @param model Motion model data structure
 * @param thresholdKeyFrame  If the number of inlier is less than this number the keyframe will change.
 * @param thresholdReset If the number of inlier is less than this number a reset will occur.
 * @param largeMotionThreshold  If the transform from the key frame to the current frame is more than this a reset will occur.
 */
public MotionStabilizePointKey(ImagePointTracker<I> tracker,ModelMatcher<T,AssociatedPair> modelMatcher,ModelFitter<T,AssociatedPair> modelRefiner,T model,int thresholdKeyFrame,int thresholdReset,int largeMotionThreshold){
  super(tracker,modelMatcher,modelRefiner,model);
  if (thresholdKeyFrame < thresholdReset) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.thresholdKeyFrame=thresholdKeyFrame;
  this.thresholdReset=thresholdReset;
  this.largeMotionThreshold=largeMotionThreshold;
}

Fixed version (ground truth):
/** 
 * Specify algorithms to use internally.  Each of these classes must work with compatible data structures.
 * @param tracker feature tracker
 * @param modelMatcher Fits model to track data
 * @param modelRefiner (Optional) Refines the found model using the entire inlier set. Can be null.
 * @param model Motion model data structure
 * @param thresholdKeyFrame  If the number of inlier is less than this number the keyframe will change.
 * @param thresholdReset If the number of inlier is less than this number a reset will occur.
 * @param largeMotionThreshold  If the transform from the key frame to the current frame is more than this a reset will occur.
 */
public MotionStabilizePointKey(ImagePointTracker<I> tracker,ModelMatcher<T,AssociatedPair> modelMatcher,ModelFitter<T,AssociatedPair> modelRefiner,T model,int thresholdKeyFrame,int thresholdReset,int pruneThreshold,int largeMotionThreshold){
  super(tracker,modelMatcher,modelRefiner,model,pruneThreshold);
  if (thresholdKeyFrame < thresholdReset) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.thresholdKeyFrame=thresholdKeyFrame;
  this.thresholdReset=thresholdReset;
  this.largeMotionThreshold=largeMotionThreshold;
}
Program: 151056
Project: 151056
Buggy source:
/** 
 * Test the keyframe based on the definition of the keyframe
 */
@Test public void changeKeyFrame(){
  Se2_F32 computed=new Se2_F32(4,5,6);
  Se2_F32 model=new Se2_F32();
  DummyTracker tracker=new DummyTracker();
  DummyModelMatcher<Se2_F32> matcher=new DummyModelMatcher<Se2_F32>(computed,5);
  ImageUInt8 input=new ImageUInt8(20,30);
  ImageMotionPointKey<ImageUInt8,Se2_F32> alg=new ImageMotionPointKey<ImageUInt8,Se2_F32>(tracker,matcher,null,model);
  alg.process(input);
  alg.changeKeyFrame();
  alg.process(input);
  Se2_F32 worldToKey=alg.getWorldToKey();
  assertEquals(0,worldToKey.getX(),1e-8);
  assertEquals(1,tracker.numSpawn);
  alg.changeKeyFrame();
  assertEquals(2,tracker.numSpawn);
  worldToKey=alg.getWorldToKey();
  assertEquals(computed.getX(),worldToKey.getX(),1e-8);
}

Fixed version (ground truth):
/** 
 * Test the keyframe based on the definition of the keyframe
 */
@Test public void changeKeyFrame(){
  Se2_F32 computed=new Se2_F32(4,5,6);
  Se2_F32 model=new Se2_F32();
  DummyTracker tracker=new DummyTracker();
  DummyModelMatcher<Se2_F32> matcher=new DummyModelMatcher<Se2_F32>(computed,5);
  ImageUInt8 input=new ImageUInt8(20,30);
  ImageMotionPointKey<ImageUInt8,Se2_F32> alg=new ImageMotionPointKey<ImageUInt8,Se2_F32>(tracker,matcher,null,model,100);
  alg.process(input);
  alg.changeKeyFrame();
  alg.process(input);
  Se2_F32 worldToKey=alg.getWorldToKey();
  assertEquals(0,worldToKey.getX(),1e-8);
  assertEquals(1,tracker.numSpawn);
  alg.changeKeyFrame();
  assertEquals(2,tracker.numSpawn);
  worldToKey=alg.getWorldToKey();
  assertEquals(computed.getX(),worldToKey.getX(),1e-8);
}
Program: 151057
Project: 151057
Buggy source:
@Test public void changeWorld(){
  Se2_F32 oldToNew=new Se2_F32(1,2,0);
  Se2_F32 model=new Se2_F32();
  ImageMotionPointKey<ImageUInt8,Se2_F32> alg=new ImageMotionPointKey<ImageUInt8,Se2_F32>(null,null,null,model);
  alg.changeWorld(oldToNew);
  Se2_F32 worldToCurr=alg.getWorldToCurr();
  Se2_F32 worldToKey=alg.getWorldToKey();
  assertEquals(oldToNew.getX(),worldToCurr.getX(),1e-8);
  assertEquals(oldToNew.getX(),worldToKey.getX(),1e-8);
}

Fixed version (ground truth):
@Test public void changeWorld(){
  Se2_F32 oldToNew=new Se2_F32(1,2,0);
  Se2_F32 model=new Se2_F32();
  ImageMotionPointKey<ImageUInt8,Se2_F32> alg=new ImageMotionPointKey<ImageUInt8,Se2_F32>(null,null,null,model,1000);
  alg.changeWorld(oldToNew);
  Se2_F32 worldToCurr=alg.getWorldToCurr();
  Se2_F32 worldToKey=alg.getWorldToKey();
  assertEquals(oldToNew.getX(),worldToCurr.getX(),1e-8);
  assertEquals(oldToNew.getX(),worldToKey.getX(),1e-8);
}
Program: 151058
Project: 151058
Buggy source:
@Test public void checkLargeDistortion(){
  Affine2D_F32 model=new Affine2D_F32();
  Affine2D_F32 computed=new Affine2D_F32(1,0,0,1,2,3);
  DummyTracker tracker=new DummyTracker();
  DummyModelMatcher<Affine2D_F32> matcher=new DummyModelMatcher<Affine2D_F32>(computed,20);
  ImageUInt8 input=new ImageUInt8(20,30);
  MotionStabilizePointKey<ImageUInt8,Affine2D_F32> alg=new MotionStabilizePointKey<ImageUInt8,Affine2D_F32>(tracker,matcher,null,model,5,3,10);
  assertTrue(alg.process(input));
  assertTrue(alg.isKeyFrame());
  assertFalse(alg.isReset());
  matcher.setMotion(new Affine2D_F32(100,0,0,200,2,3));
  assertTrue(alg.process(input));
  assertTrue(alg.isReset());
}

Fixed version (ground truth):
@Test public void checkLargeDistortion(){
  Affine2D_F32 model=new Affine2D_F32();
  Affine2D_F32 computed=new Affine2D_F32(1,0,0,1,2,3);
  DummyTracker tracker=new DummyTracker();
  DummyModelMatcher<Affine2D_F32> matcher=new DummyModelMatcher<Affine2D_F32>(computed,20);
  ImageUInt8 input=new ImageUInt8(20,30);
  MotionStabilizePointKey<ImageUInt8,Affine2D_F32> alg=new MotionStabilizePointKey<ImageUInt8,Affine2D_F32>(tracker,matcher,null,model,5,3,10,10);
  assertTrue(alg.process(input));
  assertTrue(alg.isKeyFrame());
  assertFalse(alg.isReset());
  matcher.setMotion(new Affine2D_F32(100,0,0,200,2,3));
  assertTrue(alg.process(input));
  assertTrue(alg.isReset());
}
Program: 151059
Project: 151059
Buggy source:
public VisualizeStereoVisualOdometryApp(Class<I> imageType){
  super(1,imageType);
  addAlgorithm(0,"String_Node_Str",0);
  addAlgorithm(0,"String_Node_Str",1);
  guiInfo=new VisualOdometryPanel();
  guiLeft=new ImagePanel();
  guiRight=new ImagePanel();
  guiCam3D=new Polygon3DSequenceViewer();
  add(guiInfo,BorderLayout.WEST);
  add(guiRight,BorderLayout.EAST);
  setMainGUI(guiLeft);
  guiLeft.addMouseListener(this);
  guiInfo.setListener(this);
}

Fixed version (ground truth):
public VisualizeStereoVisualOdometryApp(Class<I> imageType){
  super(1,imageType);
  addAlgorithm(0,"String_Node_Str",0);
  addAlgorithm(0,"String_Node_Str",1);
  addAlgorithm(0,"String_Node_Str",1);
  guiInfo=new VisualOdometryPanel();
  guiLeft=new ImagePanel();
  guiRight=new ImagePanel();
  guiCam3D=new Polygon3DSequenceViewer();
  add(guiInfo,BorderLayout.WEST);
  add(guiRight,BorderLayout.EAST);
  setMainGUI(guiLeft);
  guiLeft.addMouseListener(this);
  guiInfo.setListener(this);
}
Program: 151060
Project: 151060
Buggy source:
@Override public void refreshAll(Object[] cookies){
  numFaults=0;
  alg=createStereoDepth(whichAlg == 0);
  alg.setCalibration(config);
  guiInfo.reset();
  handleRunningStatus(2);
  IntrinsicParameters right=config.right;
  DenseMatrix64F K=PerspectiveOps.calibrationMatrix(config.left,null);
  guiCam3D.init();
  guiCam3D.setK(K);
  guiCam3D.setStepSize(config.getBaseline());
  guiCam3D.setPreferredSize(new Dimension(right.width,right.height));
  guiCam3D.setMaximumSize(guiCam3D.getPreferredSize());
  startWorkerThread();
}

Fixed version (ground truth):
@Override public void refreshAll(Object[] cookies){
  numFaults=0;
  alg=createStereoDepth(whichAlg);
  alg.setCalibration(config);
  guiInfo.reset();
  handleRunningStatus(2);
  IntrinsicParameters right=config.right;
  DenseMatrix64F K=PerspectiveOps.calibrationMatrix(config.left,null);
  guiCam3D.init();
  guiCam3D.setK(K);
  guiCam3D.setStepSize(config.getBaseline());
  guiCam3D.setPreferredSize(new Dimension(right.width,right.height));
  guiCam3D.setMaximumSize(guiCam3D.getPreferredSize());
  startWorkerThread();
}
Program: 151061
Project: 151061
Buggy source:
private StereoVisualOdometry<I> createStereoDepth(boolean useKlt){
  ImagePointTracker<I> tracker;
  int thresholdAdd;
  int thresholdRetire;
  if (useKlt) {
    thresholdAdd=120;
    thresholdRetire=2;
    Class derivType=GImageDerivativeOps.getDerivativeType(imageType);
    tracker=FactoryPointSequentialTracker.klt(600,new int[]{1,2,4,8},3,3,2,imageType,derivType);
  }
 else {
    thresholdAdd=80;
    thresholdRetire=3;
    tracker=FactoryPointSequentialTracker.dda_ST_BRIEF(600,200,2,0,imageType,null);
  }
  StereoDisparitySparse<I> disparity=FactoryStereoDisparity.regionSparseWta(0,150,3,3,30,-1,true,imageType);
  return FactoryVisualOdometry.stereoDepth(thresholdAdd,thresholdRetire,1.5,tracker,disparity,0,imageType);
}

Fixed version (ground truth):
private StereoVisualOdometry<I> createStereoDepth(int whichAlg){
  ImagePointTracker<I> tracker;
  Class derivType=GImageDerivativeOps.getDerivativeType(imageType);
  int thresholdAdd;
  int thresholdRetire;
  if (whichAlg == 0) {
    thresholdAdd=120;
    thresholdRetire=2;
    tracker=FactoryPointSequentialTracker.klt(600,new int[]{1,2,4,8},3,1,1,imageType,derivType);
  }
 else   if (whichAlg == 1) {
    thresholdAdd=80;
    thresholdRetire=3;
    tracker=FactoryPointSequentialTracker.dda_ST_BRIEF(600,200,2,0,imageType,null);
  }
 else {
    thresholdAdd=80;
    thresholdRetire=3;
    tracker=FactoryPointSequentialTracker.combined_ST_SURF_KLT(600,3,0,3,new int[]{1,2,4,8},50,true,imageType,derivType);
  }
  StereoDisparitySparse<I> disparity=FactoryStereoDisparity.regionSparseWta(0,150,3,3,30,-1,true,imageType);
  return FactoryVisualOdometry.stereoDepth(thresholdAdd,thresholdRetire,1.5,tracker,disparity,0,imageType);
}
Program: 151062
Project: 151062
Buggy source:
@Override public void dropTrack(PointTrack track){
  tracker.dropTrack((CombinedTrack<TD>)track.getDescription());
}

Fixed version (ground truth):
@Override public void dropTrack(PointTrack track){
  tracker.dropTrack((CombinedTrack<TD>)track.getDescription());
  previousSpawn--;
}
Program: 151063
Project: 151063
Buggy source:
private void printSelect(){
  out.print("String_Node_Str" + "String_Node_Str" + sumType + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ sumType+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ sumType+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  if (isFloat) {
    out.print("String_Node_Str");
  }
 else {
    out.print("String_Node_Str");
  }
  out.print("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
private void printSelect(){
  out.print("String_Node_Str" + "String_Node_Str" + sumType + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ sumType+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ sumType+ "String_Node_Str"+ MAX_VALUE+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  if (isFloat) {
    out.print("String_Node_Str");
  }
 else {
    out.print("String_Node_Str");
  }
  out.print("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 151064
Project: 151064
Buggy source:
public void createFile(boolean isFloat) throws FileNotFoundException {
  this.isFloat=isFloat;
  if (isFloat) {
    sumType="String_Node_Str";
    dataAbr="String_Node_Str";
  }
 else {
    sumType="String_Node_Str";
    dataAbr="String_Node_Str";
  }
  setOutputFile("String_Node_Str" + dataAbr);
  printPreamble();
  printSetTexture();
  printSelect();
  out.println("String_Node_Str");
}

Fixed version (ground truth):
public void createFile(boolean isFloat) throws FileNotFoundException {
  this.isFloat=isFloat;
  if (isFloat) {
    sumType="String_Node_Str";
    MAX_VALUE="String_Node_Str";
    dataAbr="String_Node_Str";
  }
 else {
    sumType="String_Node_Str";
    MAX_VALUE="String_Node_Str";
    dataAbr="String_Node_Str";
  }
  setOutputFile("String_Node_Str" + dataAbr);
  printPreamble();
  printSetTexture();
  printSelect();
  out.println("String_Node_Str");
}
Program: 151065
Project: 151065
Buggy source:
@Override public boolean select(float[] scores,int maxDisparity){
  int disparity=0;
  float best=scores[0];
  for (int i=1; i < maxDisparity; i++) {
    if (scores[i] < best) {
      best=scores[i];
      disparity=i;
    }
  }
  if (best > maxError) {
    return false;
  }
 else   if (textureThreshold > 0) {
    float secondBest=scores[0];
    for (int i=1; i < disparity - 1; i++) {
      if (scores[i] < secondBest)       secondBest=scores[i];
    }
    for (int i=disparity + 2; i < maxDisparity; i++) {
      if (scores[i] < secondBest)       secondBest=scores[i];
    }
    if (secondBest - best <= textureThreshold * best)     return false;
  }
  this.disparity=disparity;
  return true;
}

Fixed version (ground truth):
@Override public boolean select(float[] scores,int maxDisparity){
  int disparity=0;
  float best=scores[0];
  for (int i=1; i < maxDisparity; i++) {
    if (scores[i] < best) {
      best=scores[i];
      disparity=i;
    }
  }
  if (best > maxError) {
    return false;
  }
 else   if (textureThreshold > 0) {
    float secondBest=Float.MAX_VALUE;
    for (int i=0; i < disparity - 1; i++) {
      if (scores[i] < secondBest)       secondBest=scores[i];
    }
    for (int i=disparity + 2; i < maxDisparity; i++) {
      if (scores[i] < secondBest)       secondBest=scores[i];
    }
    if (secondBest - best <= textureThreshold * best)     return false;
  }
  this.disparity=disparity;
  return true;
}
Program: 151066
Project: 151066
Buggy source:
@Override public boolean select(int[] scores,int maxDisparity){
  int disparity=0;
  int best=scores[0];
  for (int i=1; i < maxDisparity; i++) {
    if (scores[i] < best) {
      best=scores[i];
      disparity=i;
    }
  }
  if (best > maxError) {
    return false;
  }
 else   if (textureThreshold > 0) {
    int secondBest=scores[0];
    for (int i=1; i < disparity - 1; i++) {
      if (scores[i] < secondBest)       secondBest=scores[i];
    }
    for (int i=disparity + 2; i < maxDisparity; i++) {
      if (scores[i] < secondBest)       secondBest=scores[i];
    }
    if (discretizer * (secondBest - best) <= textureThreshold * best)     return false;
  }
  this.disparity=disparity;
  return true;
}

Fixed version (ground truth):
@Override public boolean select(int[] scores,int maxDisparity){
  int disparity=0;
  int best=scores[0];
  for (int i=1; i < maxDisparity; i++) {
    if (scores[i] < best) {
      best=scores[i];
      disparity=i;
    }
  }
  if (best > maxError) {
    return false;
  }
 else   if (textureThreshold > 0) {
    int secondBest=Integer.MAX_VALUE;
    for (int i=0; i < disparity - 1; i++) {
      if (scores[i] < secondBest)       secondBest=scores[i];
    }
    for (int i=disparity + 2; i < maxDisparity; i++) {
      if (scores[i] < secondBest)       secondBest=scores[i];
    }
    if (discretizer * (secondBest - best) <= textureThreshold * best)     return false;
  }
  this.disparity=disparity;
  return true;
}
Program: 151067
Project: 151067
Buggy source:
@Override protected void startEverything(){
  tracker.dropTracks();
  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,0.8);
  T initTran=ConvertTransform_F64.convert(createInitialTransform(),fitModel.createInstance());
  distortAlg.setInitialTransform(initTran);
  totalKeyFrames=0;
  motionRender.clear();
  startWorkerThread();
}
Program: 151068
Project: 151068
Buggy source:
public VideoMosaicSequentialPointApp(Class<I> imageType,Class<D> derivType){
  super(false,imageType,2);
  setOutputSize(1000,600);
  PkltManagerConfig<I,D> config=PkltManagerConfig.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));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_BRIEF(300,200,1,10,imageType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_FH_SURF(300,200,2,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);
  PkltManagerConfig<I,D> config=PkltManagerConfig.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));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_BRIEF(400,150,1,10,2,imageType,null));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_FH_SURF(300,200,2,2,imageType));
  addAlgorithm(1,"String_Node_Str",new Affine2D_F64());
  addAlgorithm(1,"String_Node_Str",new Homography2D_F64());
}
Program: 151069
Project: 151069
Buggy source:
public VideoStabilizeSequentialPointApp(Class<I> imageType,Class<D> derivType){
  super(true,imageType,2);
  PkltManagerConfig<I,D> config=PkltManagerConfig.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));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_BRIEF(300,200,1,10,imageType));
  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(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);
  PkltManagerConfig<I,D> config=PkltManagerConfig.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));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_BRIEF(400,100,1,10,2,imageType,derivType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_FH_SURF(300,200,2,2,imageType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_NCC(500,11,11,10,2,imageType,derivType));
  addAlgorithm(1,"String_Node_Str",new Affine2D_F64());
  addAlgorithm(1,"String_Node_Str",new Homography2D_F64());
}
Program: 151070
Project: 151070
Buggy source:
@Override protected void startEverything(){
  tracker.dropTracks();
  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,largeMotionThreshold);
  totalKeyFrames=0;
  I image=sequence.next();
  setOutputSize(image.width,image.height);
  motionRender.clear();
  startWorkerThread();
}
Program: 151072
Project: 151072
Buggy source:
public void run(){
  guiInfo.setStatus(text,color);
}

Fixed version (ground truth):
public void run(){
  if (view == 0) {
    remove(guiCam3D);
    add(guiRight,BorderLayout.EAST);
  }
 else {
    remove(guiRight);
    add(guiCam3D,BorderLayout.EAST);
  }
  revalidate();
  repaint();
}
Program: 151073
Project: 151073
Buggy source:
public VisualizeStereoVisualOdometryApp(Class<I> imageType){
  super(1,imageType);
  addAlgorithm(0,"String_Node_Str",0);
  addAlgorithm(0,"String_Node_Str",1);
  guiInfo=new VisualOdometryPanel();
  guiImages=new ImageGridPanel(1,2);
  add(guiInfo,BorderLayout.WEST);
  setMainGUI(guiImages);
  guiImages.addMouseListener(this);
}

Fixed version (ground truth):
public VisualizeStereoVisualOdometryApp(Class<I> imageType){
  super(1,imageType);
  addAlgorithm(0,"String_Node_Str",0);
  addAlgorithm(0,"String_Node_Str",1);
  guiInfo=new VisualOdometryPanel();
  guiLeft=new ImagePanel();
  guiRight=new ImagePanel();
  guiCam3D=new Polygon3DSequenceViewer();
  add(guiInfo,BorderLayout.WEST);
  add(guiRight,BorderLayout.EAST);
  setMainGUI(guiLeft);
  guiLeft.addMouseListener(this);
  guiInfo.setListener(this);
}
Program: 151074
Project: 151074
Buggy source:
@Override protected void updateAlgGUI(I frame1,BufferedImage buffImage1,I frame2,BufferedImage buffImage2,final double fps){
  if (!noFault)   numFaults++;
  final Se3_F64 leftToWorld=alg.getLeftToWorld().copy();
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      guiInfo.setCameraToWorld(leftToWorld);
      guiInfo.setNumFaults(numFaults);
      guiInfo.setNumTracks(numTracks);
      guiInfo.setNumInliers(numInliers);
      guiInfo.setFps(fps);
    }
  }
);
  showTracks=guiInfo.isShowAll();
  showInliers=guiInfo.isShowInliers();
  drawFeatures((AccessPointTracks3D)alg,buffImage1);
  guiImages.setImage(0,0,buffImage1);
  guiImages.setImage(0,1,buffImage2);
  guiImages.autoSetPreferredSize();
  hasProcessedImage=true;
}

Fixed version (ground truth):
@Override protected void updateAlgGUI(I frame1,final BufferedImage buffImage1,I frame2,final BufferedImage buffImage2,final double fps){
  if (!noFault)   numFaults++;
  showTracks=guiInfo.isShowAll();
  showInliers=guiInfo.isShowInliers();
  drawFeatures((AccessPointTracks3D)alg,buffImage1);
  final Se3_F64 leftToWorld=alg.getLeftToWorld().copy();
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      guiLeft.setBufferedImage(buffImage1);
      guiRight.setBufferedImage(buffImage2);
      guiLeft.autoSetPreferredSize();
      guiRight.autoSetPreferredSize();
      guiLeft.repaint();
      guiRight.repaint();
      guiInfo.setCameraToWorld(leftToWorld);
      guiInfo.setNumFaults(numFaults);
      guiInfo.setNumTracks(numTracks);
      guiInfo.setNumInliers(numInliers);
      guiInfo.setFps(fps);
    }
  }
);
  double r=config.getBaseline();
  Point3D_F64 p1=new Point3D_F64(-r,-r,0);
  Point3D_F64 p2=new Point3D_F64(r,-r,0);
  Point3D_F64 p3=new Point3D_F64(r,r,0);
  Point3D_F64 p4=new Point3D_F64(-r,r,0);
  SePointOps_F64.transform(leftToWorld,p1,p1);
  SePointOps_F64.transform(leftToWorld,p2,p2);
  SePointOps_F64.transform(leftToWorld,p3,p3);
  SePointOps_F64.transform(leftToWorld,p4,p4);
  guiCam3D.add(p1,p2,p3,p4);
  guiCam3D.repaint();
  hasProcessedImage=true;
}
Program: 151075
Project: 151075
Buggy source:
@Override public void refreshAll(Object[] cookies){
  numFaults=0;
  alg=createStereoDepth(whichAlg == 0);
  alg.setCalibration(config);
  guiInfo.reset();
  handleRunningStatus(2);
  startWorkerThread();
}

Fixed version (ground truth):
@Override public void refreshAll(Object[] cookies){
  numFaults=0;
  alg=createStereoDepth(whichAlg == 0);
  alg.setCalibration(config);
  guiInfo.reset();
  handleRunningStatus(2);
  IntrinsicParameters right=config.right;
  DenseMatrix64F K=PerspectiveOps.calibrationMatrix(config.left,null);
  guiCam3D.clearPolygons();
  guiCam3D.setK(K);
  guiCam3D.setStepSize(config.getBaseline());
  guiCam3D.setPreferredSize(new Dimension(right.width,right.height));
  guiCam3D.setMaximumSize(guiCam3D.getPreferredSize());
  startWorkerThread();
}
Program: 151076
Project: 151076
Buggy source:
private StereoVisualOdometry<I> createStereoDepth(boolean useKlt){
  ImagePointTracker<I> tracker;
  if (useKlt) {
    Class derivType=GImageDerivativeOps.getDerivativeType(imageType);
    tracker=FactoryPointSequentialTracker.klt(600,new int[]{1,2,4,8},3,3,2,imageType,derivType);
  }
 else {
    tracker=FactoryPointSequentialTracker.dda_ShiTomasi_BRIEF(400,200,2,0,imageType);
  }
  StereoDisparitySparse<I> disparity=FactoryStereoDisparity.regionSparseWta(0,150,3,3,30,-1,true,imageType);
  return FactoryVisualOdometry.stereoDepth(120,4,1.5,tracker,disparity,0,imageType);
}

Fixed version (ground truth):
private StereoVisualOdometry<I> createStereoDepth(boolean useKlt){
  ImagePointTracker<I> tracker;
  int thresholdAdd;
  int thresholdRetire;
  if (useKlt) {
    thresholdAdd=120;
    thresholdRetire=2;
    Class derivType=GImageDerivativeOps.getDerivativeType(imageType);
    tracker=FactoryPointSequentialTracker.klt(600,new int[]{1,2,4,8},3,3,2,imageType,derivType);
  }
 else {
    thresholdAdd=80;
    thresholdRetire=3;
    tracker=FactoryPointSequentialTracker.dda_ShiTomasi_BRIEF(600,200,2,0,4,imageType,null);
  }
  StereoDisparitySparse<I> disparity=FactoryStereoDisparity.regionSparseWta(0,150,3,3,30,-1,true,imageType);
  return FactoryVisualOdometry.stereoDepth(thresholdAdd,thresholdRetire,1.5,tracker,disparity,0,imageType);
}
Program: 151077
Project: 151077
Buggy source:
public VideoTrackFeaturesApp(Class<I> imageType,Class<D> derivType){
  super(1,imageType);
  PkltManagerConfig<I,D> config=PkltManagerConfig.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));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_BRIEF(300,200,1,1,imageType));
  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);
  PkltManagerConfig<I,D> config=PkltManagerConfig.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));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_BRIEF(300,200,1,1,2,imageType,derivType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_FH_SURF(300,200,2,2,imageType));
  addAlgorithm(0,"String_Node_Str",FactoryPointSequentialTracker.dda_ShiTomasi_NCC(500,5,5,20,2,imageType,derivType));
  gui.addMouseListener(this);
  gui.requestFocus();
  setMainGUI(gui);
}
Program: 151078
Project: 151078
Buggy source:
@Override public void changeInput(String name,int index){
  stopWorker();
  Reader r=media.openFile(inputRefs.get(index).getPath());
  BufferedReader in=new BufferedReader(r);
  try {
    String lineConfig=in.readLine();
    String line1=in.readLine();
    String line2=in.readLine();
    config=BoofMiscOps.loadXML(media.openFile(lineConfig));
    SimpleImageSequence<I> video1=media.openVideo(line1,imageType);
    SimpleImageSequence<I> video2=media.openVideo(line2,imageType);
    process(video1,video2);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Override public void changeInput(String name,int index){
  stopWorker();
  Reader r=media.openFile(inputRefs.get(index).getPath());
  BufferedReader in=new BufferedReader(r);
  try {
    String path=new File(inputRefs.get(index).getPath()).getParent();
    String lineConfig=path + "String_Node_Str" + in.readLine();
    String line1=path + "String_Node_Str" + in.readLine();
    String line2=path + "String_Node_Str" + in.readLine();
    config=BoofMiscOps.loadXML(media.openFile(lineConfig));
    SimpleImageSequence<I> video1=media.openVideo(line1,imageType);
    SimpleImageSequence<I> video2=media.openVideo(line2,imageType);
    process(video1,video2);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 151079
Project: 151079
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,80,3,4,imageType);
}
Program: 151080
Project: 151080
Buggy source:
@Override public void associate(FastQueue<SurfFeature> listSrc,FastQueue<SurfFeature> listDst){
  alg.setSrc(listSrc);
  alg.setDst(listDst);
}

Fixed version (ground truth):
@Override public void associate(FastQueue<SurfFeature> listSrc,FastQueue<SurfFeature> listDst){
  alg.setSrc(listSrc);
  alg.setDst(listDst);
  alg.associate();
}
Program: 151081
Project: 151081
Buggy source:
/** 
 * @param radius Radius of the region being considered in terms of samples. Typically 6.
 * @param period How often the image is sampled.  This number is scaled.  Typically 1.   
 * @param sampleWidth How wide of a kernel should be used to sample.
 * @param weightSigma Sigma for weighting.  zero for unweighted.
 */
public OrientationIntegralBase(int radius,double period,int sampleWidth,double weightSigma,Class<T> imageType){
  this.radius=radius;
  this.period=period;
  this.sampleWidth=sampleWidth;
  this.width=radius * 2 + 1;
  this.imageType=imageType;
  if (weightSigma != 0)   this.weights=FactoryKernelGaussian.gaussian(2,true,64,weightSigma,radius);
  g=(SparseScaleGradient<T,G>)SurfDescribeOps.createGradient(false,sampleWidth,imageType);
}

Fixed version (ground truth):
/** 
 * Configure orientation estimation.
 * @param radius Radius of the region being considered in terms of samples. Typically 6.
 * @param period How often the image is sampled.  This number is scaled.  Typically 1.   
 * @param sampleWidth How wide of a kernel should be used to sample. Try 4
 * @param weightSigma Sigma for weighting.  zero for unweighted.
 */
public OrientationIntegralBase(int radius,double period,int sampleWidth,double weightSigma,Class<T> imageType){
  this.radius=radius;
  this.period=period;
  this.sampleWidth=sampleWidth;
  this.width=radius * 2 + 1;
  this.imageType=imageType;
  if (weightSigma != 0)   this.weights=FactoryKernelGaussian.gaussian(2,true,64,weightSigma,radius);
  g=(SparseScaleGradient<T,G>)SurfDescribeOps.createGradient(false,sampleWidth,imageType);
}
Program: 151082
Project: 151082
Buggy source:
protected double computeUnweighted(double tl_x,double tl_y,double samplePeriod){
  tl_x+=0.5;
  tl_y+=0.5;
  double Dx=0, Dy=0;
  int i=0;
  for (int y=0; y < width; y++) {
    int pixelY=(int)(tl_y + y * samplePeriod);
    for (int x=0; x < width; x++, i++) {
      int pixelX=(int)(tl_x + x * samplePeriod);
      if (sampler.isInBounds(pixelX,pixelY)) {
        double val=sampler.compute(pixelX,pixelY);
        Dx+=kerCosine.data[i] * val;
        Dy+=kerSine.data[i] * val;
      }
    }
  }
  return Math.atan2(Dy,Dx);
}

Fixed version (ground truth):
protected double computeUnweighted(double tl_x,double tl_y,double samplePeriod){
  tl_x+=0.5;
  tl_y+=0.5;
  double Dx=0, Dy=0;
  int i=0;
  for (int y=0; y < width; y++) {
    int pixelY=(int)(tl_y + y * samplePeriod);
    for (int x=0; x < width; x++, i++) {
      int pixelX=(int)(tl_x + x * samplePeriod);
      if (sampler.isInBounds(pixelX,pixelY)) {
        try {
          double val=sampler.compute(pixelX,pixelY);
          Dx+=kerCosine.data[i] * val;
          Dy+=kerSine.data[i] * val;
        }
 catch (        RuntimeException e) {
          sampler.isInBounds(pixelX,pixelY);
          sampler.compute(pixelX,pixelY);
          throw e;
        }
      }
    }
  }
  return Math.atan2(Dy,Dx);
}
Program: 151083
Project: 151083
Buggy source:
public static <T extends ImageSingleBand>OrientationIntegral<T> image_ii(int radius,double samplePeriod,int sampleWidth,double weightSigma,Class<T> imageType){
  return (OrientationIntegral<T>)new ImplOrientationImageAverageIntegral(radius,samplePeriod,sampleWidth,weightSigma,imageType);
}

Fixed version (ground truth):
/** 
 * Estimates the orientation without calculating the image derivative.
 * @see ImplOrientationImageAverageIntegral
 * @param radius Radius of the region being considered in terms of samples. Typically 6.
 * @param samplePeriod How often the image is sampled.  This number is scaled.  Typically 1.
 * @param sampleWidth How wide of a kernel should be used to sample. Try 4
 * @param weightSigma Sigma for weighting.  zero for unweighted.
 * @param imageType Type of image being processed.
 * @return OrientationIntegral
 */
public static <T extends ImageSingleBand>OrientationIntegral<T> image_ii(int radius,double samplePeriod,int sampleWidth,double weightSigma,Class<T> imageType){
  return (OrientationIntegral<T>)new ImplOrientationImageAverageIntegral(radius,samplePeriod,sampleWidth,weightSigma,imageType);
}
Program: 151084
Project: 151084
Buggy source:
@Test public void With_Orientation(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
@Test public void With_Orientation(){
  WrapFHtoInterestPoint alg=new WrapFHtoInterestPoint(detector,orientation);
  new GeneralInterestPointDetectorChecks(alg,true,true,ImageUInt8.class).performAllTests();
}
Program: 151085
Project: 151085
Buggy source:
@Test public void NO_Orientation(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
@Test public void NO_Orientation(){
  WrapFHtoInterestPoint alg=new WrapFHtoInterestPoint(detector);
  new GeneralInterestPointDetectorChecks(alg,false,true,ImageUInt8.class).performAllTests();
}
Program: 151087
Project: 151087
Buggy source:
@Override public void setScale(double scale){
  super.setScale(scale);
  x0=-r - 1;
  y0=-r - 1;
  x1=r + 1;
  y1=r + 1;
}

Fixed version (ground truth):
@Override public void setScale(double scale){
  super.setScale(scale);
  x0=y0=-r - 1;
  x1=y1=r;
}
Program: 151088
Project: 151088
Buggy source:
@Override public void setScale(double scale){
  super.setScale(scale);
  x0=-r - 1;
  y0=-r - 1;
  x1=r + 1;
  y1=r + 1;
}

Fixed version (ground truth):
@Override public void setScale(double scale){
  super.setScale(scale);
  x0=y0=-r - 1;
  x1=y1=r;
}
Program: 151089
Project: 151089
Buggy source:
@Override public void setScale(double scale){
  super.setScale(scale);
  w=2 * r;
  x0=-r;
  y0=-r;
  x1=r + 1;
  y1=r + 1;
}

Fixed version (ground truth):
@Override public void setScale(double scale){
  super.setScale(scale);
  w=2 * r;
  x0=y0=-r;
  x1=y1=r;
}
Program: 151090
Project: 151090
Buggy source:
@Override public void setScale(double scale){
  super.setScale(scale);
  w=2 * r;
  x0=-r;
  y0=-r;
  x1=r + 1;
  y1=r + 1;
}

Fixed version (ground truth):
@Override public void setScale(double scale){
  super.setScale(scale);
  w=2 * r;
  x0=y0=-r;
  x1=y1=r;
}
Program: 151091
Project: 151091
Buggy source:
@Override public double compute(int x,int y){
  return IntegralImageOps.block_unsafe(input,x + x0,y + y0,x + x1 - 1,y + y1 - 1);
}

Fixed version (ground truth):
@Override public double compute(int x,int y){
  return IntegralImageOps.block_unsafe(input,x + x0,y + y0,x + x1,y + y1);
}
Program: 151092
Project: 151092
Buggy source:
@Override public void setScale(double scale){
  r=(int)(baseR * scale + 0.5);
  if (r <= 0)   r=1;
  x0=y0=-r - 1;
  x1=y1=r + 1;
}

Fixed version (ground truth):
@Override public void setScale(double scale){
  r=(int)(baseR * scale + 0.5);
  if (r <= 0)   r=1;
  x0=y0=-r - 1;
  x1=y1=r;
}
Program: 151093
Project: 151093
Buggy source:
@Override public boolean isInBounds(int x,int y){
  return (x + x0 >= 0 && y + y0 >= 0 && x + x1 <= input.width && y + y1 <= input.height);
}

Fixed version (ground truth):
@Override public boolean isInBounds(int x,int y){
  return (x + x0 >= 0 && y + y0 >= 0 && x + x1 < input.width && y + y1 < input.height);
}
Program: 151096
Project: 151096
Buggy source:
public static void main(String args[]){
  String dir="String_Node_Str";
  BufferedImage imageA=UtilImageIO.loadImage(dir + "String_Node_Str");
  BufferedImage imageB=UtilImageIO.loadImage(dir + "String_Node_Str");
  List<AssociatedPair> matches=ExampleFundamentalMatrix.computeMatches(imageA,imageB);
  for (  AssociatedPair p : matches) {
    p.currLoc.y=imageA.getHeight() - p.currLoc.y - 1;
    p.keyLoc.y=imageA.getHeight() - p.keyLoc.y - 1;
  }
  List<AssociatedPair> inliers=new ArrayList<AssociatedPair>();
  DenseMatrix64F F=ExampleFundamentalMatrix.robustFundamental(matches,inliers);
  for (  AssociatedPair p : inliers) {
    p.currLoc.y=imageA.getHeight() - p.currLoc.y - 1;
    p.keyLoc.y=imageA.getHeight() - p.keyLoc.y - 1;
  }
  rectify(F,inliers,imageA,imageB);
}

Fixed version (ground truth):
public static void main(String args[]){
  String dir="String_Node_Str";
  BufferedImage imageA=UtilImageIO.loadImage(dir + "String_Node_Str");
  BufferedImage imageB=UtilImageIO.loadImage(dir + "String_Node_Str");
  List<AssociatedPair> matches=ExampleFundamentalMatrix.computeMatches(imageA,imageB);
  for (  AssociatedPair p : matches) {
    p.currLoc.y=imageA.getHeight() - p.currLoc.y - 1;
    p.keyLoc.y=imageA.getHeight() - p.keyLoc.y - 1;
  }
  List<AssociatedPair> inliers=new ArrayList<AssociatedPair>();
  DenseMatrix64F F=ExampleFundamentalMatrix.robustFundamental(matches,inliers);
  rectify(F,inliers,imageA,imageB);
}
Program: 151097
Project: 151097
Buggy source:
@Override public void process(){
  alg.process(initialF,pairs);
  alg.getRefinement();
}

Fixed version (ground truth):
@Override public void process(){
  alg.process(list);
  alg.getEpipolarMatrix();
}
Program: 151098
Project: 151098
Buggy source:
@Override public String getName(){
  return alg.getClass().getSimpleName();
}

Fixed version (ground truth):
@Override public String getName(){
  return name;
}
Program: 151099
Project: 151099
Buggy source:
public void runAll(){
  System.out.println("String_Node_Str" + NUM_POINTS);
  System.out.println();
  double tol=1e-16;
  int MAX_ITER=100;
  init(NUM_POINTS,FUNDAMENTAL,false);
  EpipolarMatrixEstimator computeAlg=FactoryEpipolar.computeFundamental(FUNDAMENTAL,8);
  computeAlg.process(pairs);
  initialF=computeAlg.getEpipolarMatrix();
  ProfileOperation.printOpsPerSec(new Refine("String_Node_Str",refineFundamental(tol,MAX_ITER,EpipolarError.SAMPSON)),TEST_TIME);
  ProfileOperation.printOpsPerSec(new Refine("String_Node_Str",refineFundamental(tol,MAX_ITER,EpipolarError.SIMPLE)),TEST_TIME);
  ProfileOperation.printOpsPerSec(new Refine("String_Node_Str",new QuasiNewtonFundamentalSampson(tol,MAX_ITER)),TEST_TIME);
  System.out.println();
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public void runAll(){
  System.out.println("String_Node_Str" + NUM_POINTS);
  System.out.println();
  double tol=1e-16;
  int MAX_ITER=100;
  init(NUM_POINTS,FUNDAMENTAL,false);
  EpipolarMatrixEstimator computeAlg=FactoryEpipolar.computeFundamental(FUNDAMENTAL,8);
  computeAlg.process(pairs);
  initialF=computeAlg.getEpipolarMatrix();
  initialF.data[0]+=0.1;
  initialF.data[4]-=0.15;
  initialF.data[7]-=0.2;
  ProfileOperation.printOpsPerSec(new Refine("String_Node_Str",refineFundamental(tol,MAX_ITER,EpipolarError.SAMPSON)),TEST_TIME);
  ProfileOperation.printOpsPerSec(new Refine("String_Node_Str",refineFundamental(tol,MAX_ITER,EpipolarError.SIMPLE)),TEST_TIME);
  ProfileOperation.printOpsPerSec(new Refine("String_Node_Str",new QuasiNewtonFundamentalSampson(tol,MAX_ITER)),TEST_TIME);
  System.out.println();
  System.out.println("String_Node_Str");
}
Program: 151100
Project: 151100
Buggy source:
@Override public void process(){
  alg.process(initialF,pairs);
  alg.getRefinement();
}

Fixed version (ground truth):
@Override public void process(){
  alg.process(pairs);
}