本文整理汇总了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;
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}