Program: 150645
Project: 150645
Buggy source:
@Override protected void paintInPanel(AffineTransform tran,Graphics2D g2){
  DetectBlackPolygonAppControlPanel controls=(DetectBlackPolygonAppControlPanel)DetectBlackPolygonApp.this.controls;
  g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,RenderingHints.VALUE_STROKE_PURE);
  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
synchronized (DetectBlackPolygonApp.this) {
    if (controls.bShowContour) {
      g2.setStroke(new BasicStroke(1));
      LinearContourLabelChang2004 contour=detector.getDetector().getContourFinder();
      List<Contour> contours=BinaryImageOps.convertContours(contour.getPackedPoints(),contour.getContours());
      VisualizeBinaryData.render(contours,null,Color.CYAN,scale,g2);
    }
    if (controls.bShowLines) {
      List<Polygon2D_F64> polygons=detector.getPolygons(null);
      g2.setColor(Color.RED);
      g2.setStroke(new BasicStroke(3));
      for (      Polygon2D_F64 p : polygons) {
        int red=255 * ((p.size() - 3) % 4) / 3;
        int green=255 * ((p.size()) % 5) / 4;
        int blue=255 * ((p.size() + 2) % 6) / 5;
        g2.setColor(new Color(red,green,blue));
        VisualizeShapes.drawPolygon(p,true,scale,g2);
      }
    }
    if (controls.bShowCorners) {
      List<Polygon2D_F64> polygons=detector.getPolygons(null);
      g2.setColor(Color.BLUE);
      g2.setStroke(new BasicStroke(1));
      for (      Polygon2D_F64 p : polygons) {
        for (int i=0; i < p.size(); i++) {
          Point2D_F64 c=p.get(i);
          VisualizeFeatures.drawCircle(g2,scale * c.x,scale * c.y,5);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void paintInPanel(AffineTransform tran,Graphics2D g2){
  DetectBlackPolygonAppControlPanel controls=(DetectBlackPolygonAppControlPanel)DetectBlackPolygonApp.this.controls;
  g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,RenderingHints.VALUE_STROKE_PURE);
  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
synchronized (DetectBlackPolygonApp.this) {
    if (controls.bShowContour) {
      g2.setStroke(new BasicStroke(1));
      LinearContourLabelChang2004 contour=detector.getDetector().getContourFinder();
      List<Contour> contours=BinaryImageOps.convertContours(contour.getPackedPoints(),contour.getContours());
      VisualizeBinaryData.render(contours,null,Color.CYAN,scale,g2);
    }
    if (controls.bShowLines) {
      List<Polygon2D_F64> polygons=detector.getPolygons(null,null);
      g2.setColor(Color.RED);
      g2.setStroke(new BasicStroke(3));
      for (      Polygon2D_F64 p : polygons) {
        int red=255 * ((p.size() - 3) % 4) / 3;
        int green=255 * ((p.size()) % 5) / 4;
        int blue=255 * ((p.size() + 2) % 6) / 5;
        g2.setColor(new Color(red,green,blue));
        VisualizeShapes.drawPolygon(p,true,scale,g2);
      }
    }
    if (controls.bShowCorners) {
      List<Polygon2D_F64> polygons=detector.getPolygons(null,null);
      g2.setColor(Color.BLUE);
      g2.setStroke(new BasicStroke(1));
      for (      Polygon2D_F64 p : polygons) {
        for (int i=0; i < p.size(); i++) {
          Point2D_F64 c=p.get(i);
          VisualizeFeatures.drawCircle(g2,scale * c.x,scale * c.y,5);
        }
      }
    }
  }
}