Package boofcv.alg.disparity.block.score
Class DisparitySparseRectifiedScoreBM<ArrayData,Input extends ImageGray<Input>>
java.lang.Object
boofcv.alg.disparity.block.score.DisparitySparseRectifiedScoreBM<ArrayData,Input>
- Direct Known Subclasses:
DisparitySparseRectifiedScoreBM_F32
,DisparitySparseRectifiedScoreBM_S32
,SparseScoreRectifiedNcc
public abstract class DisparitySparseRectifiedScoreBM<ArrayData,Input extends ImageGray<Input>> extends Object
Base class for computing sparse stereo disparity scores using a block matching approach given a
rectified stereo pair.
-
Field Summary
Fields Modifier and Type Field Description protected int
blockHeight
protected int
blockWidth
protected ImageBorder<Input>
border
protected int
disparityMax
maximum allowed image disparity (exclusive)protected int
disparityMin
the minimum disparity value (inclusive)protected int
disparityRange
difference between max and minprotected Class<Input>
inputType
Input image typeprotected Input
left
protected int
localRangeLtoR
the local disparity range at the current image coordinate in left to right directionprotected int
localRangeRtoL
the local disparity range at the current image coordinate in right to left directionprotected Input
patchCompare
protected Input
patchTemplate
protected int
radiusX
radius of the region along x and y axisprotected int
radiusY
radius of the region along x and y axisprotected Input
right
protected int
sampledHeight
protected int
sampledWidth
protected int
sampleRadiusX
protected int
sampleRadiusY
-
Constructor Summary
Constructors Modifier Constructor Description protected
DisparitySparseRectifiedScoreBM(int radiusX, int radiusY, Class<Input> inputType)
Configures disparity calculation.protected
DisparitySparseRectifiedScoreBM(Class<Input> inputType)
Default constructor primarily for unit tests -
Method Summary
Modifier and Type Method Description void
configure(int disparityMin, int disparityRange)
Configures the disparity searchprotected void
copy(int startX, int startY, int length, Input src, Input dst)
Copies a local image patch so that the score function doesn't need to deal with image border issuesabstract ArrayData
getScoreLtoR()
Array containing disparity score computed by callingprocessLeftToRight(int, int)
.abstract ArrayData
getScoreRtoL()
Array containing disparity score computed by callingprocessRightToLeft(int, int)
.boolean
processLeftToRight(int x, int y)
Compute disparity scores for the specified pixel in left to right direction.boolean
processRightToLeft(int x, int y)
Compute disparity scores for the specified pixel in right to left direction.protected abstract void
scoreDisparity(int disparityRange, boolean leftToRight)
Scores the disparity using image patches.void
setBorder(ImageBorder<Input> border)
Specifies how the image border is handledvoid
setImages(Input left, Input right)
Specify inputs for left and right camera images.protected void
setSampleRegion(int radiusX, int radiusY)
-
Field Details
-
disparityMin
protected int disparityMinthe minimum disparity value (inclusive) -
disparityMax
protected int disparityMaxmaximum allowed image disparity (exclusive) -
disparityRange
protected int disparityRangedifference between max and min -
localRangeLtoR
protected int localRangeLtoRthe local disparity range at the current image coordinate in left to right direction -
localRangeRtoL
protected int localRangeRtoLthe local disparity range at the current image coordinate in right to left direction -
radiusX
protected int radiusXradius of the region along x and y axis -
radiusY
protected int radiusYradius of the region along x and y axis -
blockWidth
protected int blockWidth -
blockHeight
protected int blockHeight -
sampledWidth
protected int sampledWidth -
sampledHeight
protected int sampledHeight -
left
-
right
-
border
-
inputType
Input image type -
patchTemplate
-
patchCompare
-
sampleRadiusX
protected int sampleRadiusX -
sampleRadiusY
protected int sampleRadiusY
-
-
Constructor Details
-
DisparitySparseRectifiedScoreBM
Configures disparity calculation.- Parameters:
radiusX
- Radius of the rectangular region along x-axis.radiusY
- Radius of the rectangular region along y-axis.
-
DisparitySparseRectifiedScoreBM
Default constructor primarily for unit tests
-
-
Method Details
-
setSampleRegion
protected void setSampleRegion(int radiusX, int radiusY) -
setBorder
Specifies how the image border is handled -
configure
public void configure(int disparityMin, int disparityRange)Configures the disparity search- Parameters:
disparityMin
- Minimum disparity that it will check. Must be ≥ 0 and < disparityMaxdisparityRange
- Number of possible disparity values estimated. The max possible disparity is min+range-1.
-
setImages
Specify inputs for left and right camera images.- Parameters:
left
- Rectified left camera image.right
- Rectified right camera image.
-
processLeftToRight
public boolean processLeftToRight(int x, int y)Compute disparity scores for the specified pixel in left to right direction. Be sure that its not too close to the image border.- Parameters:
x
- x-coordinate of pointy
- y-coordinate of point.
-
processRightToLeft
public boolean processRightToLeft(int x, int y)Compute disparity scores for the specified pixel in right to left direction. Be sure that its not too close to the image border.- Parameters:
x
- x-coordinate of pointy
- y-coordinate of point.
-
copy
Copies a local image patch so that the score function doesn't need to deal with image border issues -
scoreDisparity
protected abstract void scoreDisparity(int disparityRange, boolean leftToRight)Scores the disparity using image patches.- Parameters:
disparityRange
- The local range for disparityleftToRight
- If true then the disparity is being from in left to right direction (the typical)
-
getScoreLtoR
Array containing disparity score computed by callingprocessLeftToRight(int, int)
. Each element corresponds to the disparity score relative todisparityMin
and has a max value specified by#getLocalRangeLtoR()
-
getScoreRtoL
Array containing disparity score computed by callingprocessRightToLeft(int, int)
. Each element corresponds to the disparity score relative todisparityMin
and has a max value specified by#getLocalRangeRtoL()
-