Class DisparityBlockMatchRowFormat<Input extends ImageBase<Input>,Disparity extends ImageGray<Disparity>>
- Direct Known Subclasses:
DisparityBlockMatch
,DisparityBlockMatchBestFive
Base class for all dense stereo disparity score algorithms whose score's can be processed by
DisparitySelect
. The scores for all possible disparities at each pixel is computed for
an entire row at once. Then DisparitySelect
is called to process this score.
Score Format: The index of the score for column i ≥ radiusX + minDisparity at disparity d is:
index = imgWidth*(d-minDisparity-radiusX) + i - minDisparity-radiusX
Format Comment:
This ordering is a bit unnatural when searching for the best disparity, but reduces cache misses
when writing. Performance boost is about 20%-30% depending on max disparity and image size.
-
Field Summary
Modifier and TypeFieldDescriptionint
To speed up computations a rolling sum is performed where it subtracts the old row then adds the new row from the score sum.protected int
protected int
protected int
protected GrowBorder<Input,
Object> protected GrowBorder<Input,
Object> protected int
protected int
protected int
protected int
protected int
-
Constructor Summary
ModifierConstructorDescriptionprotected
DisparityBlockMatchRowFormat
(int regionRadiusX, int regionRadiusY, ImageType<Input> imageType) Configures disparity calculation. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
Inner function that computes the disparity.void
configure
(int disparityMin, int disparityRange) Configures the disparity searchint
int
protected abstract int
int
The maximum possible error for the regionvoid
Computes disparity between two stereo imagesvoid
setBorder
(ImageBorder<Input> border)
-
Field Details
-
disparityMin
protected int disparityMin -
disparityMax
protected int disparityMax -
disparityRange
protected int disparityRange -
widthDisparityBlock
protected int widthDisparityBlock -
radiusX
protected int radiusX -
radiusY
protected int radiusY -
regionWidth
protected int regionWidth -
regionHeight
protected int regionHeight -
growBorderL
-
growBorderR
-
catastrophicReset
public int catastrophicResetTo speed up computations a rolling sum is performed where it subtracts the old row then adds the new row from the score sum. Every time you update the sum noise is added. When disparity values get small then this error becomes noticeable and can lead to drastically incorrect answers. This is known as catastrophic cancellation. To fix this issue, the sum is recomputed from scratch every N rows.
NOTE: Under nominal situations this won't be noticeable. A specialized performance benchmark where a flat plane was moved away from the camera is where it was first noticed and only when very far away. How bad the errors are also depends on the error distribution. This only affects floating point scores. CENSUS has integer scores and is unaffected.
The value below was determined empirically in a test scenario. Set to 1 to always run.
-
-
Constructor Details
-
DisparityBlockMatchRowFormat
protected DisparityBlockMatchRowFormat(int regionRadiusX, int regionRadiusY, ImageType<Input> imageType) Configures disparity calculation.- Parameters:
regionRadiusX
- Radius of the rectangular region along x-axis.regionRadiusY
- Radius of the rectangular region along y-axis.
-
-
Method Details
-
setBorder
-
configure
public void configure(int disparityMin, int disparityRange) Configures the disparity search- Parameters:
disparityMin
- Minimum disparity that it will check. Must be ≥ 0 and < maxDisparitydisparityRange
- Number of possible disparity values estimated. The max possible disparity is min+range-1.
-
process
public void process(Input left, Input right, Disparity disparity, @Nullable @Nullable GrayF32 score) Computes disparity between two stereo images- Parameters:
left
- Left rectified stereo image. Inputright
- Right rectified stereo image. Inputdisparity
- Disparity between the two images. Outputscore
- Optional storage for best fit score
-
_process
public abstract void _process(Input left, Input right, Disparity disparity, @Nullable @Nullable GrayF32 score) Inner function that computes the disparity. -
getInputType
-
getDisparityType
-
getBorderX
public int getBorderX() -
getBorderY
public int getBorderY() -
getMaxRegionError
public int getMaxRegionError()The maximum possible error for the region -
getMaxPerPixelError
protected abstract int getMaxPerPixelError()
-