YUV420图像转换到400图像并输出

读取YUV420图像,并提取亮度分量(400图像)输出。

function [ A ] = yuv420to400( fileIn, fileOut, numFrames, width, height )
%YUV420TO400 Summary of this function goes here
%   Detailed explanation goes here

fid=fopen(fileIn,'rb');
outfid=fopen(fileOut,'wb');

% fseek(fid,352*288*1.5*10,'bof');

for i=1:numFrames
    Y=fread(fid,[width  , height  ], 'uint8');
    U=fread(fid,[width/2, height/2], 'uint8');
    V=fread(fid,[width/2, height/2], 'uint8');

    fwrite(outfid,Y,'uint8');
    % fwrite(outfid,U,'uint8');
    % fwrite(outfid,V,'uint8');
end

fclose(fid);
fclose(outfid);

end


你可能感兴趣的:(yuv)