How can i invert colors in an character image?
Show older comments
I started working on handwritten English character recognition using neural network. In my scanned character images, characters are written in black color with a white background. Is there any function in MATLAB which can convert the character image's background color into black and the printed character into white color?
Actually in the process of skeletonization (thinning) of the character image, i used a function "bwmorph", which works well if the character is written with white color on a black background. The code i used was:
Img1=bwmorph(Img,'skel',Inf);
It works correctly if Img is the character image with white character on black background but doesn't work when i take Img as a black ink character with white background.
Is there any other alternative of "bwmorph"? or any other code used for thinning the character image..
Thanks... -Amit
Accepted Answer
More Answers (1)
farhan rana
on 10 Oct 2011
0 votes
there was an even simpler way to do this but i dont remember it correctly. all it took was subtracting 1 from the image or something. forgive me for not remembering correctly :(
Categories
Find more on Text Detection and Recognition in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!