Package boofcv.alg.fiducial.square
Class BaseDetectFiducialSquare<T extends ImageGray<T>>
java.lang.Object
boofcv.alg.fiducial.square.BaseDetectFiducialSquare<T>
- All Implemented Interfaces:
VerbosePrint
- Direct Known Subclasses:
DetectFiducialSquareBinary
,DetectFiducialSquareHamming
,DetectFiducialSquareImage
public abstract class BaseDetectFiducialSquare<T extends ImageGray<T>>
extends Object
implements VerbosePrint
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).
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected double
How wide the border is relative to the fiducial's total width -
Constructor Summary
ModifierConstructorDescriptionprotected
BaseDetectFiducialSquare
(InputToBinary<T> inputToBinary, DetectPolygonBinaryGrayRefine<T> squareDetector, boolean binaryCopy, double borderWidthFraction, double minimumBorderBlackFraction, int squarePixels, Class<T> inputType) Configures the detector. -
Method Summary
Modifier and TypeMethodDescriptionprotected double
computeFractionBoundary
(float pixelThreshold) Computes the fraction of pixels inside the image border which are blackvoid
configure
(@Nullable LensDistortionNarrowFOV distortion, int width, int height, boolean cache) Specifies the image's intrinsic parameters and target sizegetFound()
Returns list of found fiducialsvoid
Examines the input image to detect fiducials inside itprotected abstract boolean
processSquare
(GrayF32 square, BaseDetectFiducialSquare.Result result, double edgeInside, double edgeOutside) Processes the detected square and matches it to a known fiducial.void
setVerbose
(@Nullable PrintStream out, @Nullable Set<String> configuration)
-
Field Details
-
borderWidthFraction
protected double borderWidthFractionHow wide the border is relative to the fiducial's total width
-
-
Constructor Details
-
BaseDetectFiducialSquare
protected BaseDetectFiducialSquare(InputToBinary<T> inputToBinary, DetectPolygonBinaryGrayRefine<T> squareDetector, boolean binaryCopy, double borderWidthFraction, double minimumBorderBlackFraction, int squarePixels, Class<T> inputType) Configures the detector.- Parameters:
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 processing
-
-
Method Details
-
configure
public void configure(@Nullable @Nullable LensDistortionNarrowFOV distortion, int width, int height, boolean cache) Specifies the image's intrinsic parameters and target size- Parameters:
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 distortion
-
process
Examines the input image to detect fiducials inside it- Parameters:
gray
- Undistorted input image
-
computeFractionBoundary
protected double computeFractionBoundary(float pixelThreshold) Computes the fraction of pixels inside the image border which are black- Parameters:
pixelThreshold
- Pixel's less than this value are considered black- Returns:
- fraction of border that's black
-
getFound
Returns list of found fiducials -
processSquare
protected abstract boolean processSquare(GrayF32 square, BaseDetectFiducialSquare.Result result, double edgeInside, double edgeOutside) Processes the detected square and matches it to a known fiducial. Black border is included.- Parameters:
square
- Image of the undistorted squareresult
- Which target and its orientation was foundedgeInside
- Average pixel value along edge insideedgeOutside
- Average pixel value along edge outside- Returns:
- true if the square matches a known target.
-
setVerbose
public void setVerbose(@Nullable @Nullable PrintStream out, @Nullable @Nullable Set<String> configuration) - Specified by:
setVerbose
in interfaceVerbosePrint
-
getBinary
-