#安装 opencv pip install opencv-contrib-python -i https://pypi.tuna.tsinghua.edu.cn/simple/
opencv-contrib-python 包含 numpy库,numpy库是Python的一个扩展程序库,支持大量的维度数组与矩阵运算。
# This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. import cv2 def print_hi(name): # Use a breakpoint in the code line below to debug your script. print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. def view(): image = cv2.imread("opencv.png") cv2.imshow("show", image) # 显示2秒 cv2.waitKey(2000) cv2.destoryAllWindows() # Press the green button in the gutter to run the script. if __name__ == '__main__': # print_hi('PyCharm') view()