/// <summary> /// Computes disparity map for the specified stereo pair /// </summary> /// <param name="matcher">The stereo matcher</param> /// <param name="left">Left 8-bit single-channel image.</param> /// <param name="right">Right image of the same size and the same type as the left one.</param> /// <param name="disparity">Output disparity map. It has the same size as the input images. Some algorithms, like StereoBM or StereoSGBM compute 16-bit fixed-point disparity map (where each disparity value has 4 fractional bits), whereas other algorithms output 32-bit floating-point disparity map</param> public static void Compute(this IStereoMatcher matcher, IInputArray left, IInputArray right, IOutputArray disparity) { using (InputArray iaLeft = left.GetInputArray()) using (InputArray iaRight = right.GetInputArray()) using (OutputArray oaDisparity = disparity.GetOutputArray()) cveStereoMatcherCompute(matcher.StereoMatcherPtr, iaLeft, iaRight, oaDisparity); }
/// <summary> /// Creates an instance of DisparityWLSFilter and sets up all the relevant filter parameters automatically based on the matcher instance. Currently supports only StereoBM and StereoSGBM. /// </summary> /// <param name="matcherLeft">stereo matcher instance that will be used with the filter</param> public DisparityWLSFilter(IStereoMatcher matcherLeft) { _ptr = XImgprocInvoke.cveCreateDisparityWLSFilter( matcherLeft.StereoMatcherPtr, ref _disparityFilterPtr, ref _algorithm, ref _sharedPtr); }
/// <summary> /// Set up the matcher for computing the right-view disparity map that is required in case of filtering with confidence. /// </summary> /// <param name="matcherLeft">Main stereo matcher instance that will be used with the filter</param> public RightMatcher(IStereoMatcher matcherLeft) { _ptr = XImgprocInvoke.cveCreateRightMatcher(matcherLeft.StereoMatcherPtr, ref _sharedPtr); }