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
FieldsFields inherited from interface boofcv.alg.disparity.sgm.SgmDisparityCost
MAX_COST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompare(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.voidconfigure(int disparityMin, int disparityRange) Configures the disparity searchvoidconfigure(GrayU8 imageDisparity, @Nullable GrayF32 score, int minDisparity, int maxDisparity, int radiusX) Specifies the output and algorithmic configuration.Type of image the disparity isvoidprocess(int row, int[] scoresArray) Processes the array of scores.voidComputes the score for all possible disparity values across all pixels.voidsetBlockScore(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:SgmDisparityCostConfigures the disparity search- Specified by:
configurein 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:SgmDisparityCostComputes 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:
processin 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:DisparitySelectSpecifies the output and algorithmic configuration.- Specified by:
configurein 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:DisparitySelectProcesses 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:
processin interfaceDisparitySelect<int[],GrayU8> - Parameters:
row- Image row the scores are from.scoresArray- Array containing scores. (int[] or float[])
-
concurrentCopy
Description copied from interface:DisparitySelectCreates a copy with separate working space. Used for concurrency. Data structures which are threadsafe can be shared- Specified by:
concurrentCopyin interfaceDisparitySelect<int[],GrayU8>
-
getDisparityType
Description copied from interface:DisparitySelectType of image the disparity is- Specified by:
getDisparityTypein 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:
comparein interfaceCompare_S32
-
setBlockScore
-