⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myfunc_read_cif.m

📁 对视频序列进行三维小波变换
💻 M
字号:
function [Y] = myfunc_read_cif(nFrame,in_file_name)
%
%  This function reads CIF,SIF,QCIF 4:2:0 video files and
%  shows the Y component (luminance)
%  nFrame: number of frames to be read from the file specified
%

[fid message]= fopen(in_file_name,'rb');
% input video format
if length(strfind(in_file_name, 'cif')) > 0
    nRow = 288;
    nColumn = 352;
elseif length(strfind(in_file_name, 'qcif')) > 0
    nRow = 288 / 2;
    nColumn = 352 / 2;
elseif length(strfind(in_file_name, 'sif')) > 0
    nRow = 240;
    nColumn = 352;      
end

for i = 1: nFrame
    % read ?component
	img_y = fread(fid, nRow * nColumn, 'uchar');
    img_y = reshape(img_y, nColumn, nRow);
    img_y = img_y';

    Y(:,:,i) = img_y;
  %  imshow(uint8(img_y));


  
    % read U component    
    img_u = fread(fid, nRow * nColumn/4 , 'uchar');
    img_u = reshape(img_u, nColumn/2, nRow/2);
    img_u = img_u';
  %  U(:,:,i) = img_u;
  %  imshow(uint8(img_u));


    % read V component 
    img_v = fread(fid, nRow * nColumn/4, 'uchar');
    img_v = reshape(img_v, nColumn/2, nRow/2);
    img_v = img_v';
   % V(:,:,i) = img_v;
   % imshow(uint8(img_v));
end

fclose(fid);
disp('ok');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -