How do I add a median filter to this code?

1 visualización (últimos 30 días)
Peter Masters
Peter Masters el 24 de Abr. de 2020
Comentada: Peter Masters el 24 de Abr. de 2020
Hi, I am trying to add a median filter to this step filter algorithm. I have tried to add it at the end but I does not appear to accept the code. Any help is most welcome. Thanks Peterfor ind = 1:10
% parameters of Step Filter
Step_Filter_grammes = 30; %size
Step_Filter_Dbw = param_vec(ind) *[2 4]; %vector of width of main wave
Step_Filter_step = pi/12; %angle step
Step_Filter_DTheta = [0:Step_Filter_step:pi-(Step_Filter_step)]; %angle vector
Step_Filter_type = 0; % type of step filter in {0,1} : 1 step function, 0 Polynomial filter
grammes = Step_Filter_grammes;
Dbw = Step_Filter_Dbw;
DTheta = Step_Filter_DTheta;
[Y]= step_pol_Filtering(Z,grammes,DTheta,Dbw,Step_Filter_type);
fig_ind = fig_ind + 1;
figure(fig_ind); clf; hold on
imagesc(Y),title(['Ruben Weg hl.jpg', num2str(param_vec(ind))]);
colormap('gray');
axis equal tight
axis ij
drawnow
end
colormap('gray');
axis equal tight
axis ij
fig_ind = fig_ind + 1;
figure(fig_ind); clf; hold on
imagesc(Z),title('image.jpg original');

Respuestas (1)

David Hill
David Hill el 24 de Abr. de 2020
It should be as easy as:
newImage=medfilt2(I,[3,3]);%whatever many pixels you want to filter [3,3]

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by