C# OpenCvSharp Watermark Removal Image Repair.rar

C# OpenCvSharp Watermark Removal Image Repair.rar

38.05MBRAR

C# OpenCvSharp Watermark Removal Image Repair.rar

Full Demo, ready to run

sports event

VS2022+.net4.8+OpenCvSharp4

coding

using System.

Generic; using System.Collections.

using System.ComponentModel.

using System.Data.

using System.Drawing.

using System.IO.

using System.Linq.

using System.Security.Cryptography.

using System.Text.

using System.Windows.Forms.

using OpenCvSharp.

using OpenCvSharp.Extensions;

namespace OpenCvSharp_Watermark Removal_Image Restoration

{

  public partial class Form1 : Form

  {

    public Form1()

    {

      InitializeComponent().

    }

    Bitmap bmp.

    string fileFilter = "*. *|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";

    string imgPath = "";

    public Mat img, img0, inpainted, inpaintMask; inpaintMask; inpaintMask; inpaintMask; inpaintMask

    int thickness = 10;

    string CommandText.

    InpaintMethod inpaintMethod.

    ListItem li.

    private void Form1_Load(object sender, EventArgs e)

    {

      this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);

      this.UpdateStyles();

      // Add item:

      cBoxThresholdTypes.Items.Add(new ListItem("NS", InpaintMethod.NS));

      cBoxThresholdTypes.Items.Add(new ListItem("Telea", InpaintMethod.Telea));

      //Set the selection:

      cBoxThresholdTypes.SelectedIndex = 0; // by index

    }

    private void trackBar2_Scroll(object sender, EventArgs e)

    {

      thickness = trackBar2.Value;

    }

    private void button1_Click(object sender, EventArgs e)

    {

      OpenFileDialog ofd = new OpenFileDialog();

      ofd.Filter = fileFilter;

      if (ofd.ShowDialog() ! = DialogResult.OK) return;

      imgPath = ofd.FileName;

      bmp = new Bitmap(imgPath);

      PictureBox1.Image = bmp;

      img0 = Cv2.ImRead(imgPath);

      inpaintMask = new Mat(img0.Size(), MatType.CV_8U, Scalar.Black);

      pictureBox2.Image = BitmapConverter.ToBitmap(inpaintMask);

      PictureBox3.Image = null;

    }

    private void cBoxThresholdTypes_SelectedIndexChanged(object sender, EventArgs e)

    {

      Inpaint().

    }

    private void trackBar1_Scroll(object sender, EventArgs e)

    {

      Inpaint().

    }

    private void button4_Click(object sender, EventArgs e)

    {

      if (pictureBox1.Image == null)

      {

        return;

      }

      img = img0.Clone();

      inpaintMask = new Mat(img0.Size(), MatType.CV_8U, Scalar.Black);

      inpainted = img0.EmptyClone();

      Window wImage = new Window("image", img);

      OpenCvSharp.Point prevPt = new OpenCvSharp.Point(-1, -1);

      wImage.SetMouseCallback((MouseEventTypes ev, int x, int y, MouseEventFlags flags, IntPtr userdata) =>

      {

        if (ev == MouseEventTypes.LButtonUp || (flags & MouseEventFlags.LButton) == 0)

        {

          prevPt = new OpenCvSharp.Point(-1, -1);

        }

        else if (ev == MouseEventTypes.LButtonDown)

        {

          prevPt = new OpenCvSharp.Point(x, y);

        }

        else if (ev == MouseEventTypes.MouseMove && (flags & MouseEventFlags.LButton) ! = LButton) !

        {

          OpenCvSharp.Point pt = new OpenCvSharp.Point(x, y);

          if (prevPt.X < 0)

          {

            prevPt = pt;

          }

          inpaintMask.Line(prevPt, pt, Scalar.White, thickness, LineTypes.AntiAlias, 0);

          pictureBox2.Image = BitmapConverter.ToBitmap(inpaintMask);

          img.Line(prevPt, pt, Scalar.White, thickness, LineTypes.AntiAlias, 0);

          prevPt = pt;

          wImage.ShowImage(img);

        }

      });

      try

      {

        for (; ; )

        {

          switch ((char)Window.WaitKey(0))

          {

            case (char)27: // exit

              return;

            case 'r'.

              inpaintMask.SetTo(Scalar.Black);

              pictureBox2.Image = BitmapConverter.ToBitmap(inpaintMask);

              img0.CopyTo(img);

              wImage.ShowImage(img);

              break;

            case 'i'.

            case '\r'.

              Inpaint().

              break;

          }

        }

      }

      finally

      {

        Window.DestroyAllWindows();

      }

    }

    private void button3_Click(object sender, EventArgs e)

    {

      Inpaint().

    }

    void Inpaint()

    {

      if (pictureBox1.Image == null)

      {

        return;

      }

      li = (ListItem)cBoxThresholdTypes.SelectedItem;

      inpaintMethod = (InpaintMethod)li.Value;

      Cv2.Inpaint(img, inpaintMask, inpainted, trackBar1.Value, inpaintMethod);

      pictureBox3.Image = BitmapConverter.ToBitmap(inpainted);

      CommandText = String.Format("Cv2.Inpaint(src, mask, dst,{0},{1})", trackBar1.Value, inpaintMethod.ToString());

      txtCommandText.Text = CommandText;

    }

  }

}

 

using System.

Generic; using System.Collections.

using System.ComponentModel.

using System.Data.

using System.Drawing.

using System.IO.

using System.Linq.

using System.Security.Cryptography.

using System.Text.

using System.Windows.Forms.

using OpenCvSharp.

using OpenCvSharp.Extensions;

 

namespace OpenCvSharp_Watermark Removal_Image Restoration

{

  public partial class Form1 : Form

  {

    public Form1()

    {

      InitializeComponent().

    }

 

 

    Bitmap bmp.

    string fileFilter = "*. *|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";

    string imgPath = "";

    public Mat img, img0, inpainted, inpaintMask; inpaintMask; inpaintMask; inpaintMask; inpaintMask

    int thickness = 10;

    string CommandText.

    InpaintMethod inpaintMethod.

    ListItem li.

 

    private void Form1_Load(object sender, EventArgs e)

    {

      this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);

      this.UpdateStyles();

 

      // Add item:

      cBoxThresholdTypes.Items.Add(new ListItem("NS", InpaintMethod.NS));

      cBoxThresholdTypes.Items.Add(new ListItem("Telea", InpaintMethod.Telea));

 

      //Set the selection:

      cBoxThresholdTypes.SelectedIndex = 0; // by index

    }

 

    private void trackBar2_Scroll(object sender, EventArgs e)

    {

      thickness = trackBar2.Value;

    }

 

    private void button1_Click(object sender, EventArgs e)

    {

      OpenFileDialog ofd = new OpenFileDialog();

      ofd.Filter = fileFilter;

      if (ofd.ShowDialog() ! = DialogResult.OK) return;

      imgPath = ofd.FileName;

      bmp = new Bitmap(imgPath);

      PictureBox1.Image = bmp;

      img0 = Cv2.ImRead(imgPath);

      inpaintMask = new Mat(img0.Size(), MatType.CV_8U, Scalar.Black);

      pictureBox2.Image = BitmapConverter.ToBitmap(inpaintMask);

      PictureBox3.Image = null;

    }

 

    private void cBoxThresholdTypes_SelectedIndexChanged(object sender, EventArgs e)

    {

      Inpaint().

    }

 

    private void trackBar1_Scroll(object sender, EventArgs e)

    {

      Inpaint().

    }

 

    private void button4_Click(object sender, EventArgs e)

    {

      if (pictureBox1.Image == null)

      {

        return;

      }

 

      img = img0.Clone();

      inpaintMask = new Mat(img0.Size(), MatType.CV_8U, Scalar.Black);

      inpainted = img0.EmptyClone();

 

      Window wImage = new Window("image", img);

 

      OpenCvSharp.Point prevPt = new OpenCvSharp.Point(-1, -1);

      wImage.SetMouseCallback((MouseEventTypes ev, int x, int y, MouseEventFlags flags, IntPtr userdata) =>

      {

        if (ev == MouseEventTypes.LButtonUp || (flags & MouseEventFlags.LButton) == 0)

        {

          prevPt = new OpenCvSharp.Point(-1, -1);

        }

        else if (ev == MouseEventTypes.LButtonDown)

        {

          prevPt = new OpenCvSharp.Point(x, y);

        }

        else if (ev == MouseEventTypes.MouseMove && (flags & MouseEventFlags.LButton) ! = LButton) !

        {

          OpenCvSharp.Point pt = new OpenCvSharp.Point(x, y);

          if (prevPt.X < 0)

          {

            prevPt = pt;

          }

          inpaintMask.Line(prevPt, pt, Scalar.White, thickness, LineTypes.AntiAlias, 0);

          pictureBox2.Image = BitmapConverter.ToBitmap(inpaintMask);

          img.Line(prevPt, pt, Scalar.White, thickness, LineTypes.AntiAlias, 0);

          prevPt = pt;

          wImage.ShowImage(img);

        }

      });

 

      try

      {

        for (; ; )

        {

          switch ((char)Window.WaitKey(0))

          {

            case (char)27: // exit

              return;

            case 'r'.

              inpaintMask.SetTo(Scalar.Black);

              pictureBox2.Image = BitmapConverter.ToBitmap(inpaintMask);

              img0.CopyTo(img);

              wImage.ShowImage(img);

              break;

            case 'i'.

            case '\r'.

              Inpaint().

              break;

          }

        }

      }

      finally

      {

 

        Window.DestroyAllWindows();

      }

    }

 

    private void button3_Click(object sender, EventArgs e)

    {

      Inpaint().

    }

 

    void Inpaint()

    {

      if (pictureBox1.Image == null)

      {

        return;

      }

 

      li = (ListItem)cBoxThresholdTypes.SelectedItem;

      inpaintMethod = (InpaintMethod)li.Value;

 

      Cv2.Inpaint(img, inpaintMask, inpainted, trackBar1.Value, inpaintMethod);

      pictureBox3.Image = BitmapConverter.ToBitmap(inpainted);

      CommandText = String.Format("Cv2.Inpaint(src, mask, dst,{0},{1})", trackBar1.Value, inpaintMethod.ToString());

      txtCommandText.Text = CommandText;

    }

  }

}

Resource DownloadThe download price for this resource is22.0Gold coins, please first
Resource Download
Download Prices22.0 gold coin

Resource Disclaimer (Purchase is deemed to be agreement with this statement):
1. Any operation on the website platform is considered to have read and agreed to the registration agreement and disclaimer at the bottom of the website, this site resources have been ultra-low price, and does not provide technical support
2. Some network users share the net disk address may be invalid, such as the occurrence of failure, please send an e-mail to customer service code711cn#qq.com (# replaced by @) will be made up to send
3. This site provides all downloadable resources (software, etc.) site to ensure that no negative changes; but this site can not guarantee the accuracy, security and integrity of the resources, the user downloads at their own discretion, we communicate to learn for the purpose of not all the source code is not 100% error-free or no bugs; you need to have a certain foundation to be able to read and understand the code, be able to modify the debugging yourself! code and solve the error. At the same time, users of this site must understand that the Source Code Convenience Store does not own any rights to the software provided for download, the copyright belongs to the legal owner of the resource.
4. All resources on this site only for learning and research purposes, please must be deleted within 24 hours of the downloaded resources, do not use for commercial purposes, otherwise the legal disputes arising from the site and the publisher of the collateral liability site and will not be borne!
5. Due to the reproducible nature of the resources, once purchased are non-refundable, the recharge balance is also non-refundable

充值送金币,用余额购买,低至6.7折!Recharge Now

Show CAPTCHA
Don't have an account? enrollment  Forgot your password?