Example #1
0
        /// <summary>
        /// 行列とスカラーの乗算演算子。aの要素ごとにbをかけた結果をcvAddWeightedにより求める。
        /// </summary>
        /// <param name="a">行列</param>
        /// <param name="b">スカラー</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Multiplicative operator (cvAddWeighted)
        /// </summary>
        /// <param name="a">matrix</param>
        /// <param name="b">scalar</param>
        /// <returns></returns>
#endif
        public static CvSparseMat operator *(CvSparseMat a, Double b)
        {
            if (a == null)
            {
                throw new ArgumentNullException("a");
            }
            CvSparseMat result = a.Clone();

            Cv.AddWeighted(a, b, a, 0, 0, result);
            return(result);
        }
Example #2
0
        /// <summary>
        /// 行列の単項-演算子
        /// </summary>
        /// <param name="a">行列</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Unary negation operator
        /// </summary>
        /// <param name="a">matrix</param>
        /// <returns></returns>
#endif
        public static CvMatND operator -(CvMatND a)
        {
            if (a == null)
            {
                throw new ArgumentNullException("a");
            }
            CvMatND result = a.Clone();

            Cv.AddWeighted(a, -1, a, 0, 0, result);
            return(result);
        }
Example #3
0
        /// <summary>
        /// 行列とスカラーの除算演算子。aの要素ごとにbで割った結果をcvAddWeightedにより求める。
        /// </summary>
        /// <param name="a">行列</param>
        /// <param name="b">スカラー</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Division operator (cvAddWeighted)
        /// </summary>
        /// <param name="a">matrix</param>
        /// <param name="b">scalar</param>
        /// <returns></returns>
#endif
        public static CvSparseMat operator /(CvSparseMat a, double b)
        {
            if (a == null)
            {
                throw new ArgumentNullException("a");
            }
            if (b == 0)
            {
                throw new DivideByZeroException();
            }
            CvSparseMat result = a.Clone();

            Cv.AddWeighted(a, 1.0 / b, a, 0, 0, result);
            return(result);
        }