use of boofcv.alg.feature.detect.edge.EdgeContour in project BoofCV by lessthanoptimal.
the class VisualizeBinaryData method renderContours.
public static BufferedImage renderContours(List<EdgeContour> edges, int[] colors, int width, int height, BufferedImage out) {
if (out == null) {
out = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
} else {
Graphics2D g2 = out.createGraphics();
g2.setColor(Color.BLACK);
g2.fillRect(0, 0, width, height);
}
colors = checkColors(colors, edges.size());
for (int i = 0; i < edges.size(); i++) {
EdgeContour e = edges.get(i);
int color = colors[i];
for (EdgeSegment s : e.segments) {
for (Point2D_I32 p : s.points) {
out.setRGB(p.x, p.y, color);
}
}
}
return out;
}
Aggregations