Jul 23, 2024
pip install opencv-pythonpython -m pip install opencv-pythonpython3 -m pip install opencv-pythonopencv_tutorial.tutorial1.py.assets folder containing images and videos.import cv2 as cv (Note: cv2 is used instead of opencv-python).path/to/image.jpg.cv.IMREAD_COLOR or -1cv.IMREAD_GRAYSCALE or 0cv.IMREAD_UNCHANGED or 1img = cv.imread('assets/logo.jpg', cv.IMREAD_GRAYSCALE)cv.imshow('Window Name', img)cv.waitKey(0) (0 means wait indefinitely until a key is pressed).cv.destroyAllWindows()resized_img = cv.resize(img, (400, 400))resized_img = cv.resize(img, (0, 0), fx=0.5, fy=0.5)rotated_img = cv.rotate(img, cv.ROTATE_90_CLOCKWISE)rotated_img = cv.rotate(img, cv.ROTATE_90_COUNTERCLOCKWISE)cv.imwrite('new_image.jpg', img)new_image.jpg will be created in the same directory.