Reputation: 621
I am trying to correct uneven background illumination in the text document using Morphological top-hat operation.
After applying Top hat, result I get is worse for analysis than the original image.
img=rgb2gray(imread("test2.png"));
se=strel("square",100);
imshow(imtophat(img,se));
Could you please advice what i am doing wrong ?
Upvotes: 1
Views: 257
Reputation: 60760
The top hat filter works for light text on a black background. You can either invert the image (imcomplement
) before applying the top hat, or use imbothat
instead.
In either case, the output is identical: light text on a black background. You can invert the image after the operation to get dark text on a white background.
Upvotes: 2