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: ## 27 ESC 13 ENTER
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第一天读取摄像头和图片大小类型
最新推荐文章于 2024-08-31 19:05:31 发布