Final project is basically taking the intra-prediction and motion compensation in homeworks, and integrate them into a matlab function that take a sequence of images, and code the first frame as...

1 answer below »

Final project is basically taking the intra-prediction and motion compensation in homeworks, and integrate them into a matlab function that take a sequence of images, and code the first frame as INTRA, and subsequent frames as INTER and generate a bitstream according to the quantization specified.


Provide full implementation of the following function:


%function [bitstream]=compressSeq(seq_name, frames, opt)


% seq_name- directory where sequence as f-%d.png are stored


% frames - [1 2 3 4], or [1 3 5], etc, index to the frame numbers in the seq


% options


function [bitstream]=compressSeq(fname, frames)













%function [bitstream, quality]=compressSeq(seq_name, frames, opt)


% seq_name- directory where sequence as f-%d.png are stored


% frames - [1 2 3 4], or [1 3 5], etc, index to the frame numbers in the seq


% opt - options, eg. opt.pel = 0.5;


% bitstream - array of 0/1s


% psnr - n x 1, PSNR


function [bitstream]=compressSeq(seq_name, frames)


f_list = dir(seq_name);


for k=1:length(frames)



%load seq



F{k} = imread(f_list(k).name);


end % for k


% initialize bitstream


bitstream =[]; bit_cnt =0;


% encode first frame as INTRA


[bs, nbits]=getINTRA(F{1}, QP);


bitstream(1:nbits) = bs; bit_cnt=nbits;


% reconstructed from INTRA


G{1}=decodeINTRA(bs, nbits, QP);






% code the rest as INTER


for k=2:length(frames)


[bs, nbits]=getINTER(G(k-1), F(k), QP);


G(k) = decodeINTER(G(k-1), bs, nbits, QP);


% update bitstream


bitstream(bit_cnt+1:bit_cnt+nbits) = bs;


End






% PSNR


for k=1:length(frames)



Quality(k) = psnr(F{k}, G{k});


end











Notice that this program should be able to work with any sequences. TA will check that with arbitrary seq of images.

Answered 3 days AfterMay 03, 2022

Answer To: Final project is basically taking the intra-prediction and motion compensation in homeworks, and...

Uhanya answered on May 07 2022
95 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Submit New Assignment

Copy and Paste Your Assignment Here