0
這項工作是在MPEG編解碼器上,它應該將YUV文件作爲原始視頻輸入。以下是我使用的YUV文件轉換代碼爲RGBmatlab中clipvalue()的錯誤
fileName = 'bus.y4m';
width = 250;
height = 250;
nrFrame = 10;
fileId = fopen(fileName, 'r');
subSampleMat = [1, 1; 1, 1];
dummy = fgetl(fileId); % Skip file header
%progressbar
for f = 1:nrFrame
%f
% Skip frame header
dummy = fgetl(fileId);
fprintf('fileID = %i',fileId);
% read Y component
buf = fread(fileId, width * height, 'uchar');
imgYuv(:, :, 1) = reshape(buf, width, height).'; % reshape
% read U component
buf = fread(fileId, width/2 * height/2, 'uchar');
buf = reshape(buf, width/2, height/2).';
imgYuv(:, :, 2) = kron(buf, subSampleMat); % reshape and upsample
% read V component
buf = fread(fileId, width/2 * height/2, 'uchar');
buf = reshape(buf, width/2, height/2).';
imgYuv(:, :, 3) = kron(buf, subSampleMat); % reshape and upsample
% convert YUV to RGB
imgRgb = reshape(convertYuvToRgb(reshape(imgYuv, height * width, 3)), height, width, 3);
mov(f) = im2frame(imgRgb);
progressbar(f/nrFrame)
end
fclose(fileId);
我收到以下錯誤類型的輸入參數「雙重」
未定義功能「clipValue」。
錯誤convertYuvToRgb(第11行)
RGB = UINT8(clipValue(RGB,0,255)); (重新塑形(imgYuv,height * width,3)),高度,寬度,3);重新塑形(轉換)。
錯誤運行(線64)
evalin( '呼叫者',[腳本 ';']);
什麼可能出錯?