1
function RGB = Median1RGB(RGB)
2
fmin=0.15; % íèæíÿÿ ãðàíèöà - ÷àñòîòíûé äèàïàçîí äûõàòåëüíîé âîëíû
3
dt=1/30; % èíòåðâàë âðåìåííîé äèñêðåòèçàöèè
4
Nmed=1/(dt*fmin); % àïåðòóðà ôèëüòðà
5
nc=0:dt:length(RGB)*dt-dt;
6
disp("Îêíî ìåäèàííîé ôèëüòðàöèè: "+Nmed);
8
figure('Name','RGB','Position', [0 0 600 300]); set(gcf,'name',"Ñðàâíåíèå ìåäèàííîé ôèëüòðàöèè"); clf;
10
plot(nc, RGB(:,1),"red", nc, RGB(:,2),"green", nc, RGB(:,3),"blue");
11
title("RGB äî ìåäèàííîé ôèëüòðàöèè"); xlabel("seconds"); grid on;
13
% Ìåäèàííàÿ ôèëüòðàöèÿ
14
RGB(:,1)=RGB(:,1)-medfilt1(RGB(:,1),Nmed);
15
RGB(:,2)=RGB(:,2)-medfilt1(RGB(:,2),Nmed);
16
RGB(:,3)=RGB(:,3)-medfilt1(RGB(:,3),Nmed);
19
plot(nc, RGB(:,1),"red", nc, RGB(:,2),"green", nc, RGB(:,3),"blue");
20
title("RGB ïîñëå ìåäèàííîé ôèëüòðàöèè"); xlabel("seconds"); grid on;