【发布时间】:2020-02-20 14:19:46
【问题描述】:
我在
中定义了capdef fingerCursor(device):
global cap
global cap_height
global cap_width
cap = cv2.VideoCapture(device)
#cap.set(cv2.cap_PROP_FRAME_HEIGHT,720)
#cap.set(cv2.cap_PROP_FRAME_WIDTH,1280)
cap_height = cap.get(cv2.cap_PROP_FRAME_HEIGHT)
cap_width = cap.get(cv2.cap_PROP_FRAME_WIDTH)
#print(cap_height,cap_width)
但每当我运行这部分代码时,它仍然显示 cap 未定义。 cap_height 和 cap_width 也有同样的问题。
while(cap.isOpened()):
## capture frame-by-frame
ret, frame_raw = cap.read()
while not ret:
ret,frame_raw = cap.read()
frame_raw = cv2.flip(frame_raw, 1)
frame = frame_raw[:round(cap_height),:round(cap_width)] # ROI of the image
cv2.imshow("raw_frame",frame)
【问题讨论】:
标签: python machine-learning deep-learning computer-vision artificial-intelligence