论文写得很失败,重新拾起心情,生活还得继续。
开学前最后几天复习opencv。
import cv2 as cvdef video_demo(): # 摄像头内容的获取capture = cv.VideoCapture(0)while (True):ret, frame = capture.read() # ret为返回值,frame为视频的每一帧cv.imshow("video", frame)c = cv.waitKey(50)if c == 27: # 按了esc候可以退出breakdef get_info(image): # 图片的读取print(type(src)) # 类别print(image.shape) # 高,宽,通道数目print(image.size) # 像素数据,上面三个属性的乘积print(image.dtype)src = cv.imread("C:/Users/idmin/Desktop/img/img1.jpg")cv.namedWindow("input image", cv.WINDOW_AUTOSIZE)cv.imshow("input image", src)get_info(src)video_demo()cv.waitKey(0)cv.destroyAllWindows() # 关闭所有窗口