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


發佈了21 篇原創文章 · 獲贊 34 · 訪問量 21萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章