import cv2
import numpy as np

def camera_parameters_example():
    """ camera_parameters_example """
    camera = cv2.VideoCapture(0) # get camera
    
    print(camera.get(cv2.CAP_PROP_FRAME_WIDTH)) # print cam width (or .get(3))
    print(camera.get(cv2.CAP_PROP_FRAME_HEIGHT)) # print cam height (or .get(4))

    camera.set(3, 500) # set camera width
    camera.set(4, 500) # set camera height
    while True:
        _, frame = camera.read() # read camera

        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) # convert to gray scale
        cv2.imshow("Frame", gray) # display frame

        if cv2.waitKey(1) & 0xFF == ord("q"): # if press "q"
            break # break the loop

    camera.release() # release camera
    cv2.destroyAllWindows()
    
camera_parameters_example()

b930c9cedcb98d0e9d9ad32cc52abc5bd6708807
<mask token>

<mask token>


def camera_parameters_example():
    """ camera_parameters_example """
    camera = cv2.VideoCapture(0)
    print(camera.get(cv2.CAP_PROP_FRAME_WIDTH))
    print(camera.get(cv2.CAP_PROP_FRAME_HEIGHT))
    camera.set(3, 500)
    camera.set(4, 500)
    while True:
        _, frame = camera.read()
        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
        cv2.imshow('Frame', gray)
        if cv2.waitKey(1) & 255 == ord('q'):
            break
    camera.release()
    cv2.destroyAllWindows()


<mask token>

<mask token>


def camera_parameters_example():
    """ camera_parameters_example """
    camera = cv2.VideoCapture(0)
    print(camera.get(cv2.CAP_PROP_FRAME_WIDTH))
    print(camera.get(cv2.CAP_PROP_FRAME_HEIGHT))
    camera.set(3, 500)
    camera.set(4, 500)
    while True:
        _, frame = camera.read()
        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
        cv2.imshow('Frame', gray)
        if cv2.waitKey(1) & 255 == ord('q'):
            break
    camera.release()
    cv2.destroyAllWindows()


camera_parameters_example()

import cv2
import numpy as np


def camera_parameters_example():
    """ camera_parameters_example """
    camera = cv2.VideoCapture(0)
    print(camera.get(cv2.CAP_PROP_FRAME_WIDTH))
    print(camera.get(cv2.CAP_PROP_FRAME_HEIGHT))
    camera.set(3, 500)
    camera.set(4, 500)
    while True:
        _, frame = camera.read()
        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
        cv2.imshow('Frame', gray)
        if cv2.waitKey(1) & 255 == ord('q'):
            break
    camera.release()
    cv2.destroyAllWindows()


camera_parameters_example()

import cv2
import numpy as np

def camera_parameters_example():
    """ camera_parameters_example """
    camera = cv2.VideoCapture(0) # get camera
    
    print(camera.get(cv2.CAP_PROP_FRAME_WIDTH)) # print cam width (or .get(3))
    print(camera.get(cv2.CAP_PROP_FRAME_HEIGHT)) # print cam height (or .get(4))

    camera.set(3, 500) # set camera width
    camera.set(4, 500) # set camera height
    while True:
        _, frame = camera.read() # read camera

        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) # convert to gray scale
        cv2.imshow("Frame", gray) # display frame

        if cv2.waitKey(1) & 0xFF == ord("q"): # if press "q"
            break # break the loop

    camera.release() # release camera
    cv2.destroyAllWindows()
    
camera_parameters_example()
