use of georegression.struct.point.Point2D_F64 in project BoofCV by lessthanoptimal.
the class DetectPointScaleOriWithNoiseApp method setActiveAlgorithm.
@Override
public synchronized void setActiveAlgorithm(int indexFamily, String name, Object cookie) {
if (input == null)
return;
// corrupt the input image
corruptPanel.corruptImage(grayImage, corruptImage);
final InterestPointDetector<T> det = (InterestPointDetector<T>) cookie;
det.detect(corruptImage);
render.reset();
for (int i = 0; i < det.getNumberOfFeatures(); i++) {
Point2D_F64 p = det.getLocation(i);
int radius = (int) Math.ceil(det.getRadius(i));
render.addCircle((int) p.x, (int) p.y, radius);
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
ConvertBufferedImage.convertTo(corruptImage, workImage, true);
Graphics2D g2 = workImage.createGraphics();
g2.setStroke(new BasicStroke(3));
render.draw(g2);
panel.repaint();
}
});
}
use of georegression.struct.point.Point2D_F64 in project BoofCV by lessthanoptimal.
the class VisualizeHoughPolar method process.
public void process(BufferedImage image) {
I input = GeneralizedImageOps.createSingleBand(imageType, image.getWidth(), image.getHeight());
I blur = GeneralizedImageOps.createSingleBand(imageType, image.getWidth(), image.getHeight());
ConvertBufferedImage.convertFromSingle(image, input, imageType);
GBlurImageOps.gaussian(input, blur, -1, 2, null);
DetectLineHoughPolar<I, D> alg = FactoryDetectLineAlgs.houghPolar(new ConfigHoughPolar(5, 10, 2, Math.PI / 180, 25, 10), imageType, derivType);
List<LineParametric2D_F32> lines = alg.detect(blur);
ImageLinePanel gui = new ImageLinePanel();
gui.setBackground(image);
gui.setLines(lines);
gui.setPreferredSize(new Dimension(image.getWidth(), image.getHeight()));
BufferedImage renderedTran = VisualizeImageData.grayMagnitude(alg.getTransform().getTransform(), null, -1);
BufferedImage renderedBinary = VisualizeBinaryData.renderBinary(alg.getBinary(), false, null);
// Draw the location of lines onto the magnitude image
Graphics2D g2 = renderedTran.createGraphics();
g2.setColor(Color.RED);
Point2D_F64 location = new Point2D_F64();
for (LineParametric2D_F32 l : lines) {
alg.getTransform().lineToCoordinate(l, location);
int r = 6;
int w = r * 2 + 1;
int x = (int) (location.x + 0.5);
int y = (int) (location.y + 0.5);
// System.out.println(x+" "+y+" "+renderedTran.getWidth()+" "+renderedTran.getHeight());
g2.drawOval(x - r, y - r, w, w);
}
ShowImages.showWindow(renderedBinary, "Detected Edges");
ShowImages.showWindow(renderedTran, "Parameter Space");
ShowImages.showWindow(gui, "Detected Lines");
}
use of georegression.struct.point.Point2D_F64 in project BoofCV by lessthanoptimal.
the class DdaManagerGeneralPoint method detectFeatures.
@Override
public void detectFeatures(I input, FastQueue<Point2D_F64> locDst, FastQueue<Desc> featDst) {
// detect features in the image
detector.detect(input, null);
describe.setImage(input);
QueueCorner found = detector.getMaximums();
// compute descriptors and populate results list
descriptors.reset();
locations.reset();
for (int i = 0; i < found.size; i++) {
Point2D_I16 p = found.get(i);
Desc desc = descriptors.grow();
if (describe.process(p.x, p.y, 0, scale, desc)) {
Point2D_F64 loc = locations.grow();
loc.set(p.x, p.y);
describe.process(loc.x, loc.y, 0, scale, desc);
featDst.add(desc);
locDst.add(loc);
} else {
descriptors.removeTail();
}
}
}
use of georegression.struct.point.Point2D_F64 in project BoofCV by lessthanoptimal.
the class DetectDescribeAssociate method updateTrackState.
/**
* Update each track's location and description (if configured to do so) mark tracks as being associated.
*/
protected void updateTrackState(FastQueue<AssociatedIndex> matches) {
// update tracks
for (int i = 0; i < matches.size; i++) {
AssociatedIndex indexes = matches.data[i];
PointTrack track = tracksAll.get(indexes.src);
Point2D_F64 loc = locDst.data[indexes.dst];
track.set(loc.x, loc.y);
tracksActive.add(track);
// update the description
if (updateDescription) {
((Desc) track.getDescription()).setTo(featDst.get(indexes.dst));
}
isAssociated[indexes.src] = true;
}
}
use of georegression.struct.point.Point2D_F64 in project BoofCV by lessthanoptimal.
the class DetectDescribeAssociateTwoPass method updateTrackLocation.
/**
* Update each track's location only and not its description. Update the active list too
*/
protected void updateTrackLocation(FastQueue<AssociatedIndex> matches) {
tracksActive.clear();
for (int i = 0; i < matches.size; i++) {
AssociatedIndex indexes = matches.data[i];
PointTrack track = tracksAll.get(indexes.src);
Point2D_F64 loc = locDst.data[indexes.dst];
track.set(loc.x, loc.y);
tracksActive.add(track);
}
this.matches = matches;
}
Aggregations