Emgu.CV.CvInvoke.cvProjectPoints2 C# (CSharp) Метод

cvProjectPoints2() приватный Метод

private cvProjectPoints2 ( IntPtr objectPoints, IntPtr rotationVector, IntPtr translationVector, IntPtr intrinsicMatrix, IntPtr distortionCoeffs, IntPtr imagePoints, IntPtr dpdrot, IntPtr dpdt, IntPtr dpdf, IntPtr dpdc, IntPtr dpddist, double aspectRatio ) : void
objectPoints IntPtr
rotationVector IntPtr
translationVector IntPtr
intrinsicMatrix IntPtr
distortionCoeffs IntPtr
imagePoints IntPtr
dpdrot IntPtr
dpdt IntPtr
dpdf IntPtr
dpdc IntPtr
dpddist IntPtr
aspectRatio double
Результат void
        public static extern void cvProjectPoints2(
         IntPtr objectPoints,
         IntPtr rotationVector,
         IntPtr translationVector,
         IntPtr intrinsicMatrix,
         IntPtr distortionCoeffs,
         IntPtr imagePoints,
         IntPtr dpdrot,
         IntPtr dpdt,
         IntPtr dpdf,
         IntPtr dpdc,
         IntPtr dpddist,
         double aspectRatio);

Usage Example

Пример #1
0
        /// <summary>
        /// Computes projections of 3D points to the image plane given intrinsic and extrinsic camera parameters.
        /// Optionally, the function computes jacobians - matrices of partial derivatives of image points as functions of all the input parameters w.r.t. the particular parameters, intrinsic and/or extrinsic.
        /// The jacobians are used during the global optimization in cvCalibrateCamera2 and cvFindExtrinsicCameraParams2.
        /// The function itself is also used to compute back-projection error for with current intrinsic and extrinsic parameters.
        /// </summary>
        /// <remarks>Note, that with intrinsic and/or extrinsic parameters set to special values, the function can be used to compute just extrinsic transformation or just intrinsic transformation (i.e. distortion of a sparse set of points) </remarks>
        /// <param name="objectPoints">The array of object points.</param>
        /// <param name="extrin">Extrinsic parameters</param>
        /// <param name="intrin">Intrinsic parameters</param>
        /// <param name="mats">Optional matrix supplied in the following order: dpdrot, dpdt, dpdf, dpdc, dpddist</param>
        /// <returns>The array of image points which is the projection of <paramref name="objectPoints"/></returns>
        public static PointF[] ProjectPoints(
            MCvPoint3D32f[] objectPoints,
            ExtrinsicCameraParameters extrin,
            IntrinsicCameraParameters intrin,
            params Matrix <float>[] mats)
        {
            PointF[] imagePoints = new PointF[objectPoints.Length];

            int      matsLength = mats.Length;
            GCHandle handle1    = GCHandle.Alloc(objectPoints, GCHandleType.Pinned);
            GCHandle handle2    = GCHandle.Alloc(imagePoints, GCHandleType.Pinned);

            using (Matrix <float> pointMatrix = new Matrix <float>(objectPoints.Length, 1, 3, handle1.AddrOfPinnedObject(), 3 * sizeof(float)))
                using (Matrix <float> imagePointMatrix = new Matrix <float>(imagePoints.Length, 1, 2, handle2.AddrOfPinnedObject(), 2 * sizeof(float)))
                    CvInvoke.cvProjectPoints2(
                        pointMatrix,
                        extrin.RotationVector.Ptr,
                        extrin.TranslationVector.Ptr,
                        intrin.IntrinsicMatrix.Ptr,
                        intrin.DistortionCoeffs.Ptr,
                        imagePointMatrix,
                        matsLength > 0 ? mats[0] : IntPtr.Zero,
                        matsLength > 1 ? mats[1] : IntPtr.Zero,
                        matsLength > 2 ? mats[2] : IntPtr.Zero,
                        matsLength > 3 ? mats[3] : IntPtr.Zero,
                        matsLength > 4 ? mats[4] : IntPtr.Zero,
                        0.0);
            handle1.Free();
            handle2.Free();
            return(imagePoints);
        }
CvInvoke