本文整理汇总了C#中MatrixType类的典型用法代码示例。如果您正苦于以下问题:C# MatrixType类的具体用法?C# MatrixType怎么用?C# MatrixType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MatrixType类属于命名空间,在下文中一共展示了MatrixType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: KmeansInput
public KmeansInput(Array samples, MatrixType samplesType, int nClusters, CvTermCriteria criteria)
{
Samples = samples;
SamplesType = samplesType;
NClusters = nClusters;
Criteria = criteria;
}
示例2: Visit
protected Expression Visit(BinaryExpression expression)
{
// First, dispatch to resolve type of node at deeper level
Visit((Node)expression);
var leftType = expression.Left.TypeInference.TargetType;
var rightType = expression.Right.TypeInference.TargetType;
var returnType = expression.TypeInference.ExpectedType ?? expression.TypeInference.TargetType;
bool isNumericOperator = true;
switch (expression.Operator)
{
case BinaryOperator.LogicalAnd:
case BinaryOperator.LogicalOr:
isNumericOperator = false;
returnType = GetBinaryImplicitConversionType(expression.Span, leftType, rightType, true);
expression.TypeInference.TargetType = returnType;
break;
case BinaryOperator.Less:
case BinaryOperator.LessEqual:
case BinaryOperator.Greater:
case BinaryOperator.GreaterEqual:
case BinaryOperator.Equality:
case BinaryOperator.Inequality:
isNumericOperator = false;
returnType = GetBinaryImplicitConversionType(expression.Span, leftType, rightType, false);
TypeBase resultType = ScalarType.Bool;
if (returnType is VectorType)
{
resultType = new VectorType(ScalarType.Bool, ((VectorType)returnType).Dimension);
}
else if (returnType is MatrixType)
{
var matrixType = (MatrixType)returnType;
resultType = new MatrixType(ScalarType.Bool, matrixType.RowCount, matrixType.ColumnCount);
}
expression.TypeInference.TargetType = resultType;
break;
}
if (returnType != null)
{
if (returnType == ScalarType.Bool && isNumericOperator)
{
var typeToCheck = leftType ?? rightType;
if (typeToCheck != null)
return ConvertExpressionToBool(expression, typeToCheck);
}
}
if (!isNumericOperator || CastHelper.NeedConvertForBinary(leftType, returnType))
expression.Left = Cast(leftType, returnType, expression.Left);
if (!isNumericOperator || CastHelper.NeedConvertForBinary(rightType, returnType))
expression.Right = Cast(rightType, returnType, expression.Right);
return expression;
}
示例3: Matrix4
/// <summary>
/// Construct a rotation matrix,origin at (0,0,0)
/// </summary>
/// <param name="xAxis">identity of x axis</param>
/// <param name="yAxis">identity of y axis</param>
/// <param name="zAxis">identity of z axis</param>
public Matrix4(Vector4 xAxis,Vector4 yAxis, Vector4 zAxis)
{
m_type = MatrixType.Rotation;
Identity();
m_matrix[0, 0] = xAxis.X; m_matrix[0, 1] = xAxis.Y; m_matrix[0, 2] = xAxis.Z;
m_matrix[1, 0] = yAxis.X; m_matrix[1, 1] = yAxis.Y; m_matrix[1, 2] = yAxis.Z;
m_matrix[2, 0] = zAxis.X; m_matrix[2, 1] = zAxis.Y; m_matrix[2, 2] = zAxis.Z;
}
示例4: ConvertMaps
public static void ConvertMaps(Mat map1, Mat map2, Mat dstmap1, Mat dstmap2, MatrixType dstmap1type, bool nninterpolation = false)
{
if (map1 == null)
throw new ArgumentNullException("map1");
if (map2 == null)
throw new ArgumentNullException("map2");
if (dstmap1 == null)
throw new ArgumentNullException("dstmap1");
if (dstmap2 == null)
throw new ArgumentNullException("dstmap2");
CppInvoke.cv_convertMaps(map1.CvPtr, map2.CvPtr, dstmap1.CvPtr, dstmap2.CvPtr, dstmap1type, nninterpolation);
}
示例5: DoubleSubmatrix
internal DoubleSubmatrix(Matrix<double> matrix, int rowOffset, int columnOffset, int rows, int columns)
{
if (typeof(Matrix_SDA).IsInstanceOfType(matrix)) mt = MatrixType.SDA; // дописать
else mt = MatrixType.SDA;
this.offsetRow = rowOffset;
this.offsetColumn = columnOffset;
this.rows = rows;
this.columns = columns;
this.parent = matrix;
}
示例6: PrintMatrix
private static void PrintMatrix(int[,] matrix, MatrixType type)
{
Console.WriteLine(type + "\n");
for (int row = 0; row < matrix.GetLength(0); row++)
{
for (int col = 0; col < matrix.GetLength(1); col++)
{
Console.Write("{0, -4}", matrix[row, col]);
}
Console.WriteLine();
}
Console.WriteLine(new String('_', matrix.GetLength(0) * 5));
}
示例7: GetMatrix
internal AnimatableMatrix GetMatrix(MatrixType whichMatrix)
{
switch (whichMatrix) {
case MatrixType.World:
return World;
case MatrixType.View:
return View;
case MatrixType.Projection:
return Projection;
}
throw new InvalidOperationException(String.Format("Unrecognized matrix type: {0}", whichMatrix));
}
示例8: GetMatrixValuesFromXml
/// <summary>
/// Extracts all of the 6 values from a Transformation Matrix
/// </summary>
/// <param name="path">The XML containing the Transformation Matrix</param>
/// <param name="matrixType">The type of attribute to be extracted</param>
/// <returns></returns>
public static string[] GetMatrixValuesFromXml(XElement path, MatrixType matrixType)
{
string attribute;
if (matrixType == MatrixType.PathMatrix)
{
attribute = "transform";
}
else
{
attribute = "gradientTransform";
}
string input = path.Attribute(attribute).Value;
return input.Split('(', ')')[1].Split(' ');
}
示例9: Matrix
/// <summary>
/// Constructs a matrix with a special structure, like an "Eye" Matrix (see Matlab)
/// </summary>
/// <param name="_n">Number of rows</param>
/// <param name="_m">Number of columns</param>
/// <param name="structure">Structure Type </param>
public Matrix(int _n, int _m, MatrixType type)
{
noRows = _n;
noColumns = _m;
values = new double[noRows, noColumns];
switch (type)
{
case MatrixType.EYE:
for (int i = 0; i < noRows; i++)
for (int j = 0; j < noColumns; j++)
if (i == j)
this[i, j] = 1;
break;
case MatrixType.ONES:
for (int i = 0; i < noRows; i++)
for (int j = 0; j < noColumns; j++)
this[i, j] = 1;
break;
}
}
示例10: GetMatrix
public int[,] GetMatrix(MatrixType type)
{
switch (type)
{
case MatrixType.Type_A:
GetMatrixTypeA();
break;
case MatrixType.Type_B:
GetMatrixTypeB();
break;
case MatrixType.Type_C:
GetMatrixTypeC();
break;
case MatrixType.Type_D:
GetMatrixTypeD();
break;
default:
break;
}
return this.matrix;
}
示例11: CreateMemoryLSH
/// <summary>
/// Construct in-memory LSH table, with n bins.
/// </summary>
/// <param name="d"></param>
/// <param name="n"></param>
/// <param name="L"></param>
/// <param name="k"></param>
/// <param name="type"></param>
/// <returns></returns>
#else
/// <summary>
/// Construct in-memory LSH table, with n bins.
/// </summary>
/// <param name="d"></param>
/// <param name="n"></param>
/// <param name="L"></param>
/// <param name="k"></param>
/// <param name="type"></param>
/// <returns></returns>
#endif
public static CvLSH CreateMemoryLSH(int d, int n, int L, int k, MatrixType type)
{
return Cv.CreateMemoryLSH(d, n, L, k, type, 4, -1);
}
示例12: CvLSH
/// <summary>
/// Construct in-memory LSH table, with n bins.
/// </summary>
/// <param name="d"></param>
/// <param name="n"></param>
/// <param name="L"></param>
/// <param name="k"></param>
/// <param name="type"></param>
/// <param name="r"></param>
/// <param name="seed"></param>
#else
/// <summary>
/// Construct in-memory LSH table, with n bins.
/// </summary>
/// <param name="d"></param>
/// <param name="n"></param>
/// <param name="L"></param>
/// <param name="k"></param>
/// <param name="type"></param>
/// <param name="r"></param>
/// <param name="seed"></param>
#endif
public CvLSH(int d, int n, int L, int k, MatrixType type, double r, Int64 seed)
{
_ptr = CvInvoke.cvCreateMemoryLSH(d, n, L, k, type, r, seed);
if (_ptr == IntPtr.Zero)
{
throw new OpenCvSharpException("Failed to create CvLSH");
}
}
示例13: CreateLSH
/// <summary>
/// Construct a Locality Sensitive Hash (LSH) table, for indexing d-dimensional vectors of
/// given type. Vectors will be hashed L times with k-dimensional p-stable (p=2) functions.
/// </summary>
/// <param name="ops">(not supported argument on OpenCvSharp)</param>
/// <param name="d"></param>
/// <param name="L"></param>
/// <param name="k"></param>
/// <param name="type"></param>
/// <param name="r"></param>
/// <param name="seed"></param>
/// <returns></returns>
#else
/// <summary>
/// Construct a Locality Sensitive Hash (LSH) table, for indexing d-dimensional vectors of
/// given type. Vectors will be hashed L times with k-dimensional p-stable (p=2) functions.
/// </summary>
/// <param name="ops">(not supported argument on OpenCvSharp)</param>
/// <param name="d"></param>
/// <param name="L"></param>
/// <param name="k"></param>
/// <param name="type"></param>
/// <param name="r"></param>
/// <param name="seed"></param>
/// <returns></returns>
#endif
public static CvLSH CreateLSH(IntPtr ops, int d, int L, int k, MatrixType type, double r, Int64 seed)
{
return Cv.CreateLSH(ops, d, L, k, type, r, seed);
}
示例14: cvInitMatNDHeader
public static extern IntPtr cvInitMatNDHeader(IntPtr mat, int dims, int[] sizes, MatrixType type, IntPtr data);
示例15: cvCreateMemoryLSH
public static extern IntPtr cvCreateMemoryLSH(int d, int n, int L, int k, MatrixType type, double r, Int64 seed);