Exemplo n.º 1
0
 private void Calculate(IntPtr[] arrays, bool accumulate, CvArray <Byte> mask)
 {
     Debug.Assert(arrays.Length == Dimension, Properties.StringTable.IncompatibleDimension);
     CvInvoke.cvCalcHist(
         arrays,
         _ptr,
         accumulate,
         mask == null ? IntPtr.Zero : mask.Ptr);
 }
Exemplo n.º 2
0
        private void Calculate(IntPtr[] arrays, bool accumulate, CvArray <Byte> mask)
        {
#if !NETFX_CORE
            Debug.Assert(arrays.Length == Dimension, "IncompatibleDimension");
#endif
            CvInvoke.cvCalcHist(
                arrays,
                _ptr,
                accumulate,
                mask == null ? IntPtr.Zero : mask.Ptr);
        }
Exemplo n.º 3
0
        private void Calculate(Mat[] arrays, bool accumulate, CvArray <Byte> mask)
        {
            Debug.Assert(arrays.Length == _binSizes.Length, "Incompatible Dimension");

            int[] channels = new int[arrays.Length];
            for (int i = 0; i < arrays.Length; i++)
            {
                channels[i] = i;
            }

            using (VectorOfMat vm = new VectorOfMat(arrays))
            {
                CvInvoke.CalcHist(vm, channels, mask == null ? null : mask.Mat, this, _binSizes, GetRangeAsFloatVec(), accumulate);
            }
        }
Exemplo n.º 4
0
        private void Calculate(Mat[] arrays, bool accumulate, CvArray <Byte> mask)
        {
#if !(NETFX_CORE || (UNITY_ANDROID || UNITY_IPHONE || UNITY_STANDALONE || UNITY_METRO))
            Debug.Assert(arrays.Length == _binSizes.Length, Properties.StringTable.IncompatibleDimension);
#endif
            int[] channels = new int[arrays.Length];
            for (int i = 0; i < arrays.Length; i++)
            {
                channels[i] = i;
            }

            using (VectorOfMat vm = new VectorOfMat(arrays))
            {
                CvInvoke.CalcHist(vm, channels, mask == null ? null : mask.Mat, this, _binSizes, GetRangeAsFloatVec(), accumulate);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Inplace elementwise maximize the current Array with <paramref name="other"/>
 /// </summary>
 /// <param name="other">The other array to be elementwise maximized with this array</param>
 public void _Max(CvArray <TDepth> other)
 {
     CvInvoke.Max(this, other, this);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Inplace elementwise multiply the current Array with <paramref name="src2"/>
 /// </summary>
 /// <param name="src2">The other array to be elementwise multiplied with</param>
 public void _Mul(CvArray <TDepth> src2)
 {
     CvInvoke.Multiply(this, src2, this, 1.0, CvInvoke.GetDepthType(typeof(TDepth)));
 }
Exemplo n.º 7
0
 ///<summary>
 ///Set the element of the Array to <paramref name="value"/>, using the specific <paramref name="mask"/>
 ///</summary>
 ///<param name="value">The value to be set</param>
 ///<param name="mask">The mask for the operation</param>
 public void SetValue(double value, CvArray <Byte> mask = null)
 {
     SetValue(new MCvScalar(value, value, value, value), mask);
 }
Exemplo n.º 8
0
 ///<summary>
 ///Set the element of the Array to <paramref name="value"/>, using the specific <paramref name="mask"/>
 ///</summary>
 ///<param name="value">The value to be set</param>
 ///<param name="mask">The mask for the operation</param>
 public void SetValue(MCvScalar value, CvArray <Byte> mask = null)
 {
     this.Mat.SetTo(value, mask);
     //CvInvoke.cvSet(_ptr, value, mask == null ? IntPtr.Zero : mask.Ptr);
 }
Exemplo n.º 9
0
 ///<summary>
 /// Copy the current array to <paramref name="destination"/>
 /// </summary>
 /// <param name="destination"> The destination Array</param>
 public void CopyTo(CvArray <TDepth> destination)
 {
     CvInvoke.cvCopy(Ptr, destination.Ptr, IntPtr.Zero);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Reduces matrix to a vector by treating the matrix rows/columns as a set of 1D vectors and performing the specified operation on the vectors until a single row/column is obtained.
 /// </summary>
 /// <remarks>
 /// The function can be used to compute horizontal and vertical projections of an raster image.
 /// In case of CV_REDUCE_SUM and CV_REDUCE_AVG the output may have a larger element bit-depth to preserve accuracy.
 /// And multi-channel arrays are also supported in these two reduction modes
 /// </remarks>
 /// <param name="array1D">The destination single-row/single-column vector that accumulates somehow all the matrix rows/columns</param>
 /// <param name="dim">The dimension index along which the matrix is reduce.</param>
 /// <param name="type">The reduction operation type</param>
 /// <typeparam name="TOtherDepth">The type of depth of the reduced array</typeparam>
 public void Reduce <TOtherDepth>(CvArray <TOtherDepth> array1D, CvEnum.ReduceDimension dim, CvEnum.ReduceType type)
     where TOtherDepth : new ()
 {
     CvInvoke.Reduce(this, array1D, dim, type, CvInvoke.GetDepthType(typeof(TDepth)));
 }
Exemplo n.º 11
0
 /// <summary>
 /// Calculates and returns the Euclidean dot product of two arrays.
 /// src1 dot src2 = sumI(src1(I)*src2(I))
 /// </summary>
 /// <remarks>In case of multiple channel arrays the results for all channels are accumulated. In particular, cvDotProduct(a,a), where a is a complex vector, will return ||a||^2. The function can process multi-dimensional arrays, row by row, layer by layer and so on.</remarks>
 /// <param name="otherArray">The other Array to apply dot product with</param>
 /// <returns>src1 dot src2</returns>
 public double DotProduct(CvArray <TDepth> otherArray)
 {
     return(CvInvoke.cvDotProduct(Ptr, otherArray.Ptr));
 }
Exemplo n.º 12
0
 /// <summary>
 /// Inplace Or operation with <paramref name="src2"/>
 /// </summary>
 /// <param name="src2">The other array to perform OR operation</param>
 public void _Or(CvArray <TDepth> src2)
 {
     CvInvoke.cvOr(Ptr, src2.Ptr, Ptr, IntPtr.Zero);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Inplace Or operation with <paramref name="otherArray"/>
 /// </summary>
 /// <param name="otherArray">The other array to perform OR operation</param>
 public void _Or(CvArray <TDepth> otherArray)
 {
     CvInvoke.cvOr(Ptr, otherArray.Ptr, Ptr, IntPtr.Zero);
 }
Exemplo n.º 14
0
 /// <summary>
 /// Inplace elementwise multiply the current Array with <paramref name="src2"/>
 /// </summary>
 /// <param name="src2">The other array to be elementwise multiplied with</param>
 public void _Mul(CvArray <TDepth> src2)
 {
     CvInvoke.cvMul(Ptr, src2.Ptr, Ptr, 1.0);
 }
Exemplo n.º 15
0
 ///<summary>
 ///Set the element of the Array to <paramref name="val"/>, using the specific <paramref name="mask"/>
 ///</summary>
 ///<param name="val">The value to be set</param>
 ///<param name="mask">The mask for the operation</param>
 public void SetValue(double val, CvArray <Byte> mask)
 {
     SetValue(new MCvScalar(val, val, val, val), mask);
 }
Exemplo n.º 16
0
 ///<summary>
 ///Set the element of the Array to <paramref name="val"/>, using the specific <paramref name="mask"/>
 ///</summary>
 ///<param name="val">The value to be set</param>
 ///<param name="mask">The mask for the operation</param>
 public void SetValue(MCvScalar val, CvArray <Byte> mask)
 {
     CvInvoke.cvSet(_ptr, val, mask == null ? IntPtr.Zero : mask.Ptr);
 }
Exemplo n.º 17
0
 /// <summary>
 /// Reduces matrix to a vector by treating the matrix rows/columns as a set of 1D vectors and performing the specified operation on the vectors until a single row/column is obtained.
 /// </summary>
 /// <remarks>
 /// The function can be used to compute horizontal and vertical projections of an raster image.
 /// In case of CV_REDUCE_SUM and CV_REDUCE_AVG the output may have a larger element bit-depth to preserve accuracy.
 /// And multi-channel arrays are also supported in these two reduction modes
 /// </remarks>
 /// <param name="array1D">The destination single-row/single-column vector that accumulates somehow all the matrix rows/columns</param>
 /// <param name="dim">The dimension index along which the matrix is reduce.</param>
 /// <param name="type">The reduction operation type</param>
 /// <typeparam name="TOtherDepth">The type of depth of the reduced array</typeparam>
 public void Reduce <TOtherDepth>(CvArray <TOtherDepth> array1D, CvEnum.REDUCE_DIMENSION dim, CvEnum.REDUCE_TYPE type)
     where TOtherDepth : new ()
 {
     CvInvoke.cvReduce(Ptr, array1D.Ptr, dim, type);
 }
Exemplo n.º 18
0
 /// <summary>
 /// Calculates and returns the Euclidean dot product of two arrays.
 /// src1 dot src2 = sumI(src1(I)*src2(I))
 /// </summary>
 /// <remarks>In case of multiple channel arrays the results for all channels are accumulated. In particular, cvDotProduct(a,a), where a is a complex vector, will return ||a||^2. The function can process multi-dimensional arrays, row by row, layer by layer and so on.</remarks>
 /// <param name="src2">The other Array to apply dot product with</param>
 /// <returns>src1 dot src2</returns>
 public double DotProduct(CvArray <TDepth> src2)
 {
     return(CvInvoke.cvDotProduct(Ptr, src2.Ptr));
 }
Exemplo n.º 19
0
 /// <summary>
 /// Inplace Or operation with <paramref name="otherArray"/>
 /// </summary>
 /// <param name="otherArray">The other array to perform OR operation</param>
 public void _Or(CvArray <TDepth> otherArray)
 {
     CvInvoke.BitwiseOr(this, otherArray, this, null);
 }
Exemplo n.º 20
0
 /// <summary>
 /// Inplace elementwise maximize the current Array with <paramref name="other"/>
 /// </summary>
 /// <param name="other">The other array to be elementwise maximized with this array</param>
 public void _Max(CvArray <TDepth> other)
 {
     CvInvoke.cvMax(Ptr, other.Ptr, Ptr);
 }
Exemplo n.º 21
0
 /// <summary>
 /// Calculates and returns the Euclidean dot product of two arrays.
 /// src1 dot src2 = sumI(src1(I)*src2(I))
 /// </summary>
 /// <remarks>In case of multiple channel arrays the results for all channels are accumulated. In particular, cvDotProduct(a,a), where a is a complex vector, will return ||a||^2. The function can process multi-dimensional arrays, row by row, layer by layer and so on.</remarks>
 /// <param name="otherArray">The other Array to apply dot product with</param>
 /// <returns>src1 dot src2</returns>
 public double DotProduct(CvArray <TDepth> otherArray)
 {
     return(this.Mat.Dot(otherArray.Mat));
 }