removing unwanted pixels
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have an image
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/147128/image.png)
in which i need only the text ,i want to remove extra whitr regions around the text.please help
6 commentaires
Sean de Wolski
le 25 Avr 2012
How can you tell whether it's German/French/Spanish/English by looking at the text alone?
For example: whiskey
Réponse acceptée
Andrei Bobrov
le 25 Avr 2012
Im = imread('Q8.png');
BW = im2bw(Im,graythresh(Im));
bw1 = imdilate(BW,[0 0 0 0 1 1 1 1]);
s = regionprops(bw1,'Area');
k = sort([s.Area],'descend');
bw2 = bwareaopen(bw1, k(2)-1);
bw3 = imfill(bw2,'holes');
bwOut = bw3 & BW;
imshow(bwOut)
0 commentaires
Plus de réponses (2)
Teja Muppirala
le 25 Avr 2012
Maybe IMFILL might work?
A = [1 1 1 1; 1 0 1 0; 1 1 1 0]
imfill(A)
imfill(A) - A
2 commentaires
Stephen
le 22 Mai 2012
load the image and make it so black==0 and white==1, then...
Words = imclearborder(~IMG)
if you want to crop it, you can try
Words(sum(Words,2)==0,:)=[];
Words(:,sum(Words)==0)=[];
0 commentaires
Voir également
Catégories
En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!