當前位置: 首頁>>代碼示例>>C#>>正文


C# OpenCvSharp.CvArr類代碼示例

本文整理匯總了C#中OpenCvSharp.CvArr的典型用法代碼示例。如果您正苦於以下問題:C# CvArr類的具體用法?C# CvArr怎麽用?C# CvArr使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CvArr類屬於OpenCvSharp命名空間,在下文中一共展示了CvArr類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DecRefData

        /// <summary>
        /// 參照カウンタのポインタが null ではない場合に CvMat あるいは CvMatND のデータの參照カウンタをデクリメントし,さらにカウンタが 0 になった場合にはデータを解放する.
        /// </summary>
        /// <param name="arr">配列ヘッダ</param>
#else
        /// <summary>
        /// Decrements array data reference counter.
        /// </summary>
        /// <param name="arr">Input array. </param>
#endif
        public static void DecRefData(CvArr arr)
        {
            if (arr == null)
            {
                throw new ArgumentNullException("arr");
            }
            unsafe
            {
                if (arr is CvMat)
                {
                    CvMat mat = (CvMat)arr;
                    mat.Data = IntPtr.Zero;
                    if (mat.RefCount != IntPtr.Zero && --*(int*)mat.RefCount == 0)
                        NativeMethods.cvFree_(mat.RefCount);
                    mat.RefCount = IntPtr.Zero;
                }
                else if (arr is CvMatND)
                {
                    CvMatND mat = (CvMatND)arr;
                    mat.Data = IntPtr.Zero;
                    if (mat.RefCount != IntPtr.Zero && --*(int*)mat.RefCount == 0)
                        NativeMethods.cvFree_(mat.RefCount);
                    mat.RefCount = IntPtr.Zero;
                }
            }
        }
開發者ID:0sv,項目名稱:opencvsharp,代碼行數:36,代碼來源:Cv_D.cs

示例2: ValidateDisparity

        /// <summary>
        /// 
        /// </summary>
        /// <param name="disparity"></param>
        /// <param name="cost"></param>
        /// <param name="minDisparity"></param>
        /// <param name="numberOfDisparities"></param>
        /// <param name="disp12MaxDiff"></param>
#else
        /// <summary>
        /// 
        /// </summary>
        /// <param name="disparity"></param>
        /// <param name="cost"></param>
        /// <param name="minDisparity"></param>
        /// <param name="numberOfDisparities"></param>
        /// <param name="disp12MaxDiff"></param>
#endif
        public static void ValidateDisparity(CvArr disparity, CvArr cost, int minDisparity, int numberOfDisparities, int disp12MaxDiff)
        {
            if (disparity == null)
                throw new ArgumentNullException("disparity");
            if (cost == null)
                throw new ArgumentNullException("cost");
            NativeMethods.cvValidateDisparity(disparity.CvPtr, cost.CvPtr, minDisparity, numberOfDisparities, disp12MaxDiff);
        }
開發者ID:jorik041,項目名稱:opencvsharp,代碼行數:26,代碼來源:Cv_V.cs

示例3: CvMoments

        /// <summary>
        /// cvMomentsにより初期化
        /// </summary>
        /// <param name="arr">畫像(1チャンネル,あるいはCOIをもつ3チャンネル畫像) あるいはポリゴン (CvSeqで表される點群,または點のベクトル).</param>
        /// <param name="binary">(畫像の場合のみ)このフラグがtrueの場合,値0のピクセルは0として,その他のピクセル値は1として扱われる. </param>
#else
        /// <summary>
        /// Initialize by cvMoments
        /// </summary>
        /// <param name="arr">Image (1-channel or 3-channel with COI set) or polygon (CvSeq of points or a vector of points). </param>
        /// <param name="binary">(For images only) If the flag is non-zero, all the zero pixel values are treated as zeroes, all the others are treated as 1’s. </param>
#endif
        public CvMoments(CvArr arr, bool binary)
        {
            if (arr == null)
            {
                throw new ArgumentNullException("arr");
            }
            CvInvoke.cvMoments(arr.CvPtr, this, binary);
        }
開發者ID:neoxeo,項目名稱:opencvsharp,代碼行數:20,代碼來源:CvMoments.cs

示例4: AbsDiffS

        /// <summary>
        /// 配列の要素と定數との差の絶対値を計算する. 
        /// dst(I) = abs(src(I) - value).
        /// </summary>
        /// <param name="src">1番目の入力畫像</param>
        /// <param name="dst">出力畫像</param>
        /// <param name="value">スカラー</param>
#else
        /// <summary>
        /// Calculates absolute difference between array and scalar
        /// </summary>
        /// <param name="src">The source array. </param>
        /// <param name="dst">The destination array. </param>
        /// <param name="value">The scalar. </param>
#endif
        public static void AbsDiffS(CvArr src, CvArr dst, CvScalar value)
        {
            if (src == null)
                throw new ArgumentNullException("src");
            if (dst == null)
                throw new ArgumentNullException("dst");
            NativeMethods.cvAbsDiffS(src.CvPtr, dst.CvPtr, value);
        }
開發者ID:jorik041,項目名稱:opencvsharp,代碼行數:23,代碼來源:Cv_A.cs

示例5: Abs

        /// <summary>
        /// 配列の要素の絶対値を計算する. 
        /// dst(I) = abs(src(I)).
        /// すべての配列は同じタイプ,同じサイズ(または同じROIサイズ)でなければならない.
        /// </summary>
        /// <param name="src">入力畫像</param>
        /// <param name="dst">出力畫像</param>
#else
        /// <summary>
        /// Calculates absolute difference between array and scalar
        /// </summary>
        /// <param name="src">The source array. </param>
        /// <param name="dst">The destination array. </param>
#endif
        public static void Abs(CvArr src, CvArr dst)
        {
            if (src == null)
                throw new ArgumentNullException("src");
            if (dst == null)
                throw new ArgumentNullException("dst");
            CvInvoke.cvAbsDiffS(src.CvPtr, dst.CvPtr, CvScalar.ScalarAll(0));
        }
開發者ID:sanglin307,項目名稱:UnityOpenCV,代碼行數:22,代碼來源:Cv_A.cs

示例6: DCT

        /// <summary>
        /// 次元あるいは2次元浮動小數點型配列の順方向・逆方向離散コサイン変換を行う
        /// </summary>
        /// <param name="src">入力配列(実數の1次元あるいは2次元配列)</param>
        /// <param name="dst">入力と同じサイズ・タイプの出力配列</param>
        /// <param name="flags">変換フラグ</param>
#else
        /// <summary>
        /// Performs forward or inverse Discrete Cosine transform of 1D or 2D floating-point array
        /// </summary>
        /// <param name="src">Source array, real 1D or 2D array. </param>
        /// <param name="dst">Destination array of the same size and same type as the source. </param>
        /// <param name="flags">Transformation flags.</param>
#endif
        public static void DCT(CvArr src, CvArr dst, DCTFlag flags)
        {
            if (src == null)
                throw new ArgumentNullException("src");
            if (dst == null)
                throw new ArgumentNullException("dst");
            NativeMethods.cvDCT(src.CvPtr, dst.CvPtr, flags);
        }
開發者ID:0sv,項目名稱:opencvsharp,代碼行數:22,代碼來源:Cv_D.cs

示例7: Det

        /// <summary>
        /// 行列式を返す
        /// </summary>
        /// <param name="mat">入力行列</param>
        /// <returns>行列式</returns>
#else
        /// <summary>
        /// Returns determinant of matrix
        /// </summary>
        /// <param name="mat">The source matrix. </param>
        /// <returns>determinant of the square matrix mat</returns>
#endif
        public static double Det(CvArr mat)
        {
            if (mat == null)
            {
                throw new ArgumentNullException("mat");
            }
            return NativeMethods.cvDet(mat.CvPtr);
        }
開發者ID:0sv,項目名稱:opencvsharp,代碼行數:20,代碼來源:Cv_D.cs

示例8: AbsDiff

        /// <summary>
        /// 二つの配列の要素ごとの差の絶対値を計算する.
        /// dst(I) = abs(src1(I) - src2(I)).
        /// </summary>
        /// <param name="src1">1番目の入力畫像</param>
        /// <param name="src2">2番目の入力畫像</param>
        /// <param name="dst">出力畫像</param>
#else
        /// <summary>
        /// Calculates absolute difference between two arrays
        /// </summary>
        /// <param name="src1">The first source array. </param>
        /// <param name="src2">The second source array. </param>
        /// <param name="dst">The destination array. </param>
#endif
        public static void AbsDiff(CvArr src1, CvArr src2, CvArr dst)
        {
            if (src1 == null)
                throw new ArgumentNullException("src1");
            if (src2 == null)
                throw new ArgumentNullException("src2");
            if (dst == null)
                throw new ArgumentNullException("dst");
            NativeMethods.cvAbsDiff(src1.CvPtr, src2.CvPtr, dst.CvPtr);
        }
開發者ID:jorik041,項目名稱:opencvsharp,代碼行數:25,代碼來源:Cv_A.cs

示例9: CorrectGamma

        /// <summary>
        /// Corrects gamma
        /// </summary>
        /// <param name="src"></param>
        /// <param name="dst"></param>
        /// <param name="gamma"></param>
        public void CorrectGamma(CvArr src, CvArr dst, double gamma)
        {
            byte[] lut = new byte[256];
            for (int i = 0; i < lut.Length; i++)
            {
                lut[i] = (byte)(Math.Pow(i / 255.0, 1.0 / gamma) * 255.0);
            }

            Cv.LUT(src, dst, lut);
        }
開發者ID:qxp1011,項目名稱:opencvsharp,代碼行數:16,代碼來源:GammaCorrection.cs

示例10: Xor

        /// <summary>
        /// 二つの配列の要素ごとの排他的論理和(XOR)を計算する. 
        /// dst(I)=src1(I)^src2(I) [mask(I)!=0の場合]
        /// </summary>
        /// <param name="src1">1番目の入力配列</param>
        /// <param name="src2">2番目の入力配列</param>
        /// <param name="dst">出力配列</param>
        /// <param name="mask">処理マスク.8ビットシングルチャンネル配列(出力配列のどの要素が変更されるかを指定する). </param>
#else
        /// <summary>
        /// Performs per-element bit-wise "exclusive or" operation on two arrays
        /// </summary>
        /// <param name="src1">The first source array. </param>
        /// <param name="src2">The second source array. </param>
        /// <param name="dst">The destination array. </param>
        /// <param name="mask">Operation mask, 8-bit single channel array; specifies elements of destination array to be changed. </param>
#endif
        public static void Xor(CvArr src1, CvArr src2, CvArr dst, CvArr mask)
        {
            if (src1 == null)
                throw new ArgumentNullException("src1");
            if (src2 == null)
                throw new ArgumentNullException("src2");
            if (dst == null)
                throw new ArgumentNullException("dst");
            IntPtr maskPtr = (mask == null) ? IntPtr.Zero : mask.CvPtr;
            CvInvoke.cvXor(src1.CvPtr, src2.CvPtr, dst.CvPtr, maskPtr);
        }
開發者ID:sanglin307,項目名稱:UnityOpenCV,代碼行數:28,代碼來源:Cv_X.cs

示例11: BackProjectPCA

        /// <summary>
        /// 投影係數から元のベクトルを再構築する
        /// </summary>
        /// <param name="proj">入力データ.</param>
        /// <param name="avg">平均ベクトル.もし単一行ベクトルの場合,出力ベクトルがresultの行として保存されていることを意味する.そうでない場合は,単一列ベクトルであり,そのときはresultの列として保存される.</param>
        /// <param name="eigenvects">固有ベクトル(主成分).一つの行が一つのベクトルを意味する.</param>
        /// <param name="result">出力である再構築されたベクトルの行列.</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Reconstructs the original vectors from the projection coefficients
        /// </summary>
        /// <param name="proj">The input data; in the same format as result in cvProjectPCA. </param>
        /// <param name="avg">The mean (average) vector. If it is a single-row vector, it means that the output vectors are stored as rows of result; otherwise, it should be a single-column vector, then the vectors are stored as columns of result. </param>
        /// <param name="eigenvects">The eigenvectors (principal components); one vector per row. </param>
        /// <param name="result">The output matrix of reconstructed vectors. </param>
        /// <returns></returns>
#endif
        public static void BackProjectPCA(CvArr proj, CvArr avg, CvArr eigenvects, CvArr result)
        {
            if (proj == null)
                throw new ArgumentNullException("proj");
            if (avg == null)
                throw new ArgumentNullException("avg");
            if (eigenvects == null)
                throw new ArgumentNullException("eigenvects");
            
            NativeMethods.cvBackProjectPCA(proj.CvPtr, avg.CvPtr, eigenvects.CvPtr, result.CvPtr);
        }
開發者ID:0sv,項目名稱:opencvsharp,代碼行數:29,代碼來源:Cv_B.cs

示例12: Undistort2

        /// <summary>
        /// 半徑方向や円周方向のレンズ歪みを補正するために畫像を変換する.
        /// </summary>
        /// <param name="src">入力畫像(歪みあり)</param>
        /// <param name="dst">出力畫像(補正済み)</param>
        /// <param name="intrinsicMatrix">カメラ內部行列 (A) [fx 0 cx; 0 fy cy; 0 0 1]. </param>
        /// <param name="distortionCoeffs">歪み係數ベクトル. 4x1 または 1x4 [k1, k2, p1, p2]. </param>
        /// <param name="newCameraMatrix"></param>
#else
        /// <summary>
        /// Transforms image to compensate lens distortion.
        /// </summary>
        /// <param name="src">The input (distorted) image. </param>
        /// <param name="dst">The output (corrected) image. </param>
        /// <param name="intrinsicMatrix">The camera matrix (A) [fx 0 cx; 0 fy cy; 0 0 1]. </param>
        /// <param name="distortionCoeffs">The vector of distortion coefficients, 4x1 or 1x4 [k1, k2, p1, p2]. </param>
        /// <param name="newCameraMatrix"></param>
#endif
        public static void Undistort2(CvArr src, CvArr dst, CvMat intrinsicMatrix, CvMat distortionCoeffs, CvMat newCameraMatrix)
        {
            if (src == null)
                throw new ArgumentNullException("src");
            if (dst == null)
                throw new ArgumentNullException("dst");
            if (intrinsicMatrix == null)
                throw new ArgumentNullException("intrinsicMatrix");
            if (distortionCoeffs == null)
                throw new ArgumentNullException("distortionCoeffs");

            IntPtr newCameraMatrixPtr = (newCameraMatrix == null) ? IntPtr.Zero : newCameraMatrix.CvPtr;
            NativeMethods.cvUndistort2(src.CvPtr, dst.CvPtr, intrinsicMatrix.CvPtr, distortionCoeffs.CvPtr, newCameraMatrixPtr);
        }
開發者ID:jorik041,項目名稱:opencvsharp,代碼行數:32,代碼來源:CV_U.cs

示例13: Undistort2

        /// <summary>
        /// 半徑方向や円周方向のレンズ歪みを補正するために畫像を変換する.
        /// </summary>
        /// <param name="src">入力畫像(歪みあり)</param>
        /// <param name="dst">出力畫像(補正済み)</param>
        /// <param name="intrinsic_matrix">カメラ內部行列 (A) [fx 0 cx; 0 fy cy; 0 0 1]. </param>
        /// <param name="distortion_coeffs">歪み係數ベクトル. 4x1 または 1x4 [k1, k2, p1, p2]. </param>
        /// <param name="new_camera_matrix"></param>
#else
        /// <summary>
        /// Transforms image to compensate lens distortion.
        /// </summary>
        /// <param name="src">The input (distorted) image. </param>
        /// <param name="dst">The output (corrected) image. </param>
        /// <param name="intrinsic_matrix">The camera matrix (A) [fx 0 cx; 0 fy cy; 0 0 1]. </param>
        /// <param name="distortion_coeffs">The vector of distortion coefficients, 4x1 or 1x4 [k1, k2, p1, p2]. </param>
        /// <param name="new_camera_matrix"></param>
#endif
        public static void Undistort2(CvArr src, CvArr dst, CvMat intrinsic_matrix, CvMat distortion_coeffs, CvMat new_camera_matrix)
        {
            if (src == null)
                throw new ArgumentNullException("src");
            if (dst == null)
                throw new ArgumentNullException("dst");
            if (intrinsic_matrix == null)
                throw new ArgumentNullException("intrinsic_matrix");
            if (distortion_coeffs == null)
                throw new ArgumentNullException("distortion_coeffs");

            IntPtr new_camera_matrix_ptr = (new_camera_matrix == null) ? IntPtr.Zero : new_camera_matrix.CvPtr;
            CvInvoke.cvUndistort2(src.CvPtr, dst.CvPtr, intrinsic_matrix.CvPtr, distortion_coeffs.CvPtr, new_camera_matrix_ptr);
        }
開發者ID:sanglin307,項目名稱:UnityOpenCV,代碼行數:32,代碼來源:CV_U.cs

示例14: Xor

        /// <summary>
        /// 二つの配列の要素ごとの排他的論理和(XOR)を計算する. 
        /// dst(I)=src1(I)^src2(I) [mask(I)!=0の場合]
        /// </summary>
        /// <param name="src1">1番目の入力配列</param>
        /// <param name="src2">2番目の入力配列</param>
        /// <param name="dst">出力配列</param>
        /// <param name="mask">処理マスク.8ビットシングルチャンネル配列(出力配列のどの要素が変更されるかを指定する). </param>
#else
        /// <summary>
        /// Performs per-element bit-wise "exclusive or" operation on two arrays
        /// </summary>
        /// <param name="src1">The first source array. </param>
        /// <param name="src2">The second source array. </param>
        /// <param name="dst">The destination array. </param>
        /// <param name="mask">Operation mask, 8-bit single channel array; specifies elements of destination array to be changed. </param>
#endif
        public static void Xor(CvArr src1, CvArr src2, CvArr dst, CvArr mask)
        {
            if (src1 == null)
                throw new ArgumentNullException("src1");
            if (src2 == null)
                throw new ArgumentNullException("src2");
            if (dst == null)
                throw new ArgumentNullException("dst");
            IntPtr maskPtr = (mask == null) ? IntPtr.Zero : mask.CvPtr;
            NativeMethods.cvXor(src1.CvPtr, src2.CvPtr, dst.CvPtr, maskPtr);

            GC.KeepAlive(src1);
            GC.KeepAlive(src2);
            GC.KeepAlive(dst);
            GC.KeepAlive(mask);
        }
開發者ID:0sv,項目名稱:opencvsharp,代碼行數:33,代碼來源:Cv_X.cs

示例15: Undistort2

        /// <summary>
        /// 半徑方向や円周方向のレンズ歪みを補正するために畫像を変換する.
        /// </summary>
        /// <param name="src">入力畫像(歪みあり)</param>
        /// <param name="dst">出力畫像(補正済み)</param>
        /// <param name="intrinsicMatrix">カメラ內部行列 (A) [fx 0 cx; 0 fy cy; 0 0 1]. </param>
        /// <param name="distortionCoeffs">歪み係數ベクトル. 4x1 または 1x4 [k1, k2, p1, p2]. </param>
        /// <param name="newCameraMatrix"></param>
#else
        /// <summary>
        /// Transforms image to compensate lens distortion.
        /// </summary>
        /// <param name="src">The input (distorted) image. </param>
        /// <param name="dst">The output (corrected) image. </param>
        /// <param name="intrinsicMatrix">The camera matrix (A) [fx 0 cx; 0 fy cy; 0 0 1]. </param>
        /// <param name="distortionCoeffs">The vector of distortion coefficients, 4x1 or 1x4 [k1, k2, p1, p2]. </param>
        /// <param name="newCameraMatrix"></param>
#endif
        public static void Undistort2(CvArr src, CvArr dst, CvMat intrinsicMatrix, CvMat distortionCoeffs, CvMat newCameraMatrix)
        {
            if (src == null)
                throw new ArgumentNullException("src");
            if (dst == null)
                throw new ArgumentNullException("dst");
            if (intrinsicMatrix == null)
                throw new ArgumentNullException("intrinsicMatrix");
            if (distortionCoeffs == null)
                throw new ArgumentNullException("distortionCoeffs");

            NativeMethods.cvUndistort2(
                src.CvPtr, dst.CvPtr, intrinsicMatrix.CvPtr, distortionCoeffs.CvPtr, ToPtr(newCameraMatrix));
            
            GC.KeepAlive(src);
            GC.KeepAlive(dst);
            GC.KeepAlive(intrinsicMatrix);
            GC.KeepAlive(distortionCoeffs);
            GC.KeepAlive(newCameraMatrix);
        }
開發者ID:0sv,項目名稱:opencvsharp,代碼行數:38,代碼來源:CV_U.cs


注:本文中的OpenCvSharp.CvArr類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。