• 大小: 4KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-05-27
  • 语言: Matlab
  • 标签: BMA源程序  

资源简介

一个简单有效的视频差错掩盖算法MATLAB实现--BMA源程序

资源截图

代码片段和文件信息

function  bma

clear all
close all
R=imread(‘1.bmp‘);
C=imread(‘2.bmp‘);%read two frames
R=uint8(R);
figure;imshow(R);


M=288;
N=352;
R=double(R);
C=double(C);

%lose
framesize=M*N;    % 一帧所有像素
   blocksize=8;      % 块的大小
   vnum=M/blocksize; % 垂直方向块个数
   hnum=N/blocksize; % 水平方向块个数
for i=1:vnum
       i1=(i-1)*blocksize+1;
       for j=1:hnum
           j1=(j-1)*blocksize+1;
           if mod(i2)==0 & mod(j2)==0 & i~=vnum & j~=hnum               % 离散丢失           
           %if ((i==2 | i==10 | i==14) & j~=1 & j~=hnum)| (i==6 & j>=6 & j<=20) | (i==7 & j>=12 & j<=18) | (i==13 & j>=6 & j<=12) | (i==15 & j>=8 & j<=18)
           %if ((i==2 | i==3) & j~=1 & j~=hnum) | ((i==9 | i==10) & j~=1 & j~=hnum) | ((i==14 | i==15) & j~=1 & j~=hnum)
           %if (mod(i2)==0 & i~=vnum & j~=1 & j~=hnum) | (mod(i3)==0 & i~=vnum & j~=1 & j~=hnum)
              concealmentok(ij)=0;
              for m=0:blocksize-1
                  for n=0:blocksize-1
                      E(i1+mj1+n)=0;                   % 丢失的像素值以0代替
                  end
              end              
           else
              concealmentok(ij)=1;
              for m=0:blocksize-1
                  for n=0:blocksize-1
                      E(i1+mj1+n)=C(i1+mj1+n);    
                  end
              end
           end 
           reMovVector(ij).x=0;
           reMovVector(ij).y=0;
       end
   end

   

E=uint8(E);
figure;imshow(E);

imwrite(E‘erro2.bmp‘);
E=double(E);

%当前帧C图像2前一帧R图像1,差错帧E图像erro2

tic
 for i=1:vnum                  
     for j=1:hnum
         if concealmentok(ij)==0
              min=100000;
             for k=(i-1)*blocksize-7:(i-1)*blocksize+9
                 for l=(j-1)*blocksize-7:(j-1)*blocksize+9
                   
                   err2=0;
                   if concealmentok(ij-1)~=0              % 左
                      for 

评论

共有 条评论

相关资源