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 Details

  • 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 interface SgmDisparityCost<T extends ImageBase<T>>
      Parameters:
      disparityMin - Minimum possible disparity, inclusive
      disparityRange - Number of possible disparity values estimated. The max possible disparity is min+range-1.
    • process

      public void process​(T left, T right, Planar<GrayU16> costYXD)
      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 to SgmDisparityCost.MAX_COST
      Specified by:
      process in interface SgmDisparityCost<T extends ImageBase<T>>
      Parameters:
      left - left image
      right - right image
      costYXD - Cost of output scaled to have a range of 0 to SgmDisparityCost.MAX_COST, inclusive. Reshaped to match input and disparity range.
    • configure

      public void configure​(GrayU8 imageDisparity, int minDisparity, int maxDisparity, int radiusX)
      Description copied from interface: DisparitySelect
      Specifies the output and algorithmic configuration.
      Specified by:
      configure in interface DisparitySelect<int[],​GrayU8>
      Parameters:
      imageDisparity - Output disparity image.
      minDisparity - Minimum disparity that can be computed
      maxDisparity - Maximum disparity that is calculated
      radiusX - 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 in DisparityBlockMatch. The results are written directly into the disparity image passed to it in DisparitySelect.configure(ImageGray, int, int, int).
      Specified by:
      process in interface DisparitySelect<int[],​GrayU8>
      Parameters:
      row - Image row the scores are from.
      scoresArray - Array containing scores. (int[] or float[])
    • concurrentCopy

      public DisparitySelect<int[],​GrayU8> 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 interface DisparitySelect<int[],​GrayU8>
    • getDisparityType

      public Class<GrayU8> getDisparityType()
      Description copied from interface: DisparitySelect
      Type of image the disparity is
      Specified by:
      getDisparityType in interface DisparitySelect<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 interface Compare_S32
    • setBlockScore

      public void setBlockScore​(DisparityBlockMatchRowFormat<T,​GrayU8> blockScore)