필터 지우기
필터 지우기

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