removing unwanted pixels

I have an image
in which i need only the text ,i want to remove extra whitr regions around the text.please help

6 comentarios

Walter Roberson
Walter Roberson el 25 de Abr. de 2012
*Everything* is text in *some* writing system.
Jan
Jan el 25 de Abr. de 2012
Manually or automatically? Is the picture printed on paper, in a graphics file or imported to Matlab already? Does the problem concern this picture only or do you have a set of pictures? How much noise is allowed in the pictures? Please, kash, post all relevant details.
kash
kash el 25 de Abr. de 2012
jAN this image is output from another process,i have around 6 pictures in that i need only the text and not others i.e
"Pedestrains Only" which is in english and hindi..
other white regions must be removed
kash
kash el 25 de Abr. de 2012
Walter consider only english and hindi wordings
Sean de Wolski
Sean de Wolski el 25 de Abr. de 2012
How can you tell whether it's German/French/Spanish/English by looking at the text alone?
For example: whiskey
Jan
Jan el 22 de Mayo de 2012
@Sean: A partial solution of your problem: "whiskey" is not German.

Iniciar sesión para comentar.

 Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 25 de Abr. de 2012

1 voto

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)

Más respuestas (2)

Teja Muppirala
Teja Muppirala el 25 de Abr. de 2012

0 votos

Maybe IMFILL might work?
A = [1 1 1 1; 1 0 1 0; 1 1 1 0]
imfill(A)
imfill(A) - A

2 comentarios

kash
kash el 25 de Abr. de 2012
Teja i need automatic removing
Sean de Wolski
Sean de Wolski el 25 de Abr. de 2012
@kash, what 's not automagical about that?

Iniciar sesión para comentar.

Stephen
Stephen el 22 de Mayo de 2012

0 votos

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)=[];

Categorías

Más información sobre Image Processing Toolbox en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 25 de Abr. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by