You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use the following code to create a black logo on a white image mask so that I can use the Emgu CV inpaint function to reconstruct the original image using the mask without the logo. Please help me make this code compile and work
//get the image in picture box 1
Bitmap map = (Bitmap)pictureBox1.Image;
//convert the bitmap object to an emgu cv object Image<Bgr, Byte> object
Image<Bgr, Byte> image = new Image<Bgr,Byte>(pictureBox1.ImageLocation);
//make sure you use an emgu cv library version 3.X , later versions do not support the above constructor
//create a Mat object out of that inage object
Mat mymat = image.Mat;
//convert the mat to gray scale
Mat gray = new Mat();
CvInvoke.CvtColor(mymat, gray,ColorConversion.Bgr2Gray);
//apply a threshold to the image to
//create a black and white mask
Mat mask = new Mat();
CvInvoke.Threshold(gray, mask,220, 225,ThresholdType.BinaryInv);
//use in painting function to remove the logo
Mat result = new Mat(); CvInvoke.Inpaint(mymat, mask, result, 3, InpaintType.Ns);
// Display the result.
CvInvoke.Imshow("Image without Logo", result);
CvInvoke.WaitKey(0);
CvInvoke.DestroyAllWindows();
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to use the following code to create a black logo on a white image mask so that I can use the Emgu CV inpaint function to reconstruct the original image using the mask without the logo. Please help me make this code compile and work
`
Beta Was this translation helpful? Give feedback.
All reactions