use of georegression.struct.point.Point2D_I16 in project BoofCV by lessthanoptimal.
the class GeneralToInterestMulti method detect.
@Override
public void detect(T input) {
foundMin.reset();
foundMax.reset();
detector.detect(input, null);
QueueCorner min = detector.getMinimums();
for (int i = 0; i < min.size; i++) {
Point2D_I16 p = min.get(i);
foundMin.grow().set(p.x, p.y);
}
QueueCorner max = detector.getMaximums();
for (int i = 0; i < max.size; i++) {
Point2D_I16 p = max.get(i);
foundMax.grow().set(p.x, p.y);
}
}
use of georegression.struct.point.Point2D_I16 in project BoofCV by lessthanoptimal.
the class CompareFeatureExtractorApp method doProcess.
private synchronized void doProcess() {
// System.out.println("radius "+radius+" min separation "+minSeparation+" thresholdFraction "+thresholdFraction+" numFeatures "+numFeatures);
deriv.setInput(grayImage);
D derivX = deriv.getDerivative(true);
D derivY = deriv.getDerivative(false);
D derivXX = deriv.getDerivative(true, true);
D derivYY = deriv.getDerivative(false, false);
D derivXY = deriv.getDerivative(true, false);
// todo modifying buffered images which might be actively being displayed, could mess up swing
intensityAlg.process(grayImage, derivX, derivY, derivXX, derivYY, derivXY);
GrayF32 intensity = intensityAlg.getIntensity();
intensityImage = VisualizeImageData.colorizeSign(intensityAlg.getIntensity(), null, ImageStatistics.maxAbs(intensity));
float max = ImageStatistics.maxAbs(intensity);
float threshold = max * thresholdFraction;
NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax(new ConfigExtract(minSeparation, threshold, radius, true));
GeneralFeatureDetector<T, D> detector = new GeneralFeatureDetector<>(intensityAlg, extractor);
detector.setMaxFeatures(numFeatures);
detector.process(grayImage, derivX, derivY, derivXX, derivYY, derivXY);
QueueCorner foundCorners = detector.getMaximums();
render.reset();
for (int i = 0; i < foundCorners.size(); i++) {
Point2D_I16 p = foundCorners.get(i);
render.addPoint(p.x, p.y, 3, Color.RED);
}
Graphics2D g2 = workImage.createGraphics();
g2.drawImage(input, 0, 0, grayImage.width, grayImage.height, null);
render.draw(g2);
drawImage();
}
use of georegression.struct.point.Point2D_I16 in project BoofCV by lessthanoptimal.
the class DetectPointsWithNoiseApp 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 EasyGeneralFeatureDetector<T, D> det = (EasyGeneralFeatureDetector<T, D>) cookie;
det.detect(corruptImage, null);
render.reset();
if (det.getDetector().isDetectMinimums()) {
QueueCorner l = det.getMinimums();
for (int i = 0; i < l.size; i++) {
Point2D_I16 p = l.get(i);
render.addPoint(p.x, p.y, 3, Color.BLUE);
}
}
if (det.getDetector().isDetectMaximums()) {
QueueCorner l = det.getMaximums();
for (int i = 0; i < l.size; i++) {
Point2D_I16 p = l.get(i);
render.addPoint(p.x, p.y, 3, Color.RED);
}
}
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_I16 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_I16 in project BoofCV by lessthanoptimal.
the class NonMaxLimiter method process.
/**
* Extracts local max and/or min from the intensity image. If more than the maximum features are found then
* only the most intense ones will be returned
* @param intensity Feature image intensity
*/
public void process(GrayF32 intensity) {
originalMin.reset();
originalMax.reset();
nonmax.process(intensity, null, null, originalMin, originalMax);
localExtreme.reset();
for (int i = 0; i < originalMin.size; i++) {
Point2D_I16 p = originalMin.get(i);
float val = intensity.unsafe_get(p.x, p.y);
localExtreme.grow().set(-val, false, p);
}
for (int i = 0; i < originalMax.size; i++) {
Point2D_I16 p = originalMax.get(i);
float val = intensity.unsafe_get(p.x, p.y);
localExtreme.grow().set(val, true, p);
}
if (localExtreme.size > maxTotalFeatures) {
QuickSelect.select(localExtreme.data, maxTotalFeatures, localExtreme.size);
localExtreme.size = maxTotalFeatures;
}
}
Aggregations