Package boofcv.alg.feature.orientation
Class OrientationSlidingWindow<D extends ImageGray<D>>
java.lang.Object
boofcv.alg.feature.orientation.OrientationSlidingWindow<D>
- All Implemented Interfaces:
OrientationGradient<D>
,RegionOrientation
- Direct Known Subclasses:
ImplOrientationSlidingWindow_F32
,ImplOrientationSlidingWindow_S16
,ImplOrientationSlidingWindow_S32
public abstract class OrientationSlidingWindow<D extends ImageGray<D>> extends Object implements OrientationGradient<D>
Estimates the orientation by sliding window across all angles. All pixels which are pointing at an angle inside of this window have their gradient summed. The window with the largest normal is selected as the best window. The angle is then computed from the best window using atan2() and the summed gradient.
NOTE: There are probably additional performance enhancements that could be done.
-
Field Summary
Fields Modifier and Type Field Description protected double[]
angles
protected D
derivX
protected D
derivY
protected boolean
isWeighted
protected int
numAngles
protected double
objectRadiusToScale
protected double
objRadius
protected int
pixelRadius
protected ImageRectangle
rect
protected Kernel2D_F32
weights
protected double
windowSize
-
Constructor Summary
Constructors Modifier Constructor Description protected
OrientationSlidingWindow(double objectRadiusToScale, int numAngles, double windowSize, boolean isWeighted)
Configures orientation estimating algorithm. -
Method Summary
Modifier and Type Method Description double
compute(double X, double Y)
Computes the orientation of a region about its center.protected abstract double
computeOrientation()
Compute the angle without using the optional weightsprotected abstract double
computeWeightedOrientation(int c_x, int c_y)
Compute the angle using the weighting kernel.Kernel2D_F32
getWeights()
void
setImage(D derivX, D derivY)
Specifies input image data for estimating orientation.void
setObjectRadius(double objRadius)
Specifies the circle's radius that the orientation should beMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface boofcv.abst.feature.orientation.OrientationGradient
getImageType
Methods inherited from interface boofcv.abst.feature.orientation.RegionOrientation
copy
-
Field Details
-
pixelRadius
protected int pixelRadius -
objRadius
protected double objRadius -
objectRadiusToScale
protected double objectRadiusToScale -
derivX
-
derivY
-
rect
-
numAngles
protected int numAngles -
windowSize
protected double windowSize -
angles
protected double[] angles -
isWeighted
protected boolean isWeighted -
weights
-
-
Constructor Details
-
OrientationSlidingWindow
protected OrientationSlidingWindow(double objectRadiusToScale, int numAngles, double windowSize, boolean isWeighted)Configures orientation estimating algorithm.- Parameters:
objectRadiusToScale
- Convert object radius into scale factornumAngles
- Number of discrete points in which the sliding window will be centered around.windowSize
- Number of radians in the window being considered.isWeighted
- Should points be weighted using a Gaussian kernel.
-
-
Method Details
-
getWeights
-
setObjectRadius
public void setObjectRadius(double objRadius)Description copied from interface:RegionOrientation
Specifies the circle's radius that the orientation should be- Specified by:
setObjectRadius
in interfaceRegionOrientation
- Parameters:
objRadius
- Object's radius.
-
setImage
Description copied from interface:OrientationGradient
Specifies input image data for estimating orientation.- Specified by:
setImage
in interfaceOrientationGradient<D extends ImageGray<D>>
- Parameters:
derivX
- Image derivative along x-axis.derivY
- Image derivative along y-axis.
-
compute
public double compute(double X, double Y)Description copied from interface:RegionOrientation
Computes the orientation of a region about its center.- Specified by:
compute
in interfaceRegionOrientation
- Parameters:
X
- Center of the region in image pixels.Y
- Center of the region in image pixels.- Returns:
- Orientation in radians. Angle zero points along x-axis and pi/2 along y-axis.
-
computeOrientation
protected abstract double computeOrientation()Compute the angle without using the optional weights -
computeWeightedOrientation
protected abstract double computeWeightedOrientation(int c_x, int c_y)Compute the angle using the weighting kernel.
-