/// <summary> /// Release the unmanaged memory associated with this object /// </summary> protected override void DisposeObject() { if (_sharedPtr != IntPtr.Zero) { RgbdInvoke.cveOdometryRelease(ref _sharedPtr); _algorithmPtr = IntPtr.Zero; _ptr = IntPtr.Zero; } }
/// <summary> /// Given a set of 3d points in a depth image, compute the normals at each point. /// </summary> /// <param name="points">A rows x cols x 3 matrix of CV_32F/CV64F or a rows x cols x 1 CV_U16S</param> /// <param name="normals">A rows x cols x 3 matrix</param> public void Apply( IInputArray points, IOutputArray normals) { using (InputArray iaPoints = points.GetInputArray()) using (OutputArray oaNormals = normals.GetOutputArray()) RgbdInvoke.cveRgbdNormalsApply( _ptr, iaPoints, oaNormals); }
/// <summary> /// Create a new RgbdNormals object that can compute the normals in an image. /// </summary> /// <param name="rows">The number of rows of the depth image normals will be computed on</param> /// <param name="cols">The number of cols of the depth image normals will be computed on</param> /// <param name="depth">The depth of the normals (only CV_32F or CV_64F)</param> /// <param name="k">The calibration matrix to use</param> /// <param name="windowSize">The window size to compute the normals: can only be 1,3,5 or 7</param> /// <param name="method">The methods to use</param> public RgbdNormals( int rows, int cols, DepthType depth, IInputArray k, int windowSize = 5, Method method = Method.Fals) { using (InputArray iaK = k.GetInputArray()) _ptr = RgbdInvoke.cveRgbdNormalsCreate( rows, cols, depth, iaK, windowSize, method, ref _algorithmPtr, ref _sharedPtr ); }
/// <summary> /// Method to compute a transformation from the source frame to the destination one. Some odometry algorithms do not used some data of frames (eg. ICP does not use images). In such case corresponding arguments can be set as empty Mat. The method returns true if all internal computations were possible (e.g. there were enough correspondences, system of equations has a solution, etc) and resulting transformation satisfies some test if it's provided by the Odometry inheritor implementation (e.g. thresholds for maximum translation and rotation). /// </summary> /// <param name="srcImage">Image data of the source frame (CV_8UC1)</param> /// <param name="srcDepth">Depth data of the source frame (CV_32FC1, in meters)</param> /// <param name="srcMask">Mask that sets which pixels have to be used from the source frame (CV_8UC1)</param> /// <param name="dstImage">Image data of the destination frame (CV_8UC1)</param> /// <param name="dstDepth">Depth data of the destination frame (CV_32FC1, in meters)</param> /// <param name="dstMask">Mask that sets which pixels have to be used from the destination frame (CV_8UC1)</param> /// <param name="rt">Resulting transformation from the source frame to the destination one (rigid body motion): dst_p = Rt * src_p, where dst_p is a homogeneous point in the destination frame and src_p is homogeneous point in the source frame, Rt is 4x4 matrix of CV_64FC1 type.</param> /// <param name="initRt">Initial transformation from the source frame to the destination one (optional)</param> /// <returns>True if all internal computations were possible</returns> public bool Compute( Mat srcImage, Mat srcDepth, Mat srcMask, Mat dstImage, Mat dstDepth, Mat dstMask, IOutputArray rt, Mat initRt = null) { using (OutputArray oaRt = rt.GetOutputArray()) return(RgbdInvoke.cveOdometryCompute( _ptr, srcImage, srcDepth, srcMask, dstImage, dstDepth, dstMask, oaRt, initRt)); }
/// <summary> /// Create an Odometry instance. /// </summary> /// <param name="odometryType">One of the odometry type: "RgbdOdometry", "ICPOdometry", "RgbdICPOdometry" or "FastICPOdometry" </param> public Odometry(String odometryType) { using (CvString csOdometryType = new CvString(odometryType)) _ptr = RgbdInvoke.cveOdometryCreate(csOdometryType, ref _algorithmPtr, ref _sharedPtr); }