public static < T extends ImageGray < T > > StereoDisparitySparse < T > regionSparseWta ( int minDisparity , int maxDisparity , int regionRadiusX , int regionRadiusY , double maxPerPixelError , double texture , boolean subpixelInterpolation , Class < T > imageType ) { double maxError = ( regionRadiusX * 2 + 1 ) * ( regionRadiusY * 2 + 1 ) * maxPerPixelError ; if ( imageType == GrayU8 . class ) { DisparitySparseSelect < int [ ] > select ; if ( subpixelInterpolation ) select = selectDisparitySparseSubpixel_S32 ( ( int ) maxError , texture ) ; else select = selectDisparitySparse_S32 ( ( int ) maxError , texture ) ; DisparitySparseScoreSadRect < int [ ] , GrayU8 > score = scoreDisparitySparseSadRect_U8 ( minDisparity , maxDisparity , regionRadiusX , regionRadiusY ) ; return new WrapDisparitySparseSadRect ( score , select ) ; } else if ( imageType == GrayF32 . class ) { DisparitySparseSelect < float [ ] > select ; if ( subpixelInterpolation ) select = selectDisparitySparseSubpixel_F32 ( ( int ) maxError , texture ) ; else select = selectDisparitySparse_F32 ( ( int ) maxError , texture ) ; DisparitySparseScoreSadRect < float [ ] , GrayF32 > score = scoreDisparitySparseSadRect_F32 ( minDisparity , maxDisparity , regionRadiusX , regionRadiusY ) ; return new WrapDisparitySparseSadRect ( score , select ) ; } else throw new RuntimeException ( "Image type not supported: " + imageType . getSimpleName ( ) ) ; }
WTA algorithms that computes disparity on a sparse per - pixel basis as requested ..