filtering out letters in an image

6 Ansichten (letzte 30 Tage)
kandlev
kandlev am 18 Nov. 2020
Beantwortet: Manas Meena am 25 Mär. 2021
For %A, I only showed all the periods.
For %B, I only showed all the i's and j's
For %C, I want to only show all the o's
For %D, I want to only show all the p's
I'm having a lot of trouble with C and D where I can't figure out how to only show the o's and p's
Please only suggest morphological operations, that's what I know right now.
originalBW = imread('text.png');
originalBW = logical(originalBW);
figure;
imshow(originalBW);
se1 = strel('square',9);
B1 = imerode(originalBW, se1);
B2 = imreconstruct(B1, originalBW);
C1 = logical(originalBW - B2);
C2 = bwareafilt(originalBW,[10,15]);
figure
imshow(C2);
%B
SE1 = strel('rectangle', [15,1]);
dilateBW = imdilate(C1, SE1);
reconBW = imreconstruct(dilateBW, originalBW);
BW2 = logical(reconBW-C1);
dilateBW2 = imdilate(BW2, SE1);
C2 = imreconstruct(dilateBW2, originalBW);
figure;
imshow(C2);
%C
BW3 = imfill(originalBW, 'holes');
SE2 = strel('disk', 4);
BW4 = imerode(BW3, SE2);
C3 = imreconstruct(logical(BW4),originalBW);
figure;
imshow(C4);
%D
C4 = bwareafilt(C3,12);
figure;
imshow(C4);

Antworten (1)

Manas Meena
Manas Meena am 25 Mär. 2021
To filter out and detect specific letters from a binary image you'll need to define characteristics that define the particular letter you are interested in.
Please refer to the following link for the same

Community Treasure Hunt

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

Start Hunting!

Translated by