Why some of my colored videos load as gray-scale in MATLAB
Mostrar comentarios más antiguos
Hi, I downloaded a bunch of videos from youtube. I then load them to matlab to extract/process 10 randomly selected clips. Most of my videos load perfectly fine, however, a lot of them load as a weird gray-scale version of the video. I load the videos using:
vidObj = VideoReader(filename);
duration = vidObj.Duration ;
clips_indx = duration * rand(10,1);
for i = 1 : 10
vidObj.CurrentTime = clips_indx(i);
im = readFrame(vidObj);
end
This is how the clips look like, tilted and gray!

While the video looks normal like:

I would appreciate any input.
Thanks a lot.
Respuestas (2)
Walter Roberson
el 16 de Mayo de 2016
1 voto
1) It is possible for videos to be pseudocolor; in such a case when you retrieve the frame, the map field will be non-empty and the data field will be 2D.
2) With a shear like that, it is plausible that the video is in YCrCb 4:2:2 or 4:2:0 and needs to be converted to RGB.
7 comentarios
Mona
el 18 de Mayo de 2016
Walter Roberson
el 18 de Mayo de 2016
Please save one of the frames to a .mat file and attach it.
But in the meantime, try configuring http://www.mathworks.com/help/vision/ref/vision.videofilereader-class.html#bse_tfx-3 ImageColorSpace for VideoReader
Walter Roberson
el 20 de Mayo de 2016
Could you show us the output of aviinfo applied to the file?
Mona
el 21 de Mayo de 2016
Walter Roberson
el 21 de Mayo de 2016
I don't know at the moment. Some technical notes on the codecs Youtube uses: http://video.stackexchange.com/questions/5318/how-does-youtube-encode-my-uploads-and-what-codec-should-i-use-to-upload
Mona
el 21 de Mayo de 2016
Categorías
Más información sobre Audio and Video Data en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

