Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
texture removal

Subject: texture removal

From: Vihang Patil

Date: 3 Sep, 2010 09:44:05

Message: 1 of 6

Hello
I want to read some alphanumeric data printed on a textured background, a sample image of which I have uploaded here. http://drop.io/texture11
I would like to erase the background texture, so that only the alphanumeric character stand out. Later I need to do OCR, which I think I can be able to do, but segmentation right now is possing a problem.
using ;

background = imopen(I,strel('disk' ,10)); does not help

Thanks
Vihang

Subject: texture removal

From: ImageAnalyst

Date: 3 Sep, 2010 10:07:19

Message: 2 of 6

Why don't you try filtering it in the Fourier domain? The texture
should show up as fairly sharp and easily located spikes that you can
then zero out and inverse Fourier transform to get an image without
the texture.

Subject: texture removal

From: Vihang Patil

Date: 3 Sep, 2010 11:15:06

Message: 3 of 6

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <994bd888-c4b6-4dd9-befa-57d51cf7edea@l6g2000yqb.googlegroups.com>...
> Why don't you try filtering it in the Fourier domain? The texture
> should show up as fairly sharp and easily located spikes that you can
> then zero out and inverse Fourier transform to get an image without
> the texture.

Dear ImageAnalyst
Can you please post a filtering example in fourier domain?. I am not very conversant with filtering in frequency domain..
Thanks
Vihang

Subject: texture removal

From: ImageAnalyst

Date: 3 Sep, 2010 12:05:35

Message: 4 of 6

I don't have a Fourier filtering demo handy to give you. I'd have to
write one. You can do that too, and possibly learn more in the
process. Just look over the documentation. FFT the image, display
it, look for spikes, zero them out, then inverse FFT and display. Not
too hard.

Subject: texture removal

From: Vihang Patil

Date: 3 Sep, 2010 14:51:22

Message: 5 of 6

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <de23bfe9-8ba1-4924-a505-0122dd69add9@i31g2000yqm.googlegroups.com>...
> I don't have a Fourier filtering demo handy to give you. I'd have to
> write one. You can do that too, and possibly learn more in the
> process. Just look over the documentation. FFT the image, display
> it, look for spikes, zero them out, then inverse FFT and display. Not
> too hard.+

Dear ImageAnalyst
I tried this, please tell me if the output of this filter is good or I need to try some other filtering..

% butterworth low pass filter
function [out, H] = butterworth_low1(im,fc,n)
[co,ro] = size(im);
cx = round(co/2); % find the center of the image
cy = round (ro/2);
imf=fftshift(fft2(im));
H=zeros(co,ro);
for i = 1 : co
    for j =1 : ro
        d = (i-cx).^2 + (j-cy).^ 2;
        H(i,j) = 1/(1+((d/fc/fc).^(2*n)));
    end;
end;
outf = imf .* H;
out = abs(ifft2(outf));
%%


%%example
I = imread('texture.bmp');
gray = im2double(rgb2gray(texture));
background = imopen(gray,strel('disk',5));
K = imsubtract(gray,background);
J = imadjust(K);
[out, H] = butterworth_low1(J,20,2);
figure, imshow(out,[])


Thanks
Vihang

Subject: texture removal

From: zeal ind

Date: 9 Mar, 2011 07:38:05

Message: 6 of 6

"Vihang Patil" <vihang_patil@yahoo.com> wrote in message <i5r21a$qad$1@fred.mathworks.com>...
> ImageAnalyst <imageanalyst@mailinator.com> wrote in message <de23bfe9-8ba1-4924-a505-0122dd69add9@i31g2000yqm.googlegroups.com>...
> > I don't have a Fourier filtering demo handy to give you. I'd have to
> > write one. You can do that too, and possibly learn more in the
> > process. Just look over the documentation. FFT the image, display
> > it, look for spikes, zero them out, then inverse FFT and display. Not
> > too hard.+
>
> Dear ImageAnalyst
> I tried this, please tell me if the output of this filter is good or I need to try some other filtering..
>
> % butterworth low pass filter
> function [out, H] = butterworth_low1(im,fc,n)
> [co,ro] = size(im);
> cx = round(co/2); % find the center of the image
> cy = round (ro/2);
> imf=fftshift(fft2(im));
> H=zeros(co,ro);
> for i = 1 : co
> for j =1 : ro
> d = (i-cx).^2 + (j-cy).^ 2;
> H(i,j) = 1/(1+((d/fc/fc).^(2*n)));
> end;
> end;
> outf = imf .* H;
> out = abs(ifft2(outf));
> %%
>
>
> %%example
> I = imread('texture.bmp');
> gray = im2double(rgb2gray(texture));
> background = imopen(gray,strel('disk',5));
> K = imsubtract(gray,background);
> J = imadjust(K);
> [out, H] = butterworth_low1(J,20,2);
> figure, imshow(out,[])
>
>
> Thanks
> Vihang
Vihang,
What you did was pretty decent,but these few points mite yield better results
1)consider the image as a summation of frequencies.
2)instead of simply extracting the central region,consider frequency enhancement and decrement.
3)progressively enhance the frequencies of the central region by a constant factor.
4)progressively decrease the frequencies of the surrounding regions by the same constant factor.
5)try this with different constants.
6)be careful if choose a large constant the finer details will be eroded.
7)finally logically and the resulting image with the original one.
This should remove the background.
reegards,
              aniruddha.s.n
              DSI backbenchers

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us