How do I add a median filter to this code?
Afficher commentaires plus anciens
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');
Réponses (1)
David Hill
le 24 Avr 2020
It should be as easy as:
newImage=medfilt2(I,[3,3]);%whatever many pixels you want to filter [3,3]
1 commentaire
Peter Masters
le 24 Avr 2020
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!