Capturing image and Viewing it using OpenCV

import cv2

capture = cv2.VideoCapture(0)
capture.set(3, 640)#widthcapture.set(4, 480)#height

if capture.isOpened():
    ret, frame = capture.read()
    cv2.imwrite('osman.jpg', frame)

load_image = cv2.imread('osman.jpg')

while True:
    cv2.imshow('window', load_image)
    if cv2.waitKey(1) == 27:
        break
capture.release()
cv2.destroyAllWindows()

Comments

Popular posts from this blog

Playing a video from file with color BGR, RGB, GRAY, HSV in OpenCV

how to Create a Black Image in OpenCV

How draw Line, Rectangle, Circle, Triangle, and write text in openCV.