Blur handwriting in MATLAB

I want thin handwritten characters as shown below:

enter image description here

The code below gives my expected result:

BW = imread('s.png'); BWI = imcomplement(BW); BW2D = im2bw(BWI,0.1); BWT = bwmorph(BW2D,'thin',Inf), BWFinal = imcomplement(BWT); figure, imshow(BWFinal); 

Is this the right approach? Or is there another way to do this in MATLAB?

+6
source share
2 answers

The consensus is that your code is fine. However, to give Shai some run on his points, I add a minor comment:

Using imcomplement may not be necessary, see the documentation.

In particular:

Tip. If IM is a grayscale or RGB double image, you can use the 1-IM expression instead.

If IM is a binary image, you can use the expression ~ IM instead of this function.

+6
source

Yes.

+10
source

Source: https://habr.com/ru/post/982189/


All Articles