I am converting a grayscale signature image to thin image but not getting the desired output

after applying the im2bw(img,graythresh(img)) function i get the following image
but the image is not smooth enough after applying thining on the said image i get the following
so how to get rid of extra roots from the thin image and get smooth signature skeleton

 採用された回答

Anand
Anand 2015 年 9 月 17 日
It looks like you need to clean up the binary image a little before thinning.
This worked for me:
bw = im2bw(img,graythresh(img));
% remove some of the noisy edges in the mask.
bw_clean = imopen(bw, strel('disk',1));
% remove small foreground objects.
bw_clean = bwareaopen(bw_clean, 25);
% invert the image and thin it.
bw_thin = bwmorph(imcomplement(bw_clean), 'thin', Inf);

9 件のコメント

Sohail
Sohail 2015 年 9 月 18 日
Hi Anand thanks for your response. let me ask you about the following image
here in the image there are some white pixels inside black stroke of the signature can we remove this by adding black pixels in place of white pixels inside the stroke
Walter Roberson
Walter Roberson 2015 年 9 月 18 日
imclose the object to fill the small holes.
Sohail
Sohail 2015 年 9 月 18 日
Hi Walter Roberson how would you approach to correctly thin the grayscale image (attached with question) to thin image without having extra roots
Sohail
Sohail 2015 年 9 月 18 日
編集済み: Sohail 2015 年 9 月 18 日
Whats the function to remove extra roots around after thining function
Walter Roberson
Walter Roberson 2015 年 9 月 18 日
I would not do that. "Extra roots" is not well defined and "correctly thin" is not well defined. When it comes to signature verification, little turns can be characteristic, as can be stroke width.
However, you might find it interesting to dilate the object, then filter out small blobs such as with bwareaopen or bwareafilt, and then skeletonize it.
Sohail
Sohail 2015 年 9 月 18 日
編集済み: Sohail 2015 年 9 月 18 日
actually i am only interested in endpoints after thinning and the roots produces extra endpoints which increase total endpoints count and that is what i dont want
Walter Roberson
Walter Roberson 2015 年 9 月 18 日
Have you considered bwmorph() 'spur' ?
Image Analyst
Image Analyst 2015 年 9 月 18 日
imfill() will fill completely surrounded holes and leave exterior boundaries unchanged. imclose() will fill interior holes and will smooth out exterior boundaries.
Image Analyst
Image Analyst 2015 年 9 月 18 日
Have you seen section 23.4.6.4 of vision bib? It has handwriting algorithms.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeImage Processing Toolbox についてさらに検索

質問済み:

2015 年 9 月 17 日

コメント済み:

2015 年 9 月 18 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by