Effacer les filtres
Effacer les filtres

how to get thickness of any character

2 vues (au cours des 30 derniers jours)
Vish
Vish le 1 Avr 2016
Commenté : Image Analyst le 5 Avr 2016
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..

Réponses (2)

KSSV
KSSV le 1 Avr 2016
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 commentaires
Vish
Vish le 5 Avr 2016
i get some digit as 248.418 now what is this?
Image Analyst
Image Analyst le 5 Avr 2016
Try this.

Connectez-vous pour commenter.


Image Analyst
Image Analyst le 1 Avr 2016
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