- All Implemented Interfaces:
- Direct Known Subclasses:
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.
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
Nested Classes Modifier and Type Class Description
Fields Modifier and Type Field Description
protected doubleHow wide the border is relative to the fiducial's total width
Modifier and Type Method Description
(float pixelThreshold)Computes the fraction of pixels inside the image border which are black
LensDistortionNarrowFOV distortion, int width, int height, boolean cache)(@NullableSpecifies the image's intrinsic parameters and target size
()Returns list of found fiducials
T gray)(Examines the input image to detect fiducials inside it
protected abstract boolean
GrayF32 square, BaseDetectFiducialSquare.Result result, double edgeInside, double edgeOutside)(Processes the detected square and matches it to a known fiducial.
PrintStream out, @Nullable Set<String> configuration)(@Nullable
borderWidthFractionprotected double borderWidthFractionHow wide the border is relative to the fiducial's total width
BaseDetectFiducialSquareprotected BaseDetectFiducialSquare(InputToBinary<T> inputToBinary, DetectPolygonBinaryGrayRefine<T> squareDetector, boolean binaryCopy, double borderWidthFraction, double minimumBorderBlackFraction, int squarePixels, Class<T> inputType)Configures the detector.
inputToBinary- Converts input image into a binary image
squareDetector- Detects the quadrilaterals in the image
binaryCopy- 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.65
squarePixels- 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
configurepublic void configure(@Nullable @Nullable LensDistortionNarrowFOV distortion, int width, int height, boolean cache)Specifies the image's intrinsic parameters and target size
distortion- Lens distortion
width- Image width
height- Image height
cache- If there's lens distortion should it cache the transforms? Speeds it up by about 12%. Ignored if no lens distortion
processpublic void process(T gray)Examines the input image to detect fiducials inside it
gray- Undistorted input image
computeFractionBoundaryprotected double computeFractionBoundary(float pixelThreshold)Computes the fraction of pixels inside the image border which are black
pixelThreshold- Pixel's less than this value are considered black
- fraction of border that's black
getFoundReturns list of found fiducials
processSquareprotected 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.
square- Image of the undistorted square
result- Which target and its orientation was found
edgeInside- Average pixel value along edge inside
edgeOutside- Average pixel value along edge outside
- true if the square matches a known target.
setVerbosepublic void setVerbose(@Nullable @Nullable PrintStream out, @Nullable @Nullable Set<String> configuration)
getBinarypublic GrayU8 getBinary()