matlab - How to find aspect ratio of an image -


take, example, character 'b','m' or number '1','2' image.
have find out aspect ratio of character or number.
did not correct value, code:

e = imread('1.jpg');  level = graythresh(e); bw = im2bw(e,level);    [m,n]=size(bw); ar=m/n 

enter image description here

you need take aspect ratio of bounding box of character

s = regionprops( bw, 'boundingbox' ); ar = s.boundingbox(4) / s.boundingbox(3);  

see doc of regionprops values in 'boundingbox'.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -