• 大小: 1.01MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-28
  • 语言: Matlab
  • 标签: MATLAB  

资源简介

实现和比较了卡尔曼和维纳滤波器的去噪性能,MATLAB代码可运行

资源截图

代码片段和文件信息


% function exampleFilter
%
% Example of how the Kalman filter performs for real data
obj=VideoReader(‘julius.avi‘);

aviobj=VideoWriter(‘outputvideo.avi‘)
open(aviobj)
nframes=obj.NumberOfframes;
for k=1:nframes
    img=read(objk);
    im2 = imnoise(img‘gaussian‘0.10.2)
    f=im2frame(im2)
    writeVideo(aviobjf)
end
    
close(aviobj)
%--------------------------------------------------------------------------
%---------------------End of Gaussian noise adding-------------------------
%--------------------------------------------------------------------------
%implay(‘outputvideo.avi‘);

filename = ‘outputvideo.avi‘;
mov = VideoReader(filename);

% Output folder
%getting no of frames
videoframes=[];
newframes=[];
realframe=[];
wienerframe=[];
psnrk=[];
filteredframe=[];
filteredframe1=[];
numberOfframes = mov.NumberOfframes;
numberOfframesWritten = 0;

for frame = 1 :numberOfframes
   thisframe = read(mov frame);
  % outputbaseFileName = sprintf(‘%3.3d.bmp‘ frame);
   
   %outputFullFileName = fullfile(outputFolder outputbaseFileName);
   %imwrite(thisframe outputFullFileName ‘bmp‘);
   %progressIndication = sprintf(‘Wrote frame %4d of %d.‘ framenumberOfframes);
   videoframes = cat(3videoframesthisframe);
   %disp(progressIndication);
   %numberOfframesWritten = numberOfframesWritten + 1;
end
for frame=1:size(videoframes3)
    x=videoframes(::frame);
    y=im2single(x);
    newframes = cat(3newframesy);
end

%Apply filter
k=Kalman_Stack_Filter(newframes);
k75=Kalman_Stack_Filter(newframes0.75);
outputFolder= fullfile(cd ‘filteredframe‘);
if ~exist(outputFolder ‘dir‘)
   mkdir(outputFolder);
end
y=size(k3);
disp(y);
for frame=1:y
    thisframe=k(::frame);
    thisframe1=k75(::frame);
    y=im2single(thisframe);
    y1=im2single(thisframe1);
    filteredframe = cat(3filteredframey);
    filteredframe1=cat(3filteredframe1y1);

    %outputbaseFileName1 = sprintf(‘%3.3d.bmp‘ frame);
    %disp(x);
   %disp(outputbaseFileName1);
    %outputFullFileName1 = fullfile(outputFolder outputbaseFileName1);
    %disp(outputFullFileName1);
   %disp(y);
   %imwrite(thisframe outputFullFileName1 ‘bmp‘);
end
%--------------------------------------------------------------------------
%---------------------Wiener Filering--------------------------------------
%--------------------------------------------------------------------------
%implay(videoframes);

outputFolder3 = fullfile(cd ‘wienerframes‘);
if ~exist(outputFolder3 ‘dir‘)
   mkdir(outputFolder3);
end
disp(outputFolder3);

for frame=1:size(newframes3)
   I=videoframes(::frame);
   I=im2single(I);
    %x=frame+5;
    %outputbaseFileName1 = sprintf(‘%3.3d.bmp‘x);
    %outputFullFileName1 = fullfile(outputFolder3 outputbaseFileName1);
    %disp(outputFullFileName1);
    J=wiener2(I[5 5]);
    wienerframe=cat(3wienerframeJ);
end
%--------------------------------------------------------------------------
%---------------------End of Wiener Filering---------------------

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-09-12 16:53  Comparing-and-combining-Kalman-and-Wiener-Filter-for-video-denoising-master\
     文件      613275  2016-09-12 16:53  Comparing-and-combining-Kalman-and-Wiener-Filter-for-video-denoising-master\FinalYearProjectPaper-2.docx
     文件        1088  2016-09-12 16:53  Comparing-and-combining-Kalman-and-Wiener-Filter-for-video-denoising-master\Kalman_Stack_Filter.m
     文件         742  2016-09-12 16:53  Comparing-and-combining-Kalman-and-Wiener-Filter-for-video-denoising-master\README.md
     文件        6065  2016-09-12 16:53  Comparing-and-combining-Kalman-and-Wiener-Filter-for-video-denoising-master\exampleFilter.m
     文件        4035  2016-09-12 16:53  Comparing-and-combining-Kalman-and-Wiener-Filter-for-video-denoising-master\gaussiannoise.m
     文件      820224  2016-09-12 16:53  Comparing-and-combining-Kalman-and-Wiener-Filter-for-video-denoising-master\julius.avi
     文件         370  2016-09-12 16:53  Comparing-and-combining-Kalman-and-Wiener-Filter-for-video-denoising-master\psnrcalculationnew.m
     文件         532  2016-09-12 16:53  Comparing-and-combining-Kalman-and-Wiener-Filter-for-video-denoising-master\terminal.m
     文件         249  2016-09-12 16:53  Comparing-and-combining-Kalman-and-Wiener-Filter-for-video-denoising-master\wienerfilter.m

评论

共有 条评论