# How can I set low-pass filter ( frequency ) for an image ?

Status
Not open for further replies.

#### Hamid.M

##### Newbie level 3 Hi guys

* How can I design low-pass filter ( frequency range ) for an image with this option ?
* the function should be get frequency ( threshold ) and ignoring frequency that bigger than threshold frequency for an image
* Are there any function to doing this?
* if there is one would you explain the parameters ...
thx all of you

Last edited:

#### jeffrey samuel It is possible knowing the frequency range can help us tell more info But if your data is in analog form then there is no issues in doing it with a LP filter once digitised other methods are to be used for the same implementation

Do specify the BW you want to pass through the filter to have more idea and also specify if your image is digitised or not

• Hamid.M

### Hamid.M

Points: 2

#### Hamid.M

##### Newbie level 3 my image class is uint8 ( for example 256*256 )
i have to implement function to get frequency from user and the function should be ignoring frequency that bigger than the frequency
something like that ignrImFreq(im,Freq)
this function must be ignore the image frequency bigger than Freq

#### fpgaengineer

##### Junior Member level 2 You will have to recalculate the filter coefficients after an update of the edge frequency, given by the user. Equations for this can be found in nearly any image processing book. What you also need is the functional logic behind that: Depending of the image and the quality of data, the filter response in terms of stop band ripple and pass band ripple is allways a trade off.

• Hamid.M

### Hamid.M

Points: 2

#### Hamid.M

##### Newbie level 3 thank's all of you
I writed the Function This way
where im is an image matrix
this is a butterworth filter
is it true?
/////////////////////////////////////////////
butterworth filter has an integer parameter and I ignored the parameter (n=1)
the parameter is kind of sharp rate for an image
/////////////////////////////////////////////
function lowpassFilter(im, cutoff)
im=rgb2gray(im);
sizeIm=size(im);
if cutoff < 0 | cutoff > 0.5
error('cutoff frequency must be between 0 and 0.5');
end
rows = sizeIm(1);
cols = sizeIm(2);
% X and Y matrices with ranges normalised to +/- 0.5
x = (ones(rows,1) * [1:cols] - (fix(cols/2)+1))/cols;
y = ([1:rows]' * ones(1,cols) - (fix(rows/2)+1))/rows;
radius = sqrt(x.^2 + y.^2); % A matrix with every pixel = radius relative to centre.
f = 1 ./ (1.0 + (radius ./ cutoff).^(2)); % The filter
fim=fftshift(fft2(im));
result=f.*fim;
imshow(ifft2(ifftshift(result)));
end

Status
Not open for further replies.