Program: 150782
Project: 150782
Buggy source:
public EquirectangularPinholeApp(List<?> exampleInputs,ImageType<T> imageType){
  super(exampleInputs,imageType);
  updateIntrinsic();
  distorter.setPinhole(cameraModel);
  BorderType borderType=BorderType.EXTENDED;
  InterpolatePixel<T> interp=FactoryInterpolation.createPixel(0,255,TypeInterpolate.BILINEAR,borderType,imageType);
  distortImage=FactoryDistort.distort(true,interp,imageType);
  distortImage.setRenderAll(true);
  equi=imageType.createImage(1,1);
  pinhole=imageType.createImage(camWidth,camHeight);
  buffPinhole=new BufferedImage(camWidth,camHeight,BufferedImage.TYPE_INT_BGR);
  panelPinhole.setPreferredSize(new Dimension(camWidth,camHeight));
  panelPinhole.setBufferedImage(buffEqui);
  panelPinhole.addKeyListener(new KeyAdapter(){
    @Override public void keyPressed(    KeyEvent e){
      double pitch=0;
      double yaw=0;
      double roll=0;
switch (e.getKeyCode()) {
case KeyEvent.VK_W:
        pitch+=0.01;
      break;
case KeyEvent.VK_S:
    pitch-=0.01;
  break;
case KeyEvent.VK_A:
yaw-=0.01;
break;
case KeyEvent.VK_D:
yaw+=0.01;
break;
case KeyEvent.VK_Q:
roll-=0.01;
break;
case KeyEvent.VK_E:
roll+=0.01;
break;
default :
return;
}
DenseMatrix64F R=ConvertRotation3D_F64.eulerToMatrix(EulerType.YZX,yaw,roll,pitch,null);
DenseMatrix64F tmp=distorter.getRotation().copy();
CommonOps.mult(tmp,R,distorter.getRotation());
distortImage.setModel(distorter);
if (inputMethod == InputMethod.IMAGE) {
rerenderPinhole();
}
}
}
);
panelEqui.addMouseListener(new MouseAdapter(){
@Override public void mouseClicked(MouseEvent e){
Point2D_F32 latlon=new Point2D_F32();
double scale=panelEqui.scale;
int x=(int)(e.getX() / scale);
int y=(int)(e.getY() / scale);
if (!equi.isInBounds(x,y)) return;
distorter.getTools().equiToLonlat(x,y,latlon);
distorter.setDirection(latlon.x,latlon.y,0);
DenseMatrix64F A=ConvertRotation3D_F64.eulerToMatrix(EulerType.YZX,Math.PI / 2,0,-Math.PI / 2,null);
DenseMatrix64F tmp=distorter.getRotation().copy();
CommonOps.mult(tmp,A,distorter.getRotation());
distortImage.setModel(distorter);
if (inputMethod == InputMethod.IMAGE) {
rerenderPinhole();
}
}
}
);
panelPinhole.setFocusable(true);
panelPinhole.grabFocus();
add(panelPinhole,BorderLayout.CENTER);
add(panelEqui,BorderLayout.SOUTH);
}

Fixed version (ground truth):
public EquirectangularPinholeApp(List<?> exampleInputs,ImageType<T> imageType){
  super(exampleInputs,imageType);
  updateIntrinsic();
  distorter.setPinhole(cameraModel);
  BorderType borderType=BorderType.EXTENDED;
  InterpolatePixel<T> interp=FactoryInterpolation.createPixel(0,255,TypeInterpolate.BILINEAR,borderType,imageType);
  distortImage=FactoryDistort.distort(true,interp,imageType);
  distortImage.setRenderAll(true);
  equi=imageType.createImage(1,1);
  pinhole=imageType.createImage(camWidth,camHeight);
  buffPinhole=new BufferedImage(camWidth,camHeight,BufferedImage.TYPE_INT_BGR);
  panelPinhole.setPreferredSize(new Dimension(camWidth,camHeight));
  panelPinhole.setBufferedImage(buffEqui);
  panelPinhole.addKeyListener(new KeyAdapter(){
    @Override public void keyPressed(    KeyEvent e){
      double pitch=0;
      double yaw=0;
      double roll=0;
switch (e.getKeyCode()) {
case KeyEvent.VK_W:
        pitch+=0.01;
      break;
case KeyEvent.VK_S:
    pitch-=0.01;
  break;
case KeyEvent.VK_A:
yaw-=0.01;
break;
case KeyEvent.VK_D:
yaw+=0.01;
break;
case KeyEvent.VK_Q:
roll-=0.01;
break;
case KeyEvent.VK_E:
roll+=0.01;
break;
default :
return;
}
DenseMatrix64F R=ConvertRotation3D_F64.eulerToMatrix(EulerType.YZX,yaw,roll,pitch,null);
DenseMatrix64F tmp=distorter.getRotation().copy();
CommonOps.mult(tmp,R,distorter.getRotation());
distortImage.setModel(distorter);
if (inputMethod == InputMethod.IMAGE) {
rerenderPinhole();
}
}
}
);
panelEqui.addMouseListener(new MouseAdapter(){
@Override public void mouseClicked(MouseEvent e){
Point2D_F32 latlon=new Point2D_F32();
double scale=panelEqui.scale;
int x=(int)(e.getX() / scale);
int y=(int)(e.getY() / scale);
if (!equi.isInBounds(x,y)) return;
distorter.getTools().equiToLonlatFV(x,y,latlon);
distorter.setDirection(latlon.x,latlon.y,0);
DenseMatrix64F A=ConvertRotation3D_F64.eulerToMatrix(EulerType.YZX,Math.PI / 2,0,Math.PI / 2,null);
DenseMatrix64F tmp=distorter.getRotation().copy();
CommonOps.mult(tmp,A,distorter.getRotation());
distortImage.setModel(distorter);
if (inputMethod == InputMethod.IMAGE) {
rerenderPinhole();
}
}
}
);
panelPinhole.setFocusable(true);
panelPinhole.grabFocus();
add(panelPinhole,BorderLayout.CENTER);
add(panelEqui,BorderLayout.SOUTH);
}