Class DetectFiducialSquareImage<T extends ImageGray<T>>
- All Implemented Interfaces:
VerbosePrint
Fiducial which uses images to describe arbitrary binary patterns. When useing this fiducial it's up to the user to select good images which will provide unique orientation and are easily distinguished against other patterns and noise insensitive.
The above image visually shows the fiducials internal coordinate system. The center of the fiducial is the origin of the coordinate system, e.g. all sides are width/2 distance away from the origin. +x is to the right, +y is up , and +z out of the paper towards the viewer.
A good pattern will have thick lines or thick shapes. When detecting the image it's not uncommon for the distortion removal to be off by one or two pixels. So think lines are be completely out of synch. The image should also be chosen so that there is to rotational ambiguity. A perfect circle in the center is an example of a bad fiducial in which orientation can't be uniquely determined.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
description of an image in 4 different orientationsNested classes/interfaces inherited from class boofcv.alg.fiducial.square.BaseDetectFiducialSquare
BaseDetectFiducialSquare.Result
-
Field Summary
Fields inherited from class boofcv.alg.fiducial.square.BaseDetectFiducialSquare
borderWidthFraction
-
Constructor Summary
ConstructorDescriptionDetectFiducialSquareImage
(InputToBinary<T> inputToBinary, DetectPolygonBinaryGrayRefine<T> quadDetector, double borderWidthFraction, double minimumBlackBorderFraction, double matchThreshold, Class<T> inputType) Configures the fiducial detector -
Method Summary
Modifier and TypeMethodDescriptionint
addPattern
(GrayU8 inputBinary, double lengthSide) Adds a new image to the detector.protected static void
binaryToDef
(GrayU8 binary, short[] desc) Converts a binary image into the compressed bit formatprotected int
hamming
(short[] a, short[] b) Computes the hamming score between two descriptions.protected boolean
processSquare
(GrayF32 gray, BaseDetectFiducialSquare.Result result, double edgeInside, double edgeOutside) Processes the detected square and matches it to a known fiducial.Methods inherited from class boofcv.alg.fiducial.square.BaseDetectFiducialSquare
computeFractionBoundary, configure, getBinary, getFound, process, setVerbose
-
Constructor Details
-
DetectFiducialSquareImage
public DetectFiducialSquareImage(InputToBinary<T> inputToBinary, DetectPolygonBinaryGrayRefine<T> quadDetector, double borderWidthFraction, double minimumBlackBorderFraction, double matchThreshold, Class<T> inputType) Configures the fiducial detector- Parameters:
matchThreshold
- Considered a match if the hamming distance is less than this fraction of the maximum
-
-
Method Details
-
addPattern
Adds a new image to the detector. Image must be gray-scale and is converted into a binary image using the specified threshold. All input images are rescaled to be square and of the appropriate size. Thus the original shape of the image doesn't matter. Square shapes are highly recommended since that's what the target looks like.- Parameters:
inputBinary
- Binary input image pattern. 0 = black, 1 = white.lengthSide
- How long one of the sides of the target is in world units.- Returns:
- The ID of the provided image
-
binaryToDef
Converts a binary image into the compressed bit format -
processSquare
protected boolean processSquare(GrayF32 gray, BaseDetectFiducialSquare.Result result, double edgeInside, double edgeOutside) Description copied from class:BaseDetectFiducialSquare
Processes the detected square and matches it to a known fiducial. Black border is included.- Specified by:
processSquare
in classBaseDetectFiducialSquare<T extends ImageGray<T>>
- Parameters:
gray
- 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.
-
hamming
protected int hamming(short[] a, short[] b) Computes the hamming score between two descriptions. Larger the number better the fit -
getTargets
-