import cv2 as cv import numpy as np def video_demo(): ##调用摄像头 capture = cv.VideoCapture(0) while(True): capture = cv.VideoCapture(0) while (True): ret, frame = capture.read() frame = cv.flip(frame, 1) cv.imshow("video", frame) c = cv.waitKey(50) if c == 27: break def get_image_info(contours): ##读取图片大小 print(type(contours)) print(contours.shape) print(contours.size) print(contours.dtype) pixel_data = np.array(contours) print(pixel_data) print("--------- Python OpenCV Tutorial ---------") src = cv.imread("C:/Users/weiqiangwen/Desktop/sest/contours.png") cv.namedWindow("input contours",cv.WINDOW_AUTOSIZE) cv.imshow("contours", src) cv.imwrite("C:/Users/weiqiangwen/Desktop/sest/baocun/contours.png", src) get_image_info(src) video_demo() cv.waitKey(0) cv.destroyAllWindows()
opencv3.0第一天读取摄像头和图片大小类型
猜你喜欢
转载自blog.csdn.net/qq_32340685/article/details/83276514
今日推荐
周排行