removing unwanted pixels
1 次查看(过去 30 天)
显示 更早的评论
I have an image
in which i need only the text ,i want to remove extra whitr regions around the text.please help
6 个评论
Sean de Wolski
2012-4-25
How can you tell whether it's German/French/Spanish/English by looking at the text alone?
For example: whiskey
采纳的回答
Andrei Bobrov
2012-4-25
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 个评论
更多回答(2 个)
Teja Muppirala
2012-4-25
Maybe IMFILL might work?
A = [1 1 1 1; 1 0 1 0; 1 1 1 0]
imfill(A)
imfill(A) - A
2 个评论
Stephen
2012-5-22
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!