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();
}
/