本文整理匯總了C#中OpenCvSharp.CvTermCriteria類的典型用法代碼示例。如果您正苦於以下問題:C# CvTermCriteria類的具體用法?C# CvTermCriteria怎麽用?C# CvTermCriteria使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CvTermCriteria類屬於OpenCvSharp命名空間,在下文中一共展示了CvTermCriteria類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CvLevMarq
public CvLevMarq()
{
Mask = PrevParam = Param = J = Err = JtJ = JtJN = JtErr = JtJV = JtJW = null;
LambdaLg10 = 0;
State = LevMarqState.Done;
Criteria = new CvTermCriteria(0, 0);
Iters = 0;
CompleteSymmFlag = false;
}
示例2: Start
// Use this for initialization
void Start()
{
cascade = CvHaarClassifierCascade.FromFile(@"./Assets/haarcascade_frontalface_alt.xml");
capture = Cv.CreateCameraCapture(0);
Cv.SetCaptureProperty(capture, CaptureProperty.FrameWidth, CAPTURE_WIDTH);
Cv.SetCaptureProperty(capture, CaptureProperty.FrameHeight, CAPTURE_HEIGHT);
IplImage frame = Cv.QueryFrame(capture);
Cv.NamedWindow("FaceDetect");
CvSVM svm = new CvSVM ();
CvTermCriteria criteria = new CvTermCriteria (CriteriaType.Epsilon, 1000, double.Epsilon);
CvSVMParams param = new CvSVMParams (CvSVM.C_SVC, CvSVM.RBF, 10.0, 8.0, 1.0, 10.0, 0.5, 0.1, null, criteria);
}
示例3: Awake
void Awake()
{
_cap = new CvCapture(0);
_capImage = _cap.QueryFrame();
_capRgbImage = new IplImage(_capImage.Width, _capImage.Height, BitDepth.U8, 3);
Debug.Log(string.Format("Capture info : size{0}", _capImage.Size));
_capGrayImage0 = new IplImage(_capImage.Size, BitDepth.U8, 1);
_capGrayImage1 = new IplImage(_capImage.Size, BitDepth.U8, 1);
_pyramidImage0 = new IplImage(new CvSize(_capImage.Width + 8, _capImage.Height/3), BitDepth.U8, 1);
_pyramidImage1 = new IplImage(new CvSize(_capImage.Width + 8, _capImage.Height/3), BitDepth.U8, 1);
_eigImage = new IplImage(_capImage.Size, BitDepth.F32, 1);
_tmpImage = new IplImage(_capImage.Size, BitDepth.F32, 1);
Cv.ConvertImage(_capImage, _capGrayImage0, 0);
width = _capImage.Width;
height = _capImage.Height;
_opticalFlowWinSize = new CvSize(opticalFlowWinSize, opticalFlowWinSize);
_opticalFlowCrit = new CvTermCriteria(CriteriaType.Iteration | CriteriaType.Epsilon, ofCritIterations, ofCritError);
_prevTime = _currTime = UnityEngine.Time.time;
}
示例4: KMeans2
/// <summary>
/// ベクトル集合を,與えられたクラスタ數に分割する.
/// 入力サンプルを各クラスタに分類するために cluster_count 個のクラスタの中心を求める k-means 法を実裝する.
/// 出力 labels(i) は,配列 samples のi番目の行のサンプルが屬するクラスタのインデックスを表す.
/// </summary>
/// <param name="samples">浮動小數點型の入力サンプル行列.1行あたり一つのサンプル.</param>
/// <param name="samplesType"></param>
/// <param name="clusterCount">集合を分割するクラスタ數</param>
/// <param name="labels">出力の整數ベクトル.すべてのサンプルについて,それぞれがどのクラスタに屬しているかが保存されている.</param>
/// <param name="termcrit">最大繰り返し數と(または),精度(1ループでの各クラスタ中心位置移動距離)の指定</param>
/// <param name="attemps"></param>
/// <param name="rng"></param>
/// <param name="flag"></param>
/// <param name="centers"></param>
/// <param name="compactness"></param>
/// <returns></returns>
#else
/// <summary>
/// Splits set of vectors by given number of clusters
/// </summary>
/// <param name="samples">Floating-point matrix of input samples, one row per sample. </param>
/// <param name="samplesType"></param>
/// <param name="clusterCount">Number of clusters to split the set by. </param>
/// <param name="labels">Output integer vector storing cluster indices for every sample. </param>
/// <param name="termcrit">Specifies maximum number of iterations and/or accuracy (distance the centers move by between the subsequent iterations). </param>
/// <param name="attemps"></param>
/// <param name="rng"></param>
/// <param name="flag"></param>
/// <param name="centers"></param>
/// <param name="compactness"></param>
/// <returns></returns>
#endif
public static int KMeans2(Array samples, MatrixType samplesType, int clusterCount, int[] labels, CvTermCriteria termcrit, int attemps, CvRNG rng, KMeansFlag flag, CvArr centers, out double compactness)
{
if (samples == null)
throw new ArgumentNullException("samples");
using (CvMat samplesMat = new CvMat(labels.Length, 1, samplesType, samples, false))
using (CvMat labelsMat = new CvMat(labels.Length, 1, MatrixType.S32C1, labels, false))
{
return KMeans2(samplesMat, clusterCount, labelsMat, termcrit, attemps, rng, flag, centers, out compactness);
}
}
示例5: cvCamShift
public static extern int cvCamShift(IntPtr prob_image, CvRect window, CvTermCriteria criteria, IntPtr comp, ref CvBox2D box);
示例6: cvPyrMeanShiftFiltering
public static extern void cvPyrMeanShiftFiltering(IntPtr src, IntPtr dst, double sp, double sr, int max_level, CvTermCriteria termcrit);
示例7: cvKMeans2
public static extern int cvKMeans2(IntPtr samples, int cluster_count, IntPtr labels, CvTermCriteria termcrit,
int attempts, ref UInt64 rng, [MarshalAs(UnmanagedType.I4)] KMeansFlag flags, IntPtr _centers, out double compactness);
示例8: cvSnakeImage
public static extern void cvSnakeImage(IntPtr image, IntPtr points, int length,
[MarshalAs(UnmanagedType.LPArray)] float[] alpha, [MarshalAs(UnmanagedType.LPArray)] float[] beta, [MarshalAs(UnmanagedType.LPArray)] float[] gamma,
int coeffUsage, CvSize win, CvTermCriteria criteria, [MarshalAs(UnmanagedType.Bool)] bool calc_gradient);
示例9: cvStereoCalibrate
public static extern void cvStereoCalibrate(IntPtr object_points, IntPtr image_points1, IntPtr image_points2, IntPtr npoints,
IntPtr camera_matrix1, IntPtr dist_coeffs1, IntPtr camera_matrix2, IntPtr dist_coeffs2,
CvSize image_size, IntPtr R, IntPtr T, IntPtr E, IntPtr F,
CvTermCriteria term_crit, CalibrationFlag flags);
示例10: KMeans2
/// <summary>
/// ベクトル集合を,與えられたクラスタ數に分割する.
/// 入力サンプルを各クラスタに分類するために cluster_count 個のクラスタの中心を求める k-means 法を実裝する.
/// 出力 labels(i) は,配列 samples のi番目の行のサンプルが屬するクラスタのインデックスを表す.
/// </summary>
/// <param name="samples">浮動小數點型の入力サンプル行列.1行あたり一つのサンプル.</param>
/// <param name="cluster_count">集合を分割するクラスタ數</param>
/// <param name="labels">出力の整數ベクトル.すべてのサンプルについて,それぞれがどのクラスタに屬しているかが保存されている.</param>
/// <param name="termcrit">最大繰り返し數と(または),精度(1ループでの各クラスタ中心位置移動距離)の指定</param>
/// <param name="attemps"></param>
/// <param name="rng"></param>
/// <param name="flag"></param>
/// <param name="_centers"></param>
/// <param name="compactness"></param>
/// <returns></returns>
#else
/// <summary>
/// Splits set of vectors by given number of clusters
/// </summary>
/// <param name="samples">Floating-point matrix of input samples, one row per sample. </param>
/// <param name="cluster_count">Number of clusters to split the set by. </param>
/// <param name="labels">Output integer vector storing cluster indices for every sample. </param>
/// <param name="termcrit">Specifies maximum number of iterations and/or accuracy (distance the centers move by between the subsequent iterations). </param>
/// <param name="attemps"></param>
/// <param name="rng"></param>
/// <param name="flag"></param>
/// <param name="_centers"></param>
/// <param name="compactness"></param>
/// <returns></returns>
#endif
public static int KMeans2(CvArr samples, int cluster_count, CvArr labels, CvTermCriteria termcrit, int attemps, CvRNG rng, KMeansFlag flag, CvArr _centers, out double compactness)
{
if (samples == null)
throw new ArgumentNullException("samples");
if (labels == null)
throw new ArgumentNullException("labels");
if (rng == null)
{
rng = new CvRNG();
}
IntPtr centersPtr = (_centers != null) ? _centers.CvPtr : IntPtr.Zero;
UInt64 rngValue = rng.Seed;
int result = CvInvoke.cvKMeans2(samples.CvPtr, cluster_count, labels.CvPtr, termcrit, attemps, ref rngValue, flag, centersPtr, out compactness);
rng.Seed = rngValue;
return result;
}
示例11: cvCalcEigenObjects
public static extern void cvCalcEigenObjects(int nObjects, CvCallback input, CvCallback output, [MarshalAs(UnmanagedType.I4)] EigenObjectsIOFlag ioFlags,
int ioBufSize, IntPtr userData, ref CvTermCriteria calcLimit, IntPtr avg, [In] float[] eigVals);
示例12: ContourFromContourTree
/// <summary>
/// ツリーから輪郭を復元する
/// </summary>
/// <param name="storage">復元した輪郭の出力先</param>
/// <param name="criteria">復元を止める基準</param>
/// <returns></returns>
#else
/// <summary>
/// Restores contour from tree.
/// </summary>
/// <param name="storage">Container for the reconstructed contour. </param>
/// <param name="criteria">Criteria, where to stop reconstruction. </param>
/// <returns></returns>
#endif
public CvSeq ContourFromContourTree(CvMemStorage storage, CvTermCriteria criteria)
{
return Cv.ContourFromContourTree(this, storage, criteria);
}
示例13: FindCorners
/// <summary>
/// Находит углы в изображении шахматной доски, установленном с помощью SetImage
/// </summary>
/// <param name="corners">Найденные углы</param>
/// <returns>Показывает соответствуют-ли найленные углы шаблону CornersPattern</returns>
public bool FindCorners(out CvPoint2D32f[] corners)
{
bool result;
int numCorners;
ChessboardFlag flags = ChessboardFlag.AdaptiveThresh | ChessboardFlag.NormalizeImage | ChessboardFlag.FilterQuads;
CvTermCriteria criteria = new CvTermCriteria(CriteriaType.Iteration | CriteriaType.Epsilon, MaxIterations, Epsilon);
// Находим углы
result = chessBoard.FindChessboardCorners(CornersPattern, out corners, out numCorners, flags);
// Уточнаем положение углов
chessBoard.CvtColor(grayChessBoard, ColorConversion.RgbToGray);
grayChessBoard.FindCornerSubPix(corners, corners.Length, new CvSize(11, 11), new CvSize(-1, -1), criteria);
return result;
}
示例14: FindCornerSubPix
/// <summary>
/// コーナー位置を高精度化する.
/// </summary>
/// <param name="image">入力畫像</param>
/// <param name="corners">コーナーの初期座標が入力され,高精度化された座標が出力される.</param>
/// <param name="count">コーナーの數</param>
/// <param name="win">検索ウィンドウの半分のサイズ.(例)win=(5,5) ならば 5*2+1 × 5*2+1 = 11 × 11 が探索ウィンドウして使われる.</param>
/// <param name="zeroZone">総和を計算する際に含まれない,探索領域の中心に存在する総和対象外領域の半分のサイズ.この値は,自己相関行列において発生しうる特異點を避けるために用いられる. 値が (-1,-1) の場合は,そのようなサイズはないということを意味する</param>
/// <param name="criteria">コーナー座標の高精度化のための繰り返し処理の終了條件.コーナー位置の高精度化の繰り返し処理は,規定回數に達するか,目標精度に達したときに終了する.</param>
#else
/// <summary>
/// Iterates to find the sub-pixel accurate location of corners, or radial saddle points.
/// </summary>
/// <param name="image">Input image. </param>
/// <param name="corners">Initial coordinates of the input corners and refined coordinates on output. </param>
/// <param name="count">Number of corners. </param>
/// <param name="win">Half sizes of the search window.</param>
/// <param name="zeroZone">Half size of the dead region in the middle of the search zone over which the summation in formulae below is not done. It is used sometimes to avoid possible singularities of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such size. </param>
/// <param name="criteria">Criteria for termination of the iterative process of corner refinement. That is, the process of corner position refinement stops either after certain number of iteration or when a required accuracy is achieved. The criteria may specify either of or both the maximum number of iteration and the required accuracy. </param>
#endif
public static void FindCornerSubPix(CvArr image, CvPoint2D32f[] corners, int count, CvSize win, CvSize zeroZone, CvTermCriteria criteria)
{
if (image == null)
throw new ArgumentNullException("image");
if (corners == null)
throw new ArgumentNullException("corners");
NativeMethods.cvFindCornerSubPix(image.CvPtr, corners, count, win, zeroZone, criteria);
}
示例15: cvMeanShift
public static extern int cvMeanShift(IntPtr prob_image, CvRect window, CvTermCriteria criteria, IntPtr comp);