Diese Arbeit ist auf dem MPEG-Codec, der eine YUV-Datei als rohe Video-Inout nehmen soll. Im Anschluss ist der Code, den ich die YUV-Datei konvertieren bin mit RGBFehler in clipvalue() in Matlab
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);
Ich erhalte die folgende Fehler
Undefinierte Funktion ‚clipValue‘ für Eingabeargumente vom Typ ‚double‘.
Fehler in convertYuvToRgb (Zeile 11)
rgb = uint8 (clipValue (rgb, 0, 255));
Fehler in conv (Zeile 32) imgRgb = Umformen (convertYuvToRgb (Umformen (ImgYuv, Höhe * Breite, 3)), Höhe, Breite, 3);
Fehler in Lauf (Linie 64)
evalin ('Anrufer', [script ';']);
Was könnte falsch gelaufen sein ??