Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Install OpenCV (https://pypi.org/project/opencv-python/) and modify the code below such that
- you can view a set of images that are located in your computer. If you have web camera in your
- computer use it and present a mirrored image on of the scene in the screen.
- (https://opencvpythontutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html)
- """
- import numpy as np
- import cv2
- import os
- ipath = "C:\imgs"
- allfiles = os.listdir(ipath)
- ipath = ipath+"\\"
- for i in allfiles:
- img = cv2.imread(ipath + i, 0)
- cv2.imshow(i, img)
- cv2.waitKey(500)
- cv2.destroyAllWindows()
- cap = cv2.VideoCapture(0)
- while(True):
- # Capture frame-by-frame
- ret, frame = cap.read()
- # Our operations on the frame come here
- gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
- # Display the resulting frame
- cv2.imshow('flipped', cv2.flip( gray, 1 ))
- if cv2.waitKey(1) & 0xFF == ord('q'):
- break
- # When everything done, release the capture
- cap.release()
- cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement