Package gov.nih.mipav.model.algorithms
Class AlgorithmBRISK
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmBRISK
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmBRISK extends AlgorithmBase
BRISK - Binary Robust Invariant Scalable Keypoints Reference implementation of [1] Stefan Leutenegger,Margarita Chli and Roland Siegwart, BRISK: Binary Robust Invariant Scalable Keypoints, in Proceedings of the IEEE International Conference on Computer Vision (ICCV2011). Copyright (C) 2011 The Autonomous Systems Lab (ASL), ETH Zurich, Stefan Leutenegger, Simon Lynen and Margarita Chli. This file is part of BRISK. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the ASL nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Reference for counting number of bits set in a byte: Anatomy of High-Performance 2D Similarity Calculations by Imran S. Haque, Vijay S. Pande, and W. Patrick Walters
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
AlgorithmBRISK.BriskLayer
private class
AlgorithmBRISK.BriskLongPair
private class
AlgorithmBRISK.BriskPatternPoint
private class
AlgorithmBRISK.BriskShortPair
private class
AlgorithmBRISK.KeyPoint
-
Field Summary
Fields Modifier and Type Field Description private static double
basicSize
private double
dMax
private double
dMin
private static int
HALFSAMPLE
private int
HammingDistanceThreshold
private java.util.Vector<java.lang.Integer>
indexChange
private int
layers
private AlgorithmBRISK.BriskLongPair[]
longPairs
private int
n_rot
private java.util.Vector<java.lang.Integer>
numberList
private int
numLongPairs
private int
numShortPairs
private int
octaves
private AlgorithmBRISK.BriskPatternPoint[]
patternPoints
private double
patternScale
private int
points
private java.util.Vector<AlgorithmBRISK.BriskLayer>
pyramid
private java.util.Vector<java.lang.Double>
radiusList
private boolean
rotationInvariant
private int
safeThreshold
private double
safetyFactor
private boolean
scaleInvariant
private double[]
scaleList
private static double
scaleRange
private static int
scales
private AlgorithmBRISK.BriskShortPair[]
shortPairs
private int[]
sizeList
private int
strings
private int
threshold
private static int
TWOTHIRDSAMPLE
private boolean
wholeImageFlag
-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStopped
-
-
Constructor Summary
Constructors Constructor Description AlgorithmBRISK()
AlgorithmBRISK - default constructor.AlgorithmBRISK(ModelImage srcImg)
AlgorithmBRISK(ModelImage destImage, ModelImage srcImg, boolean wholeImageFlag, int threshold, int HammingDistanceThreshold, int octaves, boolean rotationInvariant, boolean scaleInvariant, double patternScale, java.util.Vector<java.lang.Double> radiusList, java.util.Vector<java.lang.Integer> numberList, double dMax, double dMin, java.util.Vector<java.lang.Integer> indexChange)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
BriskDescriptorExtractor()
private void
briskScaleSpace()
private byte[][]
computeImpl(ModelImage image, java.util.Vector<AlgorithmBRISK.KeyPoint> keypoints)
private void
constructPyramid(ModelImage image)
void
detectImpl(ModelImage image, java.util.Vector<AlgorithmBRISK.KeyPoint> keypoints, java.util.BitSet mask)
void
finalize()
finalize -private void
generateKernel()
private void
getKeypoints(java.util.Vector<AlgorithmBRISK.KeyPoint> keypoints)
private double
getScoreMaxAbove(int layer, int x_layer, int y_layer, int threshold, boolean[] ismax, double[] dx, double[] dy)
private double
getScoreMaxBelow(int layer, int x_layer, int y_layer, int threshold, boolean[] ismax, double[] dx, double[] dy)
private double
refine1D(double s_05, double s0, double s05, double[] max)
private double
refine1D_1(double s_05, double s0, double s05, double[] max)
private double
refine1D_2(double s_05, double s0, double s05, double[] max)
private double
refine3D(int layer, int x_layer, int y_layer, double[] x, double[] y, double[] scale, boolean[] ismax)
private boolean
RoiPredicate(double minX, double minY, double maxX, double maxY, AlgorithmBRISK.KeyPoint keyPt)
void
runAlgorithm()
Starts the program.private int
smoothedIntensity(ModelImage image, ModelImage integral, double key_x, double key_y, int scale, int rot, int point)
private double
subpixel2D(int s_0_0, int s_0_1, int s_0_2, int s_1_0, int s_1_1, int s_1_2, int s_2_0, int s_2_1, int s_2_2, double[] delta_x, double[] delta_y)
-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, generateProgressValues, getDestImage, getElapsedTime, getMask, getMaxProgressValue, getMinProgressValue, getNumberOfThreads, getProgress, getProgressChangeListener, getProgressChangeListeners, getProgressModulus, getProgressStep, getProgressValues, getSrcImage, isCompleted, isImage25D, isMultiThreadingEnabled, isRunningInSeparateThread, isThreadStopped, linkProgressToAlgorithm, linkProgressToAlgorithm, makeProgress, notifyListeners, removeListener, removeProgressChangeListener, run, setCompleted, setImage25D, setMask, setMaxProgressValue, setMinProgressValue, setMultiThreadingEnabled, setNumberOfThreads, setProgress, setProgressModulus, setProgressStep, setProgressValues, setProgressValues, setRunningInSeparateThread, setSrcImage, setStartTime, setThreadStopped, startMethod, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
wholeImageFlag
private boolean wholeImageFlag
-
threshold
private int threshold
-
HammingDistanceThreshold
private int HammingDistanceThreshold
-
octaves
private int octaves
-
rotationInvariant
private boolean rotationInvariant
-
scaleInvariant
private boolean scaleInvariant
-
patternScale
private double patternScale
-
radiusList
private java.util.Vector<java.lang.Double> radiusList
-
numberList
private java.util.Vector<java.lang.Integer> numberList
-
dMax
private double dMax
-
dMin
private double dMin
-
indexChange
private java.util.Vector<java.lang.Integer> indexChange
-
basicSize
private static final double basicSize
- See Also:
- Constant Field Values
-
scales
private static final int scales
- See Also:
- Constant Field Values
-
scaleRange
private static final double scaleRange
- See Also:
- Constant Field Values
-
n_rot
private final int n_rot
- See Also:
- Constant Field Values
-
safetyFactor
private final double safetyFactor
- See Also:
- Constant Field Values
-
points
private int points
-
patternPoints
private AlgorithmBRISK.BriskPatternPoint[] patternPoints
-
scaleList
private double[] scaleList
-
sizeList
private int[] sizeList
-
shortPairs
private AlgorithmBRISK.BriskShortPair[] shortPairs
-
longPairs
private AlgorithmBRISK.BriskLongPair[] longPairs
-
numShortPairs
private int numShortPairs
-
numLongPairs
private int numLongPairs
-
strings
private int strings
-
layers
private int layers
-
pyramid
private java.util.Vector<AlgorithmBRISK.BriskLayer> pyramid
-
HALFSAMPLE
private static final int HALFSAMPLE
- See Also:
- Constant Field Values
-
TWOTHIRDSAMPLE
private static final int TWOTHIRDSAMPLE
- See Also:
- Constant Field Values
-
safeThreshold
private int safeThreshold
-
-
Constructor Detail
-
AlgorithmBRISK
public AlgorithmBRISK()
AlgorithmBRISK - default constructor.
-
AlgorithmBRISK
public AlgorithmBRISK(ModelImage srcImg)
-
AlgorithmBRISK
public AlgorithmBRISK(ModelImage destImage, ModelImage srcImg, boolean wholeImageFlag, int threshold, int HammingDistanceThreshold, int octaves, boolean rotationInvariant, boolean scaleInvariant, double patternScale, java.util.Vector<java.lang.Double> radiusList, java.util.Vector<java.lang.Integer> numberList, double dMax, double dMin, java.util.Vector<java.lang.Integer> indexChange)
- Parameters:
destImage
-srcImg
- Source imagewholeImageFlag
-threshold
- FAST/AGAST detection thresholdHammingDistanceThreshold
-octaves
- Number of octaves for the detectionrotationInvariant
-scaleInvariant
-patternScale
- Scale factor for the BRISK pattern.radiusList
-numberList
-dMax
- Short pair maximum distancedMin
- Long pair maximum distanceindexChange
-
-
-
Method Detail
-
finalize
public void finalize()
finalize -- Overrides:
finalize
in classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()
Starts the program.- Specified by:
runAlgorithm
in classAlgorithmBase
-
BriskDescriptorExtractor
private void BriskDescriptorExtractor()
-
generateKernel
private void generateKernel()
-
smoothedIntensity
private int smoothedIntensity(ModelImage image, ModelImage integral, double key_x, double key_y, int scale, int rot, int point)
-
RoiPredicate
private boolean RoiPredicate(double minX, double minY, double maxX, double maxY, AlgorithmBRISK.KeyPoint keyPt)
-
computeImpl
private byte[][] computeImpl(ModelImage image, java.util.Vector<AlgorithmBRISK.KeyPoint> keypoints)
-
detectImpl
public void detectImpl(ModelImage image, java.util.Vector<AlgorithmBRISK.KeyPoint> keypoints, java.util.BitSet mask)
-
briskScaleSpace
private void briskScaleSpace()
-
constructPyramid
private void constructPyramid(ModelImage image)
-
getKeypoints
private void getKeypoints(java.util.Vector<AlgorithmBRISK.KeyPoint> keypoints)
-
refine3D
private double refine3D(int layer, int x_layer, int y_layer, double[] x, double[] y, double[] scale, boolean[] ismax)
-
refine1D
private double refine1D(double s_05, double s0, double s05, double[] max)
-
refine1D_1
private double refine1D_1(double s_05, double s0, double s05, double[] max)
-
refine1D_2
private double refine1D_2(double s_05, double s0, double s05, double[] max)
-
getScoreMaxBelow
private double getScoreMaxBelow(int layer, int x_layer, int y_layer, int threshold, boolean[] ismax, double[] dx, double[] dy)
-
getScoreMaxAbove
private double getScoreMaxAbove(int layer, int x_layer, int y_layer, int threshold, boolean[] ismax, double[] dx, double[] dy)
-
subpixel2D
private double subpixel2D(int s_0_0, int s_0_1, int s_0_2, int s_1_0, int s_1_1, int s_1_2, int s_2_0, int s_2_1, int s_2_2, double[] delta_x, double[] delta_y)
-
-