Last active
December 1, 2021 01:42
-
-
Save flipphillips/54277d4c72b1f68620a37d9dd35f02ba to your computer and use it in GitHub Desktop.
opencv resolution test. need to install pandas and lxml for it to work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import cv2 | |
url = "https://en.wikipedia.org/wiki/List_of_common_resolutions" | |
table = pd.read_html(url)[0] | |
table.columns = table.columns.droplevel() | |
cap = cv2.VideoCapture(0) | |
resolutions = {} | |
for index, row in table[["W", "H"]].iterrows(): | |
cap.set(cv2.CAP_PROP_FRAME_WIDTH, row["W"]) | |
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, row["H"]) | |
width = cap.get(cv2.CAP_PROP_FRAME_WIDTH) | |
height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT) | |
resolutions[str(width)+"x"+str(height)] = "OK" | |
print(resolutions) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment