public abstract class BaseDetectFiducialSquare<T extends boofcv.struct.image.ImageGray<T>>
extends java.lang.Object
Base class for square fiducial detectors. Searches for quadrilaterals inside the image with a black border and inner contours. It then removes perspective and lens distortion from the candidate quadrilateral and rendered onto a new image. The just mentioned image is then passed on to the class which extends this one. After being processed by the extending class, the corners are rotated to match and the 3D pose of the target found. Lens distortion is removed sparsely for performance reasons.
Must call configure(boofcv.alg.distort.LensDistortionNarrowFOV, int, int, boolean) before it can process an image.
Target orientation. Corner 0 = (-r,r), 1 = (r,r) , 2 = (r,-r) , 3 = (-r,-r).
| Modifier and Type | Class and Description |
|---|---|
static class |
BaseDetectFiducialSquare.Result |
| Modifier and Type | Field and Description |
|---|---|
protected double |
borderWidthFraction |
protected boolean |
verbose |
| Modifier | Constructor and Description |
|---|---|
protected |
BaseDetectFiducialSquare(boofcv.abst.filter.binary.InputToBinary<T> inputToBinary,
boofcv.alg.shapes.polygon.DetectPolygonBinaryGrayRefine<T> squareDetector,
boolean binaryCopy,
double borderWidthFraction,
double minimumBorderBlackFraction,
int squarePixels,
java.lang.Class<T> inputType)
Configures the detector.
|
| Modifier and Type | Method and Description |
|---|---|
protected double |
computeFractionBoundary(float pixelThreshold)
Computes the fraction of pixels inside the image border which are black
|
void |
configure(boofcv.alg.distort.LensDistortionNarrowFOV distortion,
int width,
int height,
boolean cache)
Specifies the image's intrinsic parameters and target size
|
boofcv.struct.image.GrayU8 |
getBinary() |
double |
getBorderWidthFraction() |
org.ddogleg.struct.FastQueue<FoundFiducial> |
getFound()
Returns list of found fiducials
|
java.lang.Class<T> |
getInputType() |
boofcv.alg.shapes.polygon.DetectPolygonBinaryGrayRefine<T> |
getSquareDetector() |
double |
getThresholdSideRatio() |
void |
process(T gray)
Examines the input image to detect fiducials inside of it
|
protected abstract boolean |
processSquare(boofcv.struct.image.GrayF32 square,
BaseDetectFiducialSquare.Result result,
double edgeInside,
double edgeOutside)
Processes the detected square and matches it to a known fiducial.
|
void |
setThresholdSideRatio(double thresholdSideRatio) |
void |
setVerbose(boolean verbose)
Used to toggle on/off verbose debugging information
|
protected double borderWidthFraction
protected boolean verbose
protected BaseDetectFiducialSquare(boofcv.abst.filter.binary.InputToBinary<T> inputToBinary, boofcv.alg.shapes.polygon.DetectPolygonBinaryGrayRefine<T> squareDetector, boolean binaryCopy, double borderWidthFraction, double minimumBorderBlackFraction, int squarePixels, java.lang.Class<T> inputType)
inputToBinary - Converts input image into a binary imagesquareDetector - Detects the quadrilaterals in the imagebinaryCopy - If true a copy is created of the binary image and it's not modified.borderWidthFraction - Fraction of the fiducial's width that the border occupies. 0.25 is recommended.minimumBorderBlackFraction - Minimum fraction of pixels inside the border which must be black. Try 0.65squarePixels - Number of pixels wide the undistorted square image of the fiducial's interior is.
This will include the black border.inputType - Type of input image it's processingpublic void configure(boofcv.alg.distort.LensDistortionNarrowFOV distortion,
int width,
int height,
boolean cache)
distortion - Lens distortionwidth - Image widthheight - Image heightcache - If there's lens distortion should it cache the transforms? Speeds it up by about 12%. Ignored
if no lens distortionpublic void process(T gray)
gray - Undistorted input imageprotected double computeFractionBoundary(float pixelThreshold)
pixelThreshold - Pixel's less than this value are considered blackpublic org.ddogleg.struct.FastQueue<FoundFiducial> getFound()
protected abstract boolean processSquare(boofcv.struct.image.GrayF32 square,
BaseDetectFiducialSquare.Result result,
double edgeInside,
double edgeOutside)
square - Image of the undistorted squareresult - Which target and its orientation was foundedgeInside - Average pixel value along edge insideedgeOutside - Average pixel value along edge outsidepublic void setVerbose(boolean verbose)
verbose - true for verbose outputpublic boofcv.alg.shapes.polygon.DetectPolygonBinaryGrayRefine<T> getSquareDetector()
public boofcv.struct.image.GrayU8 getBinary()
public java.lang.Class<T> getInputType()
public double getBorderWidthFraction()
public double getThresholdSideRatio()
public void setThresholdSideRatio(double thresholdSideRatio)