File Exchange

image thumbnail

YUV files reading and converting

version 1.0.0.0 (19.4 KB) by Nikola Sprljan
Functions for manipulating YCbCr (also known as "YUV") sequences

24 Downloads

Updated 27 Apr 2012

View License

For YUV sequences comparison the Quality Assessment toolbox is required. For sequence rescaling and when rescaling chromas (e.g. conversion from 4:4:4 to 4:2:2) Matlab Image Processing Toolbox function imresize is used.

Functions:
divide_seq - Divides YUV sequence into segments
mm_seq - Converts video file into raw YCbCr format
read_floatframe - Reads and displays frame values stored as a stream of float numbers
rgb2yuv - Converts RGB to YUV
save_yuvframe - Saves selected frame from yuv sequence to image file
scale_seq - Scales YUV sequence
seq_frames - Returns the number of frames in YUV sequence file
shift_seq - Artificially shifts a sequence in a defined direction by any displacement
write_floatframe - Stores matrix in a file as a stream of float numbers
yuv2avi - Imports YUV sequence and saves it as AVI
yuv2rgb - Converts YUV to RGB
yuv_compare - Compares two YUV sequences by computing PSNR
yuv_export - Exports YUV sequence
yuv_import - Imports YUV sequence
yuv_range - Computes the range of samples in YUV sequence

Cite As

Nikola Sprljan (2020). YUV files reading and converting (https://www.mathworks.com/matlabcentral/fileexchange/36417-yuv-files-reading-and-converting), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (8)

I have been trying to use yuv2rgb function. I encountered the following error. Can any person help to resolve this?
Error using double
Conversion to double from cell is not possible.

Error in yuv2rgb (line 67)
yuv(:,:,1) = double(Y);

roger

In function 'mm2yuv' remember change mmreader for VideoReader. For the rest works well, Thank you!

Some functions should be added to Matlab - this is one of them.
Post Scriptum: I am no longer common user of Mathworks flag product ( I do use GNU Octave-Cli + GNU-please-cit-Parallel ), but I do learn much from its exemplary documentation.

hi,there is no iq-measure.m file inside the yuv_compare.m, do you know where i could get the quality assessment toolbox to calculate the MSE & PSNR? thank you!

I encountered these problems.

>> [Y, U, V] = yuv_import('foreman_qcif.yuv',[352 288],2);
>> rgb = yuv2rgb(Y,U,V);
Error using double
Conversion to double from cell is not possible.

Error in yuv2rgb (line 67)
yuv(:,:,1) = double(Y);

>> [Y, U, V] = yuv_import('foreman_qcif.yuv',[352 288],0);
>> rgb = yuv2rgb(Y,U,V);
Error using double
Conversion to double from cell is not possible.

Error in yuv2rgb (line 67)
yuv(:,:,1) = double(Y);

>> numfrm = yuv2avi('foreman_qcif.yuv',[352 288],'foreman_qcif.avi','none',15,'YUV420_8');
Error using avifile
Too many input arguments.

Error in yuv2avi (line 39)
avi =
avifile(avifilename,'fps',fps,'quality',100,'colormap',gray(256),'compression',compression);

Please suggest the solution to read and convert into RGB video

Ram prasad

ahmed

r

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: YUV processing tool for Matlab R2015