public class DetectRectlinearSymmetry extends CvStage
Modifier and Type | Class and Description |
---|---|
static class |
DetectRectlinearSymmetry.ScoreRange |
static class |
DetectRectlinearSymmetry.SymmetryFunction
Determines how the cross-section across the height of the detected subject is evaluated.
FullSymmetry looks for full inner and outline symmetry. |
CvStage.CvStageBeanInfo, CvStage.Result
Constructor and Description |
---|
DetectRectlinearSymmetry() |
Modifier and Type | Method and Description |
---|---|
protected static void |
applyCrossSectionContour(int channels,
double s,
int symmetryWidth,
int size,
double[] crossSection)
Create the contour of the cross-section signal from both sides, meeting at the symmetry point s.
|
protected static void |
applyMasked(int channels,
int size,
double minFeatureSize,
int subSampling,
int superSampling,
double[] crossSectionMasked,
double[] kernel,
double[] crossSection)
Instead of taking the cross-section cumulative brightness, compare the number of non.zero pixels against
the minFeatureSize and apply a step function.
|
protected static int |
findCrossSectionBounds(int channels,
double symmetry,
int symmetrySize,
double[] crossSection)
Find the bounds of the symmetry in the cross-section.
|
protected static java.lang.Double |
findCrossSectionSymmetry(int channels,
int size,
int symmetrySearch,
int symmetrySize,
DetectRectlinearSymmetry.SymmetryFunction symmetryFunction,
double[] crossSection,
DetectRectlinearSymmetry.ScoreRange scoreRange)
Find the best symmetry in the cross-section.
|
static RotatedRect |
findReclinearSymmetry(Mat image,
int xCenter,
int yCenter,
double expectedAngle,
double maxWidth,
double maxHeight,
double searchDistance,
double searchAngle,
double minSymmetry,
DetectRectlinearSymmetry.SymmetryFunction xSymmetryFunction,
DetectRectlinearSymmetry.SymmetryFunction ySymmetryFunction,
double minFeatureSize,
int subSampling,
int superSampling,
int gaussianSmoothing,
double gamma,
int threshold,
boolean diagnostics,
boolean diagnosticMap,
DetectRectlinearSymmetry.ScoreRange scoreRange)
Find the angle, location and bounds of the subject with largest rectlinear symmetry.
|
DetectRectlinearSymmetry.SymmetryFunction |
getAsymmetricFunction() |
double |
getExpectedAngle() |
double |
getGamma() |
double |
getMaxHeight() |
double |
getMaxWidth() |
double |
getMinFeatureSize() |
double |
getMinSymmetry() |
java.lang.String |
getPropertyName() |
double |
getSearchAngle() |
double |
getSearchDistance() |
int |
getSmoothing() |
int |
getSubSampling() |
int |
getSuperSampling() |
DetectRectlinearSymmetry.SymmetryFunction |
getSymmetricFunction() |
int |
getThreshold() |
boolean |
isDiagnostics() |
boolean |
isDiagnosticsMap() |
boolean |
isSymmetricLeftRight() |
boolean |
isSymmetricUpperLower() |
CvStage.Result |
process(CvPipeline pipeline)
Perform an operation in a pipeline.
|
void |
setAsymmetricFunction(DetectRectlinearSymmetry.SymmetryFunction symmetryAcrossHeight) |
void |
setDiagnostics(boolean diagnostics) |
void |
setDiagnosticsMap(boolean diagnosticsMap) |
void |
setExpectedAngle(double expectedAngle) |
void |
setGamma(double gamma) |
void |
setMaxHeight(double maxHeight) |
void |
setMaxWidth(double maxWidth) |
void |
setMinFeatureSize(double minFeatureSize) |
void |
setMinSymmetry(double minSymmetry) |
void |
setPropertyName(java.lang.String propertyName) |
void |
setSearchAngle(double searchAngle) |
void |
setSearchDistance(double searchDistance) |
void |
setSmoothing(int smoothing) |
void |
setSubSampling(int subSampling) |
void |
setSuperSampling(int superSampling) |
void |
setSymmetricFunction(DetectRectlinearSymmetry.SymmetryFunction symmetryAcrossWidth) |
void |
setSymmetricLeftRight(boolean symmetricLeftRight) |
void |
setSymmetricUpperLower(boolean symmetricUpperLower) |
void |
setThreshold(int threshold) |
protected static double |
sumContrast(int channels,
int size,
double[] crossSection,
double[] crossSectionN)
Sum the contrast across the cross-section (sum of squares).
|
customizePropertySheet, getBeanInfo, getCategory, getDescription, getDescription, getLengthUnit, getName, getPossiblePipelinePropertyOverride, getPossiblePipelinePropertyOverride, isEnabled, recordPropertyOverride, setEnabled, setName
public double getExpectedAngle()
public void setExpectedAngle(double expectedAngle)
public double getSearchDistance()
public void setSearchDistance(double searchDistance)
public double getSearchAngle()
public void setSearchAngle(double searchAngle)
public double getMaxWidth()
public void setMaxWidth(double maxWidth)
public double getMaxHeight()
public void setMaxHeight(double maxHeight)
public double getMinFeatureSize()
public void setMinFeatureSize(double minFeatureSize)
public DetectRectlinearSymmetry.SymmetryFunction getSymmetricFunction()
public void setSymmetricFunction(DetectRectlinearSymmetry.SymmetryFunction symmetryAcrossWidth)
public DetectRectlinearSymmetry.SymmetryFunction getAsymmetricFunction()
public void setAsymmetricFunction(DetectRectlinearSymmetry.SymmetryFunction symmetryAcrossHeight)
public boolean isSymmetricLeftRight()
public void setSymmetricLeftRight(boolean symmetricLeftRight)
public boolean isSymmetricUpperLower()
public void setSymmetricUpperLower(boolean symmetricUpperLower)
public double getMinSymmetry()
public void setMinSymmetry(double minSymmetry)
public int getSubSampling()
public void setSubSampling(int subSampling)
public int getSuperSampling()
public void setSuperSampling(int superSampling)
public int getSmoothing()
public void setSmoothing(int smoothing)
public double getGamma()
public void setGamma(double gamma)
public int getThreshold()
public void setThreshold(int threshold)
public java.lang.String getPropertyName()
public void setPropertyName(java.lang.String propertyName)
public boolean isDiagnostics()
public void setDiagnostics(boolean diagnostics)
public boolean isDiagnosticsMap()
public void setDiagnosticsMap(boolean diagnosticsMap)
public CvStage.Result process(CvPipeline pipeline) throws java.lang.Exception
CvStage
process
in class CvStage
java.lang.Exception
public static RotatedRect findReclinearSymmetry(Mat image, int xCenter, int yCenter, double expectedAngle, double maxWidth, double maxHeight, double searchDistance, double searchAngle, double minSymmetry, DetectRectlinearSymmetry.SymmetryFunction xSymmetryFunction, DetectRectlinearSymmetry.SymmetryFunction ySymmetryFunction, double minFeatureSize, int subSampling, int superSampling, int gaussianSmoothing, double gamma, int threshold, boolean diagnostics, boolean diagnosticMap, DetectRectlinearSymmetry.ScoreRange scoreRange) throws java.lang.Exception
image
- The image to be searched.xCenter
- Center, around which the search is to be performed.yCenter
- expectedAngle
- Expected angle of the subject.maxWidth
- Maximum width and height of the searched subject. Must include a margin around it, to detect edges.maxHeight
- searchDistance
- Maximum search distance around the center.searchAngle
- Maximum search angle on both sides of the expected angle.minSymmetry
- Minimum symmetry for a successful detection. Values higher than 1.0 mean symmetry is present.xSymmetryFunction
- The symmetry function determines, how the cross-section is interpreted to find symmetry. See DetectRectlinearSymmetry.SymmetryFunction
ySymmetryFunction
- minFeatureSize
- Minimum feature size in pixels, if the SymmetryFunction.OutlineSymmetryMasked
is used.subSampling
- To speed up things, the image is first sub-sampled, i.e. only every subSampling × subSampling pixel is analyzed.
Once a preliminary match is obtained, recursion is used to refine it.superSampling
- In the final recursion, superSampling is applied, i.e. the sampled pixels are binned into a finder cross-section,
allowing for sub-pixel precision.gaussianSmoothing
- Cross-sections are subject to pixel grid interferences if the sampling angle is at 45° multiples. Using Gaussian
smoothing with a kernel of this size, this is remedied.gamma
- Pixel luminance is raised to the power of gamma. Choosing > 1 gammas allows for boosting bright areas.threshold
- Pixel luminance threshold for the DetectRectlinearSymmetry.SymmetryFunction
OutlineSymmetryMasked option.diagnostics
- Overlay diagnostic cross-hairs and bounds on top of the image.diagnosticMap
- Overlay diagnostic maps for angular contrast and cross-section profiles on top of the image.scoreRange
- Returns symmetry score ranges.java.lang.Exception
protected static double sumContrast(int channels, int size, double[] crossSection, double[] crossSectionN)
channels
- size
- crossSection
- crossSectionN
- protected static void applyMasked(int channels, int size, double minFeatureSize, int subSampling, int superSampling, double[] crossSectionMasked, double[] kernel, double[] crossSection)
channels
- size
- minFeatureSize
- subSampling
- superSampling
- crossSectionMasked
- kernel
- crossSection
- protected static void applyCrossSectionContour(int channels, double s, int symmetryWidth, int size, double[] crossSection)
channels
- s
- symmetryWidth
- size
- crossSection
- protected static java.lang.Double findCrossSectionSymmetry(int channels, int size, int symmetrySearch, int symmetrySize, DetectRectlinearSymmetry.SymmetryFunction symmetryFunction, double[] crossSection, DetectRectlinearSymmetry.ScoreRange scoreRange)
channels
- size
- symmetrySearch
- symmetrySize
- symmetryFunction
- crossSection
- scoreRange
- protected static int findCrossSectionBounds(int channels, double symmetry, int symmetrySize, double[] crossSection)
channels
- symmetry
- symmetrySize
- crossSection
-