removing unwanted pixels
조회 수: 9 (최근 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에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!