Beispiel #1
0
        ///<summary> Get a filpped copy of the convolution kernel</summary>
        ///<param name="flipType">The type of the flipping</param>
        ///<returns> The flipped copy of <i>this</i> image </returns>
        public ConvolutionKernelF Flip(CvEnum.FLIP flipType)
        {
            int code;

            switch (flipType)
            {
            case (Emgu.CV.CvEnum.FLIP.HORIZONTAL | Emgu.CV.CvEnum.FLIP.VERTICAL):
                code = -1;
                break;

            case Emgu.CV.CvEnum.FLIP.HORIZONTAL:
                code = 1;
                break;

            case Emgu.CV.CvEnum.FLIP.VERTICAL:
            default:
                code = 0;
                break;
            }

            ConvolutionKernelF res = new ConvolutionKernelF(Height, Width);

            CvInvoke.cvFlip(Ptr, res.Ptr, code);

            res.Center = new System.Drawing.Point(
                (Center.X == -1 ? -1 : ((flipType & Emgu.CV.CvEnum.FLIP.HORIZONTAL) == Emgu.CV.CvEnum.FLIP.HORIZONTAL ? Width - Center.X - 1 : Center.X)),
                (Center.Y == -1 ? -1 : ((flipType & Emgu.CV.CvEnum.FLIP.VERTICAL) == Emgu.CV.CvEnum.FLIP.VERTICAL ? Height - Center.Y - 1 : Center.Y)));
            return(res);
        }
Beispiel #2
0
        /// <summary> Get a flipped copy of the convolution kernel</summary>
        /// <param name="flipType">The type of the flipping</param>
        /// <returns> The flipped copy of <i>this</i> kernel </returns>
        public ConvolutionKernelF Flip(CvEnum.FlipType flipType)
        {
            ConvolutionKernelF res = new ConvolutionKernelF(Height, Width);

            CvInvoke.Flip(this, res, flipType);

            res.Center = new System.Drawing.Point(
                (Center.X == -1 ? -1 : (flipType == FlipType.Both || flipType == Emgu.CV.CvEnum.FlipType.Horizontal) ? Width - Center.X - 1 : Center.X),
                (Center.Y == -1 ? -1 : (flipType == FlipType.Both || flipType == Emgu.CV.CvEnum.FlipType.Vertical) ? Height - Center.Y - 1 : Center.Y));
            return(res);
        }