コード例 #1
0
ファイル: Cv2_photo.cs プロジェクト: zhoufan1987/opencvsharp
        /// <summary>
        /// Image editing tasks concern either global changes (color/intensity corrections,
        /// filters, deformations) or local changes concerned to a selection. Here we are
        /// interested in achieving local changes, ones that are restricted to a region
        /// manually selected (ROI), in a seamless and effortless manner. The extent of
        /// the changes ranges from slight distortions to complete replacement by novel
        /// content @cite PM03 .
        /// </summary>
        /// <param name="src">Input 8-bit 3-channel image.</param>
        /// <param name="dst">Input 8-bit 3-channel image.</param>
        /// <param name="mask">Input 8-bit 1 or 3-channel image.</param>
        /// <param name="p">Point in dst image where object is placed.</param>
        /// <param name="blend">Output image with the same size and type as dst.</param>
        /// <param name="flags">Cloning method</param>
        public static void SeamlessClone(
            InputArray src, InputArray dst, InputArray mask, Point p,
            OutputArray blend, SeamlessCloneMethods flags)
        {
            if (src == null)
            {
                throw new ArgumentNullException(nameof(src));
            }
            if (dst == null)
            {
                throw new ArgumentNullException(nameof(dst));
            }
            if (blend == null)
            {
                throw new ArgumentNullException(nameof(blend));
            }
            src.ThrowIfDisposed();
            dst.ThrowIfDisposed();
            mask?.ThrowIfDisposed();
            blend.ThrowIfNotReady();

            NativeMethods.HandleException(
                NativeMethods.photo_seamlessClone(
                    src.CvPtr, dst.CvPtr, ToPtr(mask), p, blend.CvPtr, (int)flags));

            GC.KeepAlive(src);
            GC.KeepAlive(dst);
            GC.KeepAlive(mask);
            blend.Fix();
        }
コード例 #2
0
ファイル: Cv2_photo.cs プロジェクト: JiphuTzu/opencvsharp
        /// <summary>
        /// Image editing tasks concern either global changes (color/intensity corrections, 
        /// filters, deformations) or local changes concerned to a selection. Here we are 
        /// interested in achieving local changes, ones that are restricted to a region 
        /// manually selected (ROI), in a seamless and effortless manner. The extent of 
        /// the changes ranges from slight distortions to complete replacement by novel 
        /// content @cite PM03 .
        /// </summary>
        /// <param name="src">Input 8-bit 3-channel image.</param>
        /// <param name="dst">Input 8-bit 3-channel image.</param>
        /// <param name="mask">Input 8-bit 1 or 3-channel image.</param>
        /// <param name="p">Point in dst image where object is placed.</param>
        /// <param name="blend">Output image with the same size and type as dst.</param>
        /// <param name="flags">Cloning method</param>
        public static void SeamlessClone(
            InputArray src, InputArray dst, InputArray mask, Point p,
            OutputArray blend, SeamlessCloneMethods flags)
        {
            if (src == null) 
                throw new ArgumentNullException("src");
            if (dst == null)
                throw new ArgumentNullException("dst");
            if (blend == null)
                throw new ArgumentNullException("blend");
            src.ThrowIfDisposed();
            dst.ThrowIfDisposed();
            if (mask != null)
                mask.ThrowIfDisposed();
            blend.ThrowIfNotReady();

            NativeMethods.photo_seamlessClone(
                src.CvPtr, dst.CvPtr, ToPtr(mask), p, blend.CvPtr, (int)flags);

            GC.KeepAlive(src);
            GC.KeepAlive(dst);
            GC.KeepAlive(mask);
            blend.Fix();
        }