I have tried the following code to reconstruct image without logo by first converting the image to a binary inverse where the logo appears to be white and the rest of the image black then using inpainting function to reconstruct the original image without the logo part. This is for the purposes of learning. What am I doing wrong because Emgu CV is throwing qn exception related to the runtime.

//importing the namespaces
using Emgu.CV; 
using Emgu.CV.CvEnum;
using Emgu.CV.Util; 
using Emgu.CV.Structure; 

//code inside the button handler
 private void button1_Click(object sender, EventArgs e)
        {
// Load the image
Mat img = CvInvoke.Imread(pictureBox1.ImageLocation, ImreadModes.Color);

// Convert the image to grayscale
Mat gray = new Mat();
CvInvoke.CvtColor(img, gray, ColorConversion.Bgr2Gray);

// Apply a threshold to the grayscale image to create a black and white mask
Mat mask = new Mat();
CvInvoke.Threshold(gray, mask, 220, 255, ThresholdType.BinaryInv);

// Use the inpaint function to remove the logo
Mat result = new Mat();
CvInvoke.Inpaint(img, mask, result, 3, InpaintType.NS);

// Display the result
CvInvoke.Imshow("result", result);
CvInvoke.WaitKey(0);
CvInvoke.DestroyAllWindows();
}
/

I don't see any reference to adding a logo in said code. So I'm left to guess you are trying to remove either a watermark or logo.

For that, contact the image's owner and arrange with them for a logo/watermark free version.

Also per the US copyright act, section 1202, removing a watermark without the official owner's consent is illegal for either personal or business use. So be sure to never show this altered image unless it's yours.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.