use of georegression.struct.point.Point2D_F64 in project BoofCV by lessthanoptimal.
the class VisOdomQuadPnP method removeUnused.
private void removeUnused(FastQueue<Point2D_F64> loc, FastQueue<TD> desc, boolean[] used, int[] oldToNew) {
int count = 0;
for (int i = 0; i < loc.size; i++) {
if (used[i]) {
oldToNew[i] = count;
if (count != i) {
Point2D_F64 a = loc.data[count];
loc.data[count] = loc.data[i];
loc.data[i] = a;
TD d = desc.data[count];
desc.data[count] = desc.data[i];
desc.data[i] = d;
}
count++;
} else {
oldToNew[i] = -1;
}
}
loc.size = desc.size = count;
}
use of georegression.struct.point.Point2D_F64 in project BoofCV by lessthanoptimal.
the class CommonDetectCalibrationApp method renderGraph.
protected void renderGraph(Graphics2D g2, double scale) {
List<List<SquareNode>> graphs = getClusters();
BasicStroke strokeWide = new BasicStroke(3);
BasicStroke strokeNarrow = new BasicStroke(2);
Line2D.Double l = new Line2D.Double();
g2.setStroke(new BasicStroke(3));
for (int i = 0; i < graphs.size(); i++) {
List<SquareNode> graph = graphs.get(i);
int key = graphs.size() == 1 ? 0 : 255 * i / (graphs.size() - 1);
int rgb = key << 8 | (255 - key);
g2.setColor(new Color(rgb));
List<SquareEdge> edges = new ArrayList<>();
for (SquareNode n : graph) {
for (int j = 0; j < n.edges.length; j++) {
if (n.edges[j] != null && !edges.contains(n.edges[j])) {
edges.add(n.edges[j]);
}
}
}
for (SquareEdge e : edges) {
Point2D_F64 a = e.a.center;
Point2D_F64 b = e.b.center;
l.setLine(a.x * scale, a.y * scale, b.x * scale, b.y * scale);
g2.setColor(Color.CYAN);
g2.setStroke(strokeWide);
g2.draw(l);
g2.setColor(new Color(rgb));
g2.setStroke(strokeNarrow);
g2.draw(l);
}
}
}
use of georegression.struct.point.Point2D_F64 in project BoofCV by lessthanoptimal.
the class CommonDetectCalibrationApp method drawPolygon.
public static void drawPolygon(Polygon2D_F64 polygon, Graphics2D g2, double scale) {
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Line2D.Double l = new Line2D.Double();
for (int i = 0; i < polygon.size() - 1; i++) {
Point2D_F64 p0 = polygon.get(i);
Point2D_F64 p1 = polygon.get(i + 1);
drawLine(g2, l, p0.x * scale, p0.y * scale, p1.x * scale, p1.y * scale);
}
if (polygon.size() > 0) {
Point2D_F64 p0 = polygon.get(0);
Point2D_F64 p1 = polygon.get(polygon.size() - 1);
drawLine(g2, l, p0.x * scale, p0.y * scale, p1.x * scale, p1.y * scale);
}
}
use of georegression.struct.point.Point2D_F64 in project BoofCV by lessthanoptimal.
the class VideoDetectInterestPoints method updateGUI.
@Override
public void updateGUI(BufferedImage guiImage, T origImage) {
Graphics2D g2 = guiImage.createGraphics();
if (orientation != null)
orientation.setImage(origImage);
render.reset();
for (int i = 0; i < detector.getNumberOfFeatures(); i++) {
Point2D_F64 pt = detector.getLocation(i);
int radius = (int) Math.round(detector.getRadius(i));
if (orientation != null) {
orientation.setObjectRadius(radius);
double angle = orientation.compute(pt.x, pt.y);
render.addCircle((int) pt.x, (int) pt.y, radius, Color.red, angle);
} else {
render.addCircle((int) pt.x, (int) pt.y, radius);
}
}
render.draw(g2);
if (panel == null) {
panel = ShowImages.showWindow(guiImage, "Image Sequence", true);
addComponent(panel);
} else {
panel.setImage(guiImage);
panel.repaint();
}
}
use of georegression.struct.point.Point2D_F64 in project BoofCV by lessthanoptimal.
the class CompareConvertedDescriptionsApp method visualize.
public static <TD extends TupleDesc> void visualize(String title, BufferedImage image1, BufferedImage image2, InterestPointDetector<GrayF32> detector, DescribeRegionPoint<GrayF32, TD> describe, ScoreAssociation<TD> scorer) {
AssociateDescription<TD> assoc = FactoryAssociation.greedy(scorer, Double.MAX_VALUE, false);
List<Point2D_F64> locationSrc = new ArrayList<>();
List<Point2D_F64> locationDst = new ArrayList<>();
GrayF32 input1 = ConvertBufferedImage.convertFrom(image1, (GrayF32) null);
GrayF32 input2 = ConvertBufferedImage.convertFrom(image2, (GrayF32) null);
FastQueue<TD> listSrc = describeImage(input1, detector, describe, locationSrc);
FastQueue<TD> listDst = describeImage(input2, detector, describe, locationDst);
assoc.setSource(listSrc);
assoc.setDestination(listDst);
assoc.associate();
FastQueue<AssociatedIndex> matches = assoc.getMatches();
AssociationPanel panel = new AssociationPanel(20);
panel.setImages(image1, image2);
panel.setAssociation(locationSrc, locationDst, matches);
ShowImages.showWindow(panel, title);
}
Aggregations