필터 지우기
필터 지우기

How can we find the internal width of a alphabet?

조회 수: 1 (최근 30일)
Muhammad Bilal
Muhammad Bilal 2020년 6월 6일
댓글: Muhammad Bilal 2020년 6월 6일
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
  댓글 수: 2
Rik
Rik 2020년 6월 6일
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.
Muhammad Bilal
Muhammad Bilal 2020년 6월 6일
Yes, you are right. My end goal is a little bit complex. Anyway, thank you for your concern. @Ameer Hamza answered to my question.

댓글을 달려면 로그인하십시오.

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 6월 6일
편집: Ameer Hamza 2020년 6월 6일
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
Ameer Hamza
Ameer Hamza 2020년 6월 6일
That question is much more complicated, and completely automating it might need much effort. Maybe you can make it partially automatic by using ginput().
Muhammad Bilal
Muhammad Bilal 2020년 6월 6일
Yes, you are right. But I am trying to resolve this problem.
Thank you for your suggestions

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by