Skip to content

Instantly share code, notes, and snippets.

@danielharan
Created September 6, 2017 04:15
Show Gist options
  • Save danielharan/4845eb28a4f52acf90da73e28b7b14f7 to your computer and use it in GitHub Desktop.
Save danielharan/4845eb28a4f52acf90da73e28b7b14f7 to your computer and use it in GitHub Desktop.
import numpy as np
import cv2
cap = cv2.VideoCapture(1)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT,640)
cap.set(cv2.CAP_PROP_FRAME_WIDTH,480)
success, frame = cap.read()
cv2.imwrite('ELP_640_480.jpg',frame)
# Actual: 1024 wide x 768 high
cap.set(cv2.CAP_PROP_FRAME_HEIGHT,800)
cap.set(cv2.CAP_PROP_FRAME_WIDTH,600)
success, frame = cap.read()
cv2.imwrite('ELP_800_600.jpg',frame)
# Actual: 1280 wide x 1024 high
cap.set(cv2.CAP_PROP_FRAME_HEIGHT,1024)
cap.set(cv2.CAP_PROP_FRAME_WIDTH,768)
success, frame = cap.read()
cv2.imwrite('ELP_1024_768.jpg',frame)
# Actual: 1280 wide x 1024 high
# 1080p, or Full HD
cap.set(cv2.CAP_PROP_FRAME_HEIGHT,1080)
cap.set(cv2.CAP_PROP_FRAME_WIDTH,1920)
success, frame = cap.read()
cv2.imwrite('ELP_1080_1920.jpg',frame)
# Actual: 1920 wide x 1080 high
# 720p, or HD Ready
cap.set(cv2.CAP_PROP_FRAME_HEIGHT,720)
cap.set(cv2.CAP_PROP_FRAME_WIDTH,1280)
success, frame = cap.read()
cv2.imwrite('ELP_1280_720.jpg',frame)
# Actual: 1280 wide x 720 high
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment