I installed Microsoft Visual Studio(MVS) 2008 and Matlab R2007b and tried 'mex -setup' command from Matlab. However my MVS 2008 was not recognized by Matlab. I debugged mex.m and found a way to show MVS 2008 to Matlab. Necessary files are located at 2 different directories in zip file (VS2008MATLABMexCompilerFilesX64 and VS2008MATLABMexCompilerFilesX86), one is for win32 Operating System(OS) and the other one is for win64 OS. There is also 'directory.txt' file in the zip which shows the directory that you should copy necessary files to. I'm using VISTA ultimate edition, but this may work for other OS(not tested).
Simply copy 6 files in one of these directories(depend on your OS) to the directory specified in directory.txt and try 'mex -setup' again. (Procedure for mbuild is similar to this one.).
Does not work in win7 64bit. The files in folder.X86.X64 are the same, which is all for x86 not x64, so may be there is a careless mistakeHowever, the files in works, as the submissioner suggest the link.It is important that users should take care of the outputs when doing 'mex -setup' in matlab. Sometime, the outputs tells that mex is using 'msvc90opts.bat'.
At this time, users should delete 'msvc90opts.bat msvc90opts.stp' in 'C:Program FilesMATLABR2009bbinwin64mexopts', which make mex only use 'msvc90freeopts.stp msvc90freeopts.bat', because files-'msvc90freeopts.bat msvc90freeopts.bat.stp' are correct but 'msvc90opts.bat msvc90opts.stp' are wrong in the submission-'Thank you very much any way. Does not work in win7 64bit. The files in folder.X86.X64 are the same, which is all for x86 not x64, so may be there is a careless mistakeHowever, the files in works, as the submissioner suggest the link.It is important that users should take care of the outputs when doing 'mex -setup' in matlab. Sometime, the outputs tells that mex is using 'msvc90opts.bat'. At this time, users should delete 'msvc90opts.bat msvc90opts.stp' in 'C:Program FilesMATLABR2009bbinwin64mexopts', which make mex only use 'msvc90freeopts.stp msvc90freeopts.bat', because files-'msvc90freeopts.bat msvc90freeopts.bat.stp' are correct but 'msvc90opts.bat msvc90opts.stp' are wrong in the submission-'Thank you very much any way.
It reads individual frame very well. To read the whole video I run a loop. But how can I check that all the frames have been read.
Does it have any parameter to count total number of frames so that I can break the loop after that?Actually it keeps on reading the frames in a circular fashion i.e after last frame comes the first frame and so on.One solution is to check if any frame matrix matches exactly to the first frame then the frames are same hence the video is finished. But that can happen before the end also.I am new to Matlab so maybe I am missing something basic. I am little confused how he's separating Y,U and V components here,because I am not sure how data is saved in a YUV file.
When he first uses uses buf = fread(fileId, width. height, 'uchar'); and after reshaping this data he uses fread(fileId,width/2.height/2,'uchar')that is 1/4 of the data used in previous 'fread' function and because there is no fseek between these 2 fread function and the next fread function the read data should be the same(atleast first 1/4 part of the data read using fread(fileId,height.width,'uchar') and fread(fileID,height/2.width/2,'uchar')).I am also not getting why/how he's using 'kron' to reshape the U and V components. Shashi, I believe you are referring to the linesizeFrame = 1.5.
width. height;occuring in the file loadFileYuv.m.The author is preparing enough memory to be able to load one whole YUV (or YCbCr) 4:2:0 frame. This type of video encoding is called 'Chroma Subsampling'. 4:2:0 means that all luminance values of the scene are recorded, but Cb and Cr are each subsampled at a factor of 2 both horizontally and vertically.
This means the total amount of data required to store each frame is:Total = luminance + Cb + CrTotal = full resolution + 1/4 res + 1/4 resTotal = 1.5. full resolutionFor more information, see Wikipedia's article on Chroma Subsampling:Chroma subsampling is also discussed at 24:21 minutes through A Digital Media Primer for Geeks at.
Currently the program lacks an example of how to use the code.e.g. In the file, loadFileYuv.m, the function call is:function mov,imgRgb = loadFileYuv(fileName, width, height, idxFrame)What is idxFrame? I thought it might be frames per second, but the code seems to indicate it is some sort of structure.
Does this mean the YUV video file needs to be loaded into MATLAB as a variable before this subroutine is used?It seems like this code may work well, but it just needs an example so most people can use it!! Any help would be appreciated.