フィルターのクリア

how to get thickness of any character

2 ビュー (過去 30 日間)
Vish
Vish 2016 年 4 月 1 日
コメント済み: Image Analyst 2016 年 4 月 5 日
suppose i have a English letter 'A' now i want to know the thickness of this character where the character is in image format with me and it is hand written character. also i want to know only thickness of single line either horizontal or vertical..

回答 (2 件)

KSSV
KSSV 2016 年 4 月 1 日
There could be many other ways. How about the following method?
clc; clear all ;
k = imread('your_image.jpg') ;
image([0 +1], [0 +1],k);
% imshow(k) ;
coor = ginput(2) ;
hold on
plot(coor(:,1),coor(:,2),'*r') ;
% Find thickness
x1 = coor(1,1) ; y1 = coor(1,2) ;
x2 = coor(2,1) ; y2 = coor(2,2) ;
thk = sqrt((x2-x1)^2+(y2-y1)^2) ;
save your image into a jpg.
  2 件のコメント
Vish
Vish 2016 年 4 月 5 日
i get some digit as 248.418 now what is this?
Image Analyst
Image Analyst 2016 年 4 月 5 日
Try this.

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


Image Analyst
Image Analyst 2016 年 4 月 1 日
Several ways depending on what you mean.
You can take the area with regionprops(), and then skeletonize with bwmorph(). The sum of the skeleton image is the length, and the mean width is the area divided by the length. That is the width of the strokes.
You can also get the width of the bounding box with regionprops. See my Image Segmentation Tutorial for a full demo: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
You can also get the feret diameters of the whole character using my attached demo. It will give you the length of the two points farthest apart and then the width of a cross section at the middle.
You can also get the bounding box that is tilted, instead of aligned with image edges like regionprops gives you, if you use John D'Errico's nice File Exchange submission: http://www.mathworks.com/matlabcentral/fileexchange/34767-a-suite-of-minimal-bounding-objects Be sure to look over all of his numerous other submissions. He has some nice ones in there.

Community Treasure Hunt

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

Start Hunting!

Translated by