OpenCvSharp.Cv2.FilterSpeckles C# (CSharp) Method

FilterSpeckles() public static method

filters off speckles (small regions of incorrectly computed disparity)
public static FilterSpeckles ( OpenCvSharp.InputOutputArray img, double newVal, int maxSpeckleSize, double maxDiff, OpenCvSharp.InputOutputArray buf = null ) : void
img OpenCvSharp.InputOutputArray The input 16-bit signed disparity image
newVal double The disparity value used to paint-off the speckles
maxSpeckleSize int The maximum speckle size to consider it a speckle. Larger blobs are not affected by the algorithm
maxDiff double Maximum difference between neighbor disparity pixels to put them into the same blob. /// Note that since StereoBM, StereoSGBM and may be other algorithms return a fixed-point disparity map, where disparity values /// are multiplied by 16, this scale factor should be taken into account when specifying this parameter value.
buf OpenCvSharp.InputOutputArray The optional temporary buffer to avoid memory allocation within the function.
return void
        public static void FilterSpeckles(InputOutputArray img, double newVal, int maxSpeckleSize, double maxDiff,
            InputOutputArray buf = null)
        {
            if (img == null)
                throw new ArgumentNullException(nameof(img));
            img.ThrowIfNotReady();

            NativeMethods.calib3d_filterSpeckles(img.CvPtr, newVal, maxSpeckleSize, maxDiff, ToPtr(buf));
            img.Fix();
        }
Cv2