First of all, I'm sorry for my English..
I'm new in OpenCV, trying to remove logos in images. I found this answer in this site --> How to use OpenCV to remove non text areas from a business card?
I follow the steps and write these codes:
int main(int argc,char** argv) {
Mat eroded,dilated,img1=imread("C:\\Users\\Buket\\Desktop\\Belgeler\\Oda Kayıt Belgesi\\OKB001.jpg");
int erosion_size = 6;
Mat elementd = getStructuringElement(MORPH_CROSS,
Size(2 * erosion_size + 1, 2 * erosion_size + 1),
Point(erosion_size, erosion_size) );
int dilation_size = 1;
Mat elemente = getStructuringElement(MORPH_CROSS,
Size(2 * dilation_size + 1, 2 * dilation_size + 1),
Point(dilation_size, dilation_size) );
Mat mask = Mat::zeros(img1.rows, img1.cols, CV_8UC1);
dilate(img1, dilated, elementd);
Mat lastimg;
int count =0;
do{
lastimg = dilated;
erode(dilated, lastimg, elemente);
max(lastimg,img1);
count++;
}while(count < 2);
Now I have an image that just logo on it:
And this is the source image:
In the article, there's that saying "you now have an image with ONLY the logo and no text, use this image to remove the logo". But how can i do that? I research a lot but found nothing..
Please help..
EDIT
Mat dest;
subtract(lastimg,img1,dest);
bitwise_not(dest,dest);
that function is the answer.