///<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); }
/// <summary> /// Flips the GpuMat<Byte> in one of different 3 ways (row and column indices are 0-based). /// </summary> /// <param name="src">Source array.</param> /// <param name="dst">Destination array.</param> /// <param name="flipType">Specifies how to flip the array.</param> public static void Flip(IntPtr src, IntPtr dst, CvEnum.FLIP flipType) { int flipMode = //-1 indicates vertical and horizontal flip flipType == (Emgu.CV.CvEnum.FLIP.HORIZONTAL | Emgu.CV.CvEnum.FLIP.VERTICAL) ? -1 : //1 indicates horizontal flip only flipType == Emgu.CV.CvEnum.FLIP.HORIZONTAL ? 1 : //0 indicates vertical flip only 0; gpuMatFlip(src, dst, flipMode); }