Clear Filters
Clear Filters

Single Characther Cursive Processing

2 views (last 30 days)
Hello,
I'm researching on handwritten letter recognition using matlab. I have several pre-processed image that i took before, and i want to build a program that can automatically find the area of a character like below
from this,
into this
I've been searching for answers, but i only find cursive related question, which disccused how to extreact letters from words in an image. If anyone knows the solution, please let me know, thank you so much.
p.s. : i've attached one preprocessed image

Accepted Answer

Walter Roberson
Walter Roberson on 7 Feb 2021
info_struct = regionprops(imbinarize(YourImage), 'Area');
areas = [info_struct.Area];
This would give a separate area for each separate section. Separate sections could be due to having multiple characters in one image, or could be do to (for example) the dot being separate from the main stroke of a character
If you are certain that there is only one character in the image and you want to know the combined areas, then
area = nnz(imbinarize(YourImage))
  3 Comments
Walter Roberson
Walter Roberson on 7 Feb 2021
bw = imbinarize(YourImage);
info_struct = regionprops(bw, 'Area', 'Image');
info_struct(K).Area is now the area of the K'th section, and info_struct(K).Image is now a binary image, on for each pixel inside the region.
If you are sure you want to count all the regions together (for example count the dot of an i as part of the same image) then
bw = imbinarize(YourImage);
info_struct = regionprops(double(bw), 'Area', 'Image');
You can also instead
bw = imbinarize(YourImage);
area = nnz(bw);
maskv = any(bw,1);
lb = find(maskv,1,'first');
rb = find(maskv,1,'last');
maskh = any(bw,2);
tb = find(maskh,1,'first');
bb = find(maskh,1,'last');
Image = YourImage(tb:bb, lb:rb);
yoel y
yoel y on 7 Feb 2021
Thank you so much for your help. I really appreciate it

Sign in to comment.

More Answers (0)

Categories

Find more on Modify Image Colors in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!