how to get thickness of any character
5 次查看(过去 30 天)
显示 更早的评论
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..
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/159609/image.jpeg)
0 个评论
回答(2 个)
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.
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!