/// <summary>
        /// Rectification filter for projective transformation.
        /// <para>Accord.NET internal call. Please see: <see cref="Accord.Imaging.Filters.Rectification"/> for details.</para>
        /// </summary>
        /// <param name="img">Image.</param>
        /// <param name="homography">The homography matrix used to map a image passed to the filter to the overlay image.</param>
        /// <param name="fillColor">The filling color used to fill blank spaces.</param>
        /// <returns>Rectified image.</returns>
        public static Gray <byte>[,] Rectification(this Gray <byte>[,] img, double[,] homography, Gray <byte> fillColor)
        {
            Rectification r = new Rectification(homography);

            r.FillColor = fillColor.ToColor();

            return(img.ApplyBaseTransformationFilter(r));
        }
Пример #2
0
        /// <summary>
        /// Rectification filter for projective transformation.
        /// <para>Accord.NET internal call. Please see: <see cref="Accord.Imaging.Filters.Rectification"/> for details.</para>
        /// </summary>
        /// <typeparam name="TColor">Color type.</typeparam>
        /// <typeparam name="TDepth">Channel type.</typeparam>
        /// <param name="img">Image.</param>
        /// <param name="homography">The homography matrix used to map a image passed to the filter to the overlay image.</param>
        /// <param name="fillColor">The filling color used to fill blank spaces.</param>
        /// <returns>Rectified image.</returns>
        public static Image <TColor, TDepth> Rectification <TColor, TDepth>(this Image <TColor, TDepth> img, double[,] homography, TColor fillColor)
            where TColor : IColor
            where TDepth : struct
        {
            Rectification r = new Rectification(homography);

            r.FillColor = fillColor.ToColor();

            return(img.ApplyFilter(r));
        }
Пример #3
0
        private void videoSourcePlayer1_NewFrame(object sender, ref Bitmap image)
        {
            LevelsLinear16bpp levels = new LevelsLinear16bpp();

            levels.InGray  = new IntRange(0, 1000);
            levels.OutGray = new IntRange(0, 65535);
            levels.ApplyInPlace(image);

            if (homography != null)
            {
                Bitmap        img  = AForge.Imaging.Image.Convert16bppTo8bpp(image);
                Rectification rect = new Rectification(homography.Inverse());
                image = rect.Apply(img);
            }
        }
                    public static Rectification FromBaseObject(BaseObject baseObj)
                    {
                        if (baseObj == null || baseObj.NativeObject == IntPtr.Zero)
                        {
                            return(null);
                        }
                        Rectification obj = baseObj as  Rectification;

                        if (object.Equals(obj, null))
                        {
                            obj = new Rectification(CreatedWhenConstruct.CWC_NotToCreate);
                            obj.BindNativeObject(baseObj.NativeObject, "CRectification");
                            obj.IncreaseCast();
                        }

                        return(obj);
                    }
                    public BaseObject Create()
                    {
                        Rectification emptyInstance = new Rectification(CreatedWhenConstruct.CWC_NotToCreate);

                        return(emptyInstance);
                    }