import cv2 as cv
'''
图片的读取
'''
if __name__ == '__main__':
img = cv.imread(r"images/1.jpg",cv.IMREAD_COLOR)
cv.imshow("pic show",img)
cv.waitKey(0)
import cv2 as cv
'''
图片的读取
'''
if __name__ == '__main__':
img = cv.imread(r"images/1.jpg",cv.IMREAD_GRAYSCALE)
cv.imshow("pic show",img)
cv.waitKey(0)
import numpy as np
import cv2 as cv
img = np.empty((200,200,3),np.uint8)
img[...,0] = 255
img[...,1] = 0
img[...,2] =0
img = cv.cvtColor(img,cv.COLOR_BGR2RGB)
cv.imwrite("img_save.jpg",img)
import cv2 as cv
cap = cv.VideoCapture(0)
while True:
ret,frame = cap.read()
cv.imshow("frame",frame)
if cv.waitKey(30) & 0xFF==ord('q'):
break
cap.release()
cv.destroyWindow()