Reputation: 11
How can i remove unwanted blob from this image so that only text area is visible in the image?Image with unwanted blob
Upvotes: 0
Views: 105
Reputation: 175
If what you are looking for is always text, I suggested first applying an OCR to recognize the text.
I=imread('image'jpg');
ocrResults = ocr(image);
Iocr = insertObjectAnnotation(image, 'rectangle', ...
ocrResults.WordBoundingBoxes, ...
ocrResults.WordConfidences);
figure; imshow(Iocr);
And the result should be something like this:
After you apply OCR, in the variable ocrResults you will have a field that will be CharacterBoundingBoxes, where through this you can create a binary mask of ones (on the position of the boxes) and erase everything else (zeros). Of course some noise will be detected as text, but if you work a bit with morphological operations as explained above (bwareaopen) you will have better results.
Upvotes: 1