Package boofcv.alg.disparity.sgm.cost
Class SgmCostFromBlocks<T extends ImageBase<T>>
java.lang.Object
boofcv.alg.disparity.sgm.cost.SgmCostFromBlocks<T>
- All Implemented Interfaces:
DisparitySelect<int[],
,GrayU8> SgmDisparityCost<T>
,Compare_S32
public class SgmCostFromBlocks<T extends ImageBase<T>>
extends Object
implements SgmDisparityCost<T>, DisparitySelect<int[],GrayU8>, Compare_S32
Computes the error for SGM using
block matching
.
It's a little bit of a hack since it grabs the error by implementing DisparitySelect
which is normally
used to select a disparity instead here it copies it into the SGM cost tensor.-
Field Summary
Fields inherited from interface boofcv.alg.disparity.sgm.SgmDisparityCost
MAX_COST
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
compare
(int scoreA, int scoreB) 1 = scoreA is better than scoreB 0 = scoreA is equivalent than scoreB -1 = scoreA is worse than scoreBDisparitySelect<int[],
GrayU8> Creates a copy with separate working space.void
configure
(int disparityMin, int disparityRange) Configures the disparity searchvoid
configure
(GrayU8 imageDisparity, @Nullable GrayF32 score, int minDisparity, int maxDisparity, int radiusX) Specifies the output and algorithmic configuration.Type of image the disparity isvoid
process
(int row, int[] scoresArray) Processes the array of scores.void
Computes the score for all possible disparity values across all pixels.void
setBlockScore
(DisparityBlockMatchRowFormat<T, GrayU8> blockScore)
-
Field Details
-
costYXD
-
blockScore
-
-
Constructor Details
-
SgmCostFromBlocks
public SgmCostFromBlocks()
-
-
Method Details
-
configure
public void configure(int disparityMin, int disparityRange) Description copied from interface:SgmDisparityCost
Configures the disparity search- Specified by:
configure
in interfaceSgmDisparityCost<T extends ImageBase<T>>
- Parameters:
disparityMin
- Minimum possible disparity, inclusivedisparityRange
- Number of possible disparity values estimated. The max possible disparity is min+range-1.
-
process
Description copied from interface:SgmDisparityCost
Computes the score for all possible disparity values across all pixels. If a disparity value would go outside of the image then the cost is set toSgmDisparityCost.MAX_COST
- Specified by:
process
in interfaceSgmDisparityCost<T extends ImageBase<T>>
- Parameters:
left
- left imageright
- right imagecostYXD
- Cost of output scaled to have a range of 0 toSgmDisparityCost.MAX_COST
, inclusive. Reshaped to match input and disparity range.
-
configure
public void configure(GrayU8 imageDisparity, @Nullable @Nullable GrayF32 score, int minDisparity, int maxDisparity, int radiusX) Description copied from interface:DisparitySelect
Specifies the output and algorithmic configuration.- Specified by:
configure
in interfaceDisparitySelect<int[],
GrayU8> - Parameters:
imageDisparity
- Output disparity image.score
- If not null, then the score for best fit disparity will be stored here.minDisparity
- Minimum disparity that can be computedmaxDisparity
- Maximum disparity that is calculatedradiusX
- Radius of the rectangular region being matched along x-axis.
-
process
public void process(int row, int[] scoresArray) Description copied from interface:DisparitySelect
Processes the array of scores. The score format is described inDisparityBlockMatch
. The results are written directly into the disparity image passed to it inDisparitySelect.configure(T, boofcv.struct.image.GrayF32, int, int, int)
.- Specified by:
process
in interfaceDisparitySelect<int[],
GrayU8> - Parameters:
row
- Image row the scores are from.scoresArray
- Array containing scores. (int[] or float[])
-
concurrentCopy
Description copied from interface:DisparitySelect
Creates a copy with separate working space. Used for concurrency. Data structures which are threadsafe can be shared- Specified by:
concurrentCopy
in interfaceDisparitySelect<int[],
GrayU8>
-
getDisparityType
Description copied from interface:DisparitySelect
Type of image the disparity is- Specified by:
getDisparityType
in interfaceDisparitySelect<int[],
GrayU8> - Returns:
- Image type for disparity
-
compare
public int compare(int scoreA, int scoreB) Description copied from interface:Compare_S32
- 1 = scoreA is better than scoreB
- 0 = scoreA is equivalent than scoreB
- -1 = scoreA is worse than scoreB
- Specified by:
compare
in interfaceCompare_S32
-
setBlockScore
-