Effacer les filtres
Effacer les filtres

Determine video properties (dimensions of frames)

17 vues (au cours des 30 derniers jours)
SBakc
SBakc le 28 Août 2019
Commenté : Walter Roberson le 29 Août 2019
Hi,
I would like to determine the pixel dimensions of every frame in a video, and the dimensionality of the array per frame.
I have imported the video, but is it possible to output the pixel dimensions of every frame and the dimensionality of the array per frame?
video = VideoReader('video.mp4');
Thank you.
  3 commentaires
SBakc
SBakc le 28 Août 2019
The apperture or focus does not change during the video.
Objects are at the same difference, the goal is to first compute the dimmensions of the frame (horizontal x vertical pixels). I believe this is video.Height x video.Width, but I am unsure how to determine the number of array dimensions.
Walter Roberson
Walter Roberson le 29 Août 2019
video.Height and video.Width do indeed return number of pixels. Each frame returned will have that number of pixels vertically and horizontally.
I am not clear as to what you mean by the "dimensionality". Perhaps you want to use size() on the array. When you are using VideoReader like you are, the rows and columns will match the Height and Width properties. The size in the third dimension will depend upon whether it is grayscale or RGB . If you need to find that out in advance, you can examine the VideoFormat property, or you can take BitsPerPixel and divide by 8 to get the number of color planes.
The exact same size of image will be returned for every frame. MATLAB does not support videos that have varying frame sizes. (It is potentially possible for .gif to have different frame sizes, but those are not handled by any of the video readers.)
Note: the rules about size versus properties are a little different when capturing from a device using the Image Acquisition Toolbox such as a webcam or gige camera: in such cases, the sizes reported by the device might refer to the size before demosaicing or before converting to RGB -- and indeed those routines can return mosaiced frames or frames in color spaces such as YCrCb

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by