How can we find the internal width of a alphabet?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Muhammad Bilal
am 6 Jun. 2020
Kommentiert: Muhammad Bilal
am 6 Jun. 2020
Hi,
How can we find the internal width of a alphabet for a complete region and store as a array? Is there any command in MATLAB or any other way? The image file has been attached herein.
Thanks
~Muhammad Bilal
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/310922/image.png)
2 Kommentare
Rik
am 6 Jun. 2020
Your question sounds like you have many images you want to measure this on. Can you show other images as well? For this image you can use find to find the first and last black pixel in your image on a specific row, but that might not work for all your cases.
Akzeptierte Antwort
Ameer Hamza
am 6 Jun. 2020
Bearbeitet: Ameer Hamza
am 6 Jun. 2020
Try this
im = im2double(imread('alif.png'));
im_gray = rgb2gray(im);
im_bin = imbinarize(im_gray);
[row, col] = find(~im_bin);
width_pixel = mean(splitapply(@numel, col, findgroups(row)));
It calculates the mean of pixel width across all rows in which the character is present.
5 Kommentare
Ameer Hamza
am 6 Jun. 2020
That question is much more complicated, and completely automating it might need much effort. Maybe you can make it partially automatic by using ginput().
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Processing and Computer Vision finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!