Ask Your Question
-1

Python image.shape doesn't match resolution [closed]

asked 2017-05-02 20:03:26 -0600

Hi there,

Just got an issue when I try to check the shape of a Python image loaded from a video

The output for MP4 files seems to be wrong:

./example_videos/bad audio and pixelated.MOV (1080, 1920, 3) - This matches Mac Finder Info

./example_videos/event with contrast.m4v (720, 1280, 3) - This matches Mac Finder Info

./example_videos/event without contrast.m4v (720, 1280, 3) - This matches Mac Finder Info

./example_videos/goldeneye.mp4 (544, 1280, 3) - This matches Mac Finder Info

./example_videos/good shot comp.mp4 (1080, 1920, 3) - This matches Mac Finder Info

./example_videos/low shutter speed.MP4 (1080, 1440, 3) - This does not match Mac Finder Info, should be 1080, 1920, 3

./example_videos/medium blurry presenter.MP4 (1080, 1440, 3) - This does not match Mac Finder Info, should be 1080, 1920, 3

./example_videos/under exposed and bad comp.MP4 (1080, 1440, 3) - This does not match Mac Finder Info, should be 1080, 1920, 3

./example_videos/underexposed first part.mp4 (1080, 1920, 3) - This matches Mac Finder Info

./example_videos/verticle timelapse.MOV (1080, 1920, 3) - This does not match Mac Finder Info, should be 1920, 1080, 3

./example_videos/worse shot comp.mp4 (1080, 1440, 3) - This does not match Mac Finder Info, should be 1080, 1920, 3

import cv2
from moviepy.editor import VideoFileClip
import glob

videos = glob.glob("./example_videos/*.*")

# Iterate over the videos to run the pipeline
for idx, fname in enumerate(videos):

vidcap = cv2.VideoCapture(fname)

success, image = vidcap.read()

print(fname)
print(image.shape)
print("\n")
edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by berak
close date 2017-05-03 01:35:34.543378

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-05-03 01:02:30 -0600

berak gravatar image

your "mac finder app" might be just stupid and wrong. (looks, like it only picks a closest fit from a predefined table)

if you're working with the actual images, the numpy information is canonical.

edit flag offensive delete link more

Comments

I don't think it is; - Opening via cv2 and just saving squashes the image (everything appears stretched) - Finder shows them consistently and the ratios match - The videos were produced on a variety of devices, but all are likely to produce in a standard resolution

robin.garnham gravatar imagerobin.garnham ( 2017-05-03 23:23:21 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2017-05-02 20:03:26 -0600

Seen: 281 times

Last updated: May 02 '17