private void findAcrossScales(FImage image, InterestPointFeatureCollector<T> collector) { final OctaveInterestPointFinder<T> finder = constructFinder(); finder.setOctaveInterestPointListener(collector); final GaussianPyramidOptions<FImage> options = new GaussianPyramidOptions<FImage>(); options.setDoubleInitialImage(false); options.setInitialSigma(1.0f); options.setExtraScaleSteps(0); options.setOctaveProcessor(finder); final GaussianPyramid<FImage> pyr = new GaussianPyramid<FImage>(options); pyr.process(image); finder.finish(); }
@Override @SuppressWarnings("unchecked") public void process(IMAGE image) { images = (IMAGE[]) Array.newInstance(image.getClass(), options.scales + options.extraScaleSteps + 1); // we want to each level to be separated by a constant factor // k=2^(1/scales) final float k = (float) Math.pow(2.0, 1.0 / options.scales); // image[0] of the octave is the input image images[0] = image; // the intial (input) image is considered to have sigma initialSigma. float prevSigma = options.initialSigma; for (int i = 1; i < options.scales + options.extraScaleSteps + 1; i++) { images[i] = images[i - 1].clone(); // compute the amount to increase from prevSigma to prevSigma*k final float increase = prevSigma * (float) Math.sqrt(k * k - 1.0); images[i].processInplace(options.createGaussianBlur(increase)); prevSigma *= k; } // if a processor is defined, apply it if (options.getOctaveProcessor() != null) options.getOctaveProcessor().process(this); }
@SuppressWarnings("unchecked") @Override public void process(GaussianOctave<I> octave) { images = (I[]) Array.newInstance(octave.images[0].getClass(), options.getScales() + options.getExtraScaleSteps()); //compute DoG by subtracting adjacent levels for (int i = 0; i < images.length; i++) { images[i] = octave.images[i].clone(); images[i].subtractInplace(octave.images[i + 1]); } } }
final GaussianPyramidOptions<FImage> gpo = new GaussianPyramidOptions<FImage>(); gpo.setScales( 1 ); gpo.setExtraScaleSteps( 1 ); gpo.setPyramidProcessor( ped ); gpo.setDoubleInitialImage( this.doubleSizePyramid );
if (fit.offset.get(1, 0) > 0.5 && y < dogs[0].height - octave.options.getBorderPixels()) newy++; if (fit.offset.get(1, 0) < -0.5 && y > octave.options.getBorderPixels()) newy--; if (fit.offset.get(2, 0) > 0.5 && x < dogs[0].width - octave.options.getBorderPixels()) newx++; if (fit.offset.get(2, 0) < -0.5 && x > octave.options.getBorderPixels()) newx--; if (currentIteration < numInterpolationIterations && (newy != y || newx != x)) { final float octaveScale = octave.options.getInitialSigma() * (float) Math.pow(2.0, (s + fit.offset.get(0, 0)) / octave.options.getScales());
image.processInplace(this.options.createGaussianBlur(sigma)); final int minImageSize = 2 + (2 * options.getBorderPixels()); if (options.getPyramidProcessor() != null) { options.getPyramidProcessor().process(this);
@Override public void process(GaussianOctave<FImage> octave) { for (int currentScaleIndex = 0; currentScaleIndex < octave.images.length; currentScaleIndex++) { final FImage fImage = octave.images[currentScaleIndex]; final float currentScale = (float) (octave.options.getInitialSigma() * Math.pow(2, (float) currentScaleIndex / octave.options.getScales())); detector.setDetectionScale(currentScale); detector.findInterestPoints(fImage); final List<T> points = this.selectionMode.selectPoints(detector); processOctaveLevelPoints(fImage, points, currentScale, octave.octaveSize); } }
@Override public void process(GaussianOctave<MBFImage> octave) { gaussianOctave = octave; GaussianPyramidOptions<FImage> opts = new GaussianPyramidOptions<FImage>(octave.options); GaussianPyramid<FImage> gp = new GaussianPyramid<FImage>(opts); dogOctave = new FirstBandDoGOctave(gp, octave.octaveSize); dogOctave.process(octave); innerFinder.process(dogOctave); }
@Override public void process(OCTAVE octave) { beforeProcess(octave); this.octave = octave; final FImage[] images = octave.images; final int height = images[0].height; final int width = images[0].width; final int borderDist = octave.options.getBorderPixels(); // search through the scale-space images, leaving a border for (currentScaleIndex = 1; currentScaleIndex < images.length - 1; currentScaleIndex++) { for (int y = borderDist; y < height - borderDist; y++) { for (int x = borderDist; x < width - borderDist; x++) { final float val = images[currentScaleIndex].pixels[y][x]; if (firstCheck(val, x, y, currentScaleIndex, images) && isLocalExtremum(val, images[currentScaleIndex - 1], x, y) && isLocalExtremum(val, images[currentScaleIndex], x, y) && isLocalExtremum(val, images[currentScaleIndex + 1], x, y) && isNotEdge(images[currentScaleIndex], x, y)) { processExtrema(images, currentScaleIndex, x, y, octave.octaveSize); } } } } }
@Override protected void processExtrema(FImage[] dogs, int s, int x, int y, float octSize) { // calculate the actual scale within the octave final float octaveScale = octave.options.getInitialSigma() * (float) Math.pow(2.0, s / scales); // fire the listener if (listener != null) listener.foundInterestPoint(this, x, y, octaveScale); } }
@Override protected void beforeProcess(GaussianOctave<FImage> octave) { scales = octave.options.getScales(); // the magnitude threshold must be adjusted based on the number of // scales, // as more scales will result in smaller differences between scales normMagnitudeScales = magnitudeThreshold / octave.options.getScales(); }
final GaussianPyramidOptions<FImage> gpo = new GaussianPyramidOptions<FImage>(); gpo.setScales( 1 ); gpo.setExtraScaleSteps( 1 ); gpo.setPyramidProcessor( ped ); gpo.setDoubleInitialImage( this.doubleSizePyramid );
if (fit.offset.get(1, 0) > 0.5 && y < dogs[0].height - octave.options.getBorderPixels()) newy++; if (fit.offset.get(1, 0) < -0.5 && y > octave.options.getBorderPixels()) newy--; if (fit.offset.get(2, 0) > 0.5 && x < dogs[0].width - octave.options.getBorderPixels()) newx++; if (fit.offset.get(2, 0) < -0.5 && x > octave.options.getBorderPixels()) newx--; if (currentIteration < numInterpolationIterations && (newy != y || newx != x)) { final float octaveScale = octave.options.getInitialSigma() * (float) Math.pow(2.0, (s + fit.offset.get(0, 0)) / octave.options.getScales());
image.processInplace(this.options.createGaussianBlur(sigma)); final int minImageSize = 2 + (2 * options.getBorderPixels()); if (options.getPyramidProcessor() != null) { options.getPyramidProcessor().process(this);
@Override public void process(GaussianOctave<FImage> octave) { for (int currentScaleIndex = 0; currentScaleIndex < octave.images.length; currentScaleIndex++) { final FImage fImage = octave.images[currentScaleIndex]; final float currentScale = (float) (octave.options.getInitialSigma() * Math.pow(2, (float) currentScaleIndex / octave.options.getScales())); detector.setDetectionScale(currentScale); detector.findInterestPoints(fImage); final List<T> points = this.selectionMode.selectPoints(detector); processOctaveLevelPoints(fImage, points, currentScale, octave.octaveSize); } }
@Override public void process(GaussianOctave<MBFImage> octave) { gaussianOctave = octave; GaussianPyramidOptions<FImage> opts = new GaussianPyramidOptions<FImage>(octave.options); GaussianPyramid<FImage> gp = new GaussianPyramid<FImage>(opts); dogOctave = new FirstBandDoGOctave(gp, octave.octaveSize); dogOctave.process(octave); innerFinder.process(dogOctave); }
@Override public void process(OCTAVE octave) { beforeProcess(octave); this.octave = octave; final FImage[] images = octave.images; final int height = images[0].height; final int width = images[0].width; final int borderDist = octave.options.getBorderPixels(); // search through the scale-space images, leaving a border for (currentScaleIndex = 1; currentScaleIndex < images.length - 1; currentScaleIndex++) { for (int y = borderDist; y < height - borderDist; y++) { for (int x = borderDist; x < width - borderDist; x++) { final float val = images[currentScaleIndex].pixels[y][x]; if (firstCheck(val, x, y, currentScaleIndex, images) && isLocalExtremum(val, images[currentScaleIndex - 1], x, y) && isLocalExtremum(val, images[currentScaleIndex], x, y) && isLocalExtremum(val, images[currentScaleIndex + 1], x, y) && isNotEdge(images[currentScaleIndex], x, y)) { processExtrema(images, currentScaleIndex, x, y, octave.octaveSize); } } } } }
@Override protected void processExtrema(FImage[] dogs, int s, int x, int y, float octSize) { // calculate the actual scale within the octave final float octaveScale = octave.options.getInitialSigma() * (float) Math.pow(2.0, s / scales); // fire the listener if (listener != null) listener.foundInterestPoint(this, x, y, octaveScale); } }
@Override protected void beforeProcess(GaussianOctave<FImage> octave) { scales = octave.options.getScales(); // the magnitude threshold must be adjusted based on the number of // scales, // as more scales will result in smaller differences between scales normMagnitudeScales = magnitudeThreshold / octave.options.getScales(); }
private void findAcrossScales(FImage image, InterestPointFeatureCollector<T> collector) { final OctaveInterestPointFinder<T> finder = constructFinder(); finder.setOctaveInterestPointListener(collector); final GaussianPyramidOptions<FImage> options = new GaussianPyramidOptions<FImage>(); options.setDoubleInitialImage(false); options.setInitialSigma(1.0f); options.setExtraScaleSteps(0); options.setOctaveProcessor(finder); final GaussianPyramid<FImage> pyr = new GaussianPyramid<FImage>(options); pyr.process(image); finder.finish(); }