Single Characther Cursive Processing
2 次查看(过去 30 天)
显示 更早的评论
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,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/511967/image.png)
into this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/511972/image.png)
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
0 个评论
采纳的回答
Walter Roberson
2021-2-7
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 个评论
Walter Roberson
2021-2-7
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);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Modify Image Colors 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!