Why can t matlab find the correct pixel size of a video frame ?

2 views (last 30 days)
I have taken several videos with different phones and cameras, I want to compute the horizontal and vertical number of pixels size in a single frame and I used video.Height and video.Width. This method sometimes fails (not always) and it gives me the wrong results for example with a 1080x1920 phone camera, Matlab computes 656 pixels for height and 368 pixels for width. Does anyone know what the problem might be ? I m using the 2021a version.

Accepted Answer

Image Analyst
Image Analyst on 13 Sep 2022
How are you computing the size? Did you use the size() function directly on the image that read() returned? Probably not. You probably somehow saved a screenshot and got the size of that, which is arbitrary and depends on how big you size that window.
Unfortunately you also forgot to attach your code, probably because you didn't read the Community Guidelines or the tutorial.
Until we get your code, we can only guess.
Walter Roberson
Walter Roberson on 13 Sep 2022
Videos recorded on cameras are not necessarily full size of the still frame that the camera can produce.
For example on my phone, normal still frames are 4032 x 1960, but typical video is 1440 x 1440

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by