安裝「OpenCV」函式庫

  • 安裝「OpenCV」函式庫:

pip install --upgrade pip
sudo pip install --upgrade pip

pip install opencv-python

# if: Cannot uninstall 'numpy'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

sudo pip install opencv-python --upgrade --ignore-installed opencv-python


import cv2
import numpy as np

# imread()

img1=cv2.imread("apple.jpg",1)

# imshow()

cv2.imshow("image_1",img1)

# imwrite()

cv2.imwrite("1.jpg",img1,[cv2.IMWRITE_JPEG_QUALITY,100])


cv2.waitKey()
cv2.destroyAllWindows()

Reference

results matching ""

    No results matching ""