implementation of median filtre on FPGA ?

4 vues (au cours des 30 derniers jours)
soukaina
soukaina le 18 Mar 2023
Commenté : soukaina le 25 Mar 2023
Hi everyone, I want to design the median filter on FPGA. I got the output for median filter in matlab and also in matlab simulink. i tried to convert the matlab code to HDL code with HDL coder. but i found alwais this error '' Found unsupported dynamic matrix type at output port: 0, name 'im_med', in the file/function MedFiltre_fixpt " .someone can help me ?
function [im_med] = MedFiltre(J,n,M,N)
Img=zeros(N,M);
for i = 1:M
for j = 1:N
pixel_val = J((i-1)*N + j); % Récupérer la valeur du pixel correspondant dans le vecteur
Img(j,i) = pixel_val; % Copier la valeur du pixel dans la matrice carrée
end
end
p=(n-1)/2;
im_med=zeros(N,M);
im_med = coder.nullcopy(zeros(N, M));
for i=p+1:M-p
for j=p+1:N-p
img0=Img(i-p:i+p,j-p:j+p);
V0=img0(:);
V1=sort(V0);
Im=round(n*n/2);
med=V1(Im);
im_med(i,j)= med;
end
end
%im_med=im_med(:);
end

Réponses (1)

Bharath Venkataraman
Bharath Venkataraman le 23 Mar 2023
You could use the Median Filter block or the visionhdl.MedianFilter System object in Vision HDL Toolbox, which offer this capability.

Community Treasure Hunt

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

Start Hunting!

Translated by